Cette programmation permet de changer le nombre de décimales affichées dans la grille des gammes prix du signalétique des articles. Cela se réalise avec un customizer SigStock qui implémente les interfaces :
Le code est le suivant :
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Linq;
using MercatorApi;
using MercatorExtensions;
using MercatorUi;
using MercatorDatabase;
using System.Windows.Forms;
namespace SigStock
{
public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer,
MercatorUi.ICustomizers.IFormClosedCustomizer
{
public void FormLoadCustomize(System.Windows.Forms.Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
foreach (Control c in sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Gam)))
{
if (((MercatorUi.Forms.Sig.SigGrids.Gam)c).GridGameEnum == MercatorUi.Forms.Sig.SigGrids.GridGamEnum.Prices)
((MercatorUi.Forms.Sig.SigGrids.Gam)c).AssociatedPanelCreated += gamPrix_AssociatedPanelCreated;
}
}
public void FormClosedCustomize(System.Windows.Forms.Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
foreach (Control c in sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Gam)))
{
if (((MercatorUi.Forms.Sig.SigGrids.Gam)c).GridGameEnum == MercatorUi.Forms.Sig.SigGrids.GridGamEnum.Prices)
((MercatorUi.Forms.Sig.SigGrids.Gam)c).AssociatedPanelCreated -= gamPrix_AssociatedPanelCreated;
}
}
void gamPrix_AssociatedPanelCreated(object sender, MercatorUi.MovableControls.MovableGrid.AssociatedPanelCreatedEventArgs e)
{
MercatorUi.Forms.Sig.SigGrids.GamBottomPanel gamPrix = (MercatorUi.Forms.Sig.SigGrids.GamBottomPanel)e.AssociatedPanel;
DataTable dt = (DataTable)gamPrix.ComboBoxPrix.DataSource;
foreach (DataRow dr in dt.Rows)
dr["dec"] = 4;
}
}
}