예제 #1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            _notifyIcon = new NotifyIcon(components);
            _notifyIcon.BalloonTipIcon   = ToolTipIcon.Info;
            _notifyIcon.ContextMenuStrip = notifyMenu;
            _notifyIcon.Icon             = Icon;
            _notifyIcon.Text             = Text;
            _notifyIcon.DoubleClick     += delegate { _presenter.NotifyIconDoubleClick(); };
            _notifyIcon.Visible          = _presenter.Model.NotifyIconVisible;

            // Add the Index Changed Handler here after everything is shown
            dataGridView1.ColumnDisplayIndexChanged += delegate { DataGridViewColumnDisplayIndexChanged(); };
            // Then run it once to ensure the last column is set to Fill
            DataGridViewColumnDisplayIndexChanged();

            _presenter.FormShown();
            using (var scope = _presenter.ServiceScopeFactory.CreateScope())
            {
                var service          = scope.ServiceProvider.GetRequiredService <ApplicationUpdateService>();
                var presenterFactory = scope.ServiceProvider.GetRequiredService <ApplicationUpdatePresenterFactory>();
                _presenter.CheckForUpdateOnStartup(service, presenterFactory);
            }
        }