using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using Screen;

// <ReferenceInclude>Screen.dll</ReferenceInclude>

namespace Main
{
    public class Customizer : MercatorUi.ICustomizers.IExec
    {
        public void Main(MercatorUi.ICustomizers.ExecAction Action)
        {
            if (MercatorUi.Globals.IsMajuro && (Action == MercatorUi.ICustomizers.ExecAction.UserLogin))
            {

                if (MercatorUi.Globals.StarterMainForm.Hublot.Controls["grid"] != null)
                    MercatorUi.Globals.StarterMainForm.Hublot.Controls.Remove(MercatorUi.Globals.StarterMainForm.Hublot.Controls["grid"]);

                Grid grid = new Grid.Grid();
                grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                               | System.Windows.Forms.AnchorStyles.Left)
                               | System.Windows.Forms.AnchorStyles.Right)));
                grid.Location = new System.Drawing.Point(20, 20);
                grid.Name = "Grid";
                grid.Size = new System.Drawing.Size(MercatorUi.Globals.StarterMainForm.Hublot.Width - 50, MercatorUi.Globals.StarterMainForm.Hublot.Height - 50);
                grid.TabIndex = 0;

                MercatorUi.Globals.StarterMainForm.Hublot.Controls.Add(grid);
                Grid.SupportRefresh();
                Grid.BringToFront();
            }
            else if (MercatorUi.Globals.IsMajuro && (Action == MercatorUi.ICustomizers.ExecAction.DossierClose))
            {
                if (MercatorUi.Globals.StarterMainForm.Hublot.Controls["Grid"] != null)
                    MercatorUi.Globals.StarterMainForm.Hublot.Controls.Remove(MercatorUi.Globals.StarterMainForm.Hublot.Controls["Grid"]);
            }
        }
    }
}