using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
namespace SigCli
{
public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
{
public void FormLoadCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.MovableControls.MovableGrid userDefinedGrid = (MercatorUi.MovableControls.MovableGrid)sigForm.MovableControls["2834DF4A76"];
userDefinedGrid.AfterColumnsCreated += new MercatorUi.MovableControls.MovableGrid.AfterColumnsCreatedHandler(userDefinedGrid_AfterColumnsCreated);
}
public void FormClosedCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.MovableControls.MovableGrid userDefinedGrid = (MercatorUi.MovableControls.MovableGrid)sigForm.MovableControls["2834DF4A76"];
userDefinedGrid.AfterColumnsCreated -= new MercatorUi.MovableControls.MovableGrid.AfterColumnsCreatedHandler(userDefinedGrid_AfterColumnsCreated);
}
void userDefinedGrid_AfterColumnsCreated(object sender, EventArgs e)
{
MercatorUi.MovableControls.MovableGrid userDefinedGrid = (MercatorUi.MovableControls.MovableGrid)sender;
MercatorUi.GridPro.DataGridViewXPro grid = userDefinedGrid.Grid;
grid.Columns.Clear();
DataTable dt = (DataTable)grid.DataSource;
dt.Columns["temps"].AllowDBNull = true;
grid.DataSource = null;
grid.AllowRupture = true;
grid.DataSource = dt;
grid.Columns.Add(new MercatorUi.GridPro.RupturableDataGridViewTextBoxColumn("titre", "Titre"));
grid.Columns["titre"].Width = 100;
grid.Columns["titre"].DataPropertyName = "titre";
grid.Columns.Add("temps", "Temps");
grid.Columns["temps"].Width = 80;
grid.Columns["temps"].DataPropertyName = "temps";
grid.Columns["temps"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
grid.RuptureCalculationColumnsList = new List<MercatorUi.GridPro.DataGridViewColumnForRuptureCalculation>();
grid.RuptureCalculationColumnsList.Add(new MercatorUi.GridPro.DataGridViewColumnForRuptureCalculation(grid.Columns["temps"], MercatorUi.GridPro.RuptureCalculations.Sum, grid.Columns["titre"]));
MercatorUi._BaseClasses.TimerOneShot timer = new MercatorUi._BaseClasses.TimerOneShot(timer_Tick, grid);
}
void timer_Tick(object sender, EventArgs e)
{
MercatorUi._BaseClasses.TimerOneShot timer = (MercatorUi._BaseClasses.TimerOneShot)sender;
MercatorUi.GridPro.DataGridViewXPro grid = (MercatorUi.GridPro.DataGridViewXPro)timer.Tag;
grid.PlaceRupture(grid.Columns["titre"]);
}
}
}