using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
using System.Reflection;
namespace Main
{
public class Customizer : MercatorUi.ICustomizers.IExec
{
public void Main(MercatorUi.ICustomizers.ExecAction Action)
{
if (Action == MercatorUi.ICustomizers.ExecAction.DossierOpen)
{
Globals.Main.BaseFormCreating += new MercatorUi.Main.BaseFormCreatingEventHandler(Main_BaseFormCreating);
}
else if (Action == MercatorUi.ICustomizers.ExecAction.DossierClose)
{
Globals.Main.BaseFormCreating -= new MercatorUi.Main.BaseFormCreatingEventHandler(Main_BaseFormCreating);
}
}
void Main_BaseFormCreating(object sender, MercatorUi.Main.BaseFormCreatingEventArgs e)
{
if (e.Form.GetType() == typeof(MercatorUi.Forms.Accounting.AccountingBankDomicilForm))
{
e.Form.Shown += new EventHandler(Form_Shown);
e.Form.FormClosed += new FormClosedEventHandler(Form_FormClosed);
}
}
void Form_Shown(object sender, EventArgs e)
{
MercatorUi.Forms.Accounting.AccountingBankDomicilForm accountingBankDomicilForm = (MercatorUi.Forms.Accounting.AccountingBankDomicilForm)sender;
accountingBankDomicilForm.Shown -= new EventHandler(Form_Shown); // uitschrijven op het event
MercatorUi.BoutonsPro.BleuPro bleuPro1 = (MercatorUi.BoutonsPro.BleuPro)accountingBankDomicilForm.Controls["bleuPro1"];
MercatorUi.BoutonsPro.ButtonXPro buttonXProBrowsePieceliees = (MercatorUi.BoutonsPro.ButtonXPro)bleuPro1.Controls["buttonBrowsePieceliees"];
MercatorUi.BoutonsPro.ButtonItemPro doSomeThing = new MercatorUi.BoutonsPro.ButtonItemPro();
doSomeThing.Image = MercatorUi._Divers.ImageFromResource("xml16"); // afbeelding 16x16 pixels
doSomeThing.Image32 = MercatorUi._Divers.ImageFromResource("xml32"); // afbeelding 32x32 pixels
doSomeThing.Name = "doSomeThing";
doSomeThing.Text = "Faire Qqch.";
doSomeThing.TextE = "Do Something";
doSomeThing.TextN = "Iets Doen";
doSomeThing.Tag = accountingBankDomicilForm;
doSomeThing.Execute += new MercatorUi.BoutonsPro.ButtonItemPro.ExecuteHandler(doSomeThing_Execute);
buttonXProBrowsePieceliees.SubItems.Add(doSomeThing);
}
void Form_FormClosed(object sender, FormClosedEventArgs e)
{
MercatorUi.Forms.Accounting.AccountingBankDomicilForm accountingBankDomicilForm = (MercatorUi.Forms.Accounting.AccountingBankDomicilForm)sender;
accountingBankDomicilForm.FormClosed -= new FormClosedEventHandler(Form_FormClosed);
MercatorUi.BoutonsPro.BleuPro bleuPro1 = (MercatorUi.BoutonsPro.BleuPro)accountingBankDomicilForm.Controls["bleuPro1"];
MercatorUi.BoutonsPro.ButtonXPro buttonXProBrowsePieceliees = (MercatorUi.BoutonsPro.ButtonXPro)bleuPro1.Controls["buttonBrowsePieceliees"];
MercatorUi.BoutonsPro.ButtonItemPro doSomeThing = (MercatorUi.BoutonsPro.ButtonItemPro)buttonXProBrowsePieceliees.SubItems["doSomeThing"];
doSomeThing.Execute -= new MercatorUi.BoutonsPro.ButtonItemPro.ExecuteHandler(doSomeThing_Execute);
}
void doSomeThing_Execute(object sender, EventArgs e)
{
MercatorUi.BoutonsPro.ButtonItemPro doSomeThing = (MercatorUi.BoutonsPro.ButtonItemPro)sender;
MercatorUi.Forms.Accounting.AccountingBankDomicilForm accountingBankDomicilForm = (MercatorUi.Forms.Accounting.AccountingBankDomicilForm)doSomeThing.Tag;
MercatorUi.Dialogs.Stop(accountingBankDomicilForm.Text);
}
}
}