using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
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;
if (sigForm.Mode != MercatorUi.Forms.Sig.SigClasses.SigFormMode.Normal) // Er wordt niets uitgevoerd in het geval van standaardwaarden, multicriteriazoekopdrachten ...
return;
List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.ArtFou));
if (l.Count == 0)
return;
MercatorUi.Forms.Sig.SigGrids.ArtFou artFou = (MercatorUi.Forms.Sig.SigGrids.ArtFou)l[0];
artFou.PrincipalChanged += new MercatorUi.Forms.Sig.SigGrids.ArtFou.PrincipalChangedHandler(artFou_PrincipalChanged);
}
public void FormClosedCustomize(System.Windows.Forms.Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
if (sigForm.Mode != MercatorUi.Forms.Sig.SigClasses.SigFormMode.Normal)
return;
List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.ArtFou));
if (l.Count == 0)
return;
MercatorUi.Forms.Sig.SigGrids.ArtFou artFou = (MercatorUi.Forms.Sig.SigGrids.ArtFou)l[0];
artFou.PrincipalChanged -= new MercatorUi.Forms.Sig.SigGrids.ArtFou.PrincipalChangedHandler(artFou_PrincipalChanged);
}
void artFou_PrincipalChanged(object sender, MercatorUi.Forms.Sig.SigGrids.ArtFou.PrincipalChangedEventArgs e)
{
MercatorUi.Forms.Sig.SigGrids.ArtFou artFou = (MercatorUi.Forms.Sig.SigGrids.ArtFou)sender;
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)artFou.Form;
if (!sigForm.IsFiltring) // Vergewis u ervan dat het rooster niet in "Filter"-modus staat.
{
if (e.DataRowPrincipal == null) // Geen enkele rij "Principal" aangevinkt
sigForm.DataSourceRow["S_PRIX_FOU"] = 0;
else
sigForm.DataSourceRow["S_PRIX_FOU"] = e.DataRowPrincipal["prix"];
}
}
}
}