Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            modInfo.Text = "";
            AMLUtils.InitializeInvoke(this);

            this.Text = "AstroModLoader v" + Application.ProductVersion;

            // Enable double buffering to look nicer
            if (!SystemInformation.TerminalServerSession)
            {
                Type         ourGridType = dataGridView1.GetType();
                PropertyInfo pi          = ourGridType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                pi.SetValue(dataGridView1, true, null);
                this.DoubleBuffered = true;
            }
            dataGridView1.Select();

            if (Program.CommandLineOptions.ServerMode)
            {
                syncButton.Hide();
            }

            ModManager   = new ModHandler(this);
            TableManager = new TableHandler(dataGridView1, ModManager);

            dataGridView1.CellValueChanged    += DataGridView1_CellValueChanged;
            dataGridView1.CellContentClick    += DataGridView1_CellContentClick;
            dataGridView1.DataBindingComplete += DataGridView1_DataBindingComplete;
            dataGridView1.CellEndEdit         += DataGridView1_CellEndEdit;
            dataGridView1.SelectionChanged    += new EventHandler(DataGridView1_SelectionChanged);
            footerPanel.Paint += Footer_Paint;
            AMLPalette.RefreshTheme(this);

            AllowDrop  = true;
            DragEnter += new DragEventHandler(Form1_DragEnter);
            DragDrop  += new DragEventHandler(Form1_DragDrop);
            dataGridView1.DragEnter += new DragEventHandler(Form1_DragEnter);
            dataGridView1.DragDrop  += new DragEventHandler(Form1_DragDrop);

            PeriodicCheckTimer.Enabled     = true;
            CheckAllDirty.Enabled          = true;
            ForceAutoUpdateRefresh.Enabled = true;

            autoUpdater                     = new BackgroundWorker();
            autoUpdater.DoWork             += new DoWorkEventHandler(AutoUpdater_DoWork);
            autoUpdater.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Simple_Refresh_RunWorkerCompleted);
            autoUpdater.RunWorkerAsync();
        }