Пример #1
0
        private void RequestListForm_Load(object sender, EventArgs e)
        {
            try
            {
                splash.BringToFront();
                SystemTray.DisplaySystemTrayIcon();
                SystemTray.NotifyIconPicked += notifyIcon_Picked;

                DisplayInformationalStatus("Initializing", TextColor.Normal, toolStripLoginStatus);
                DisplayInformationalStatus("Identifying Network Settings. Please Wait...", TextColor.Normal, toolStripStatusNetworkConnectivityStatus);

                try
                {
                    Configuration configuration = Configuration.Instance;
                }
                catch (NetworkSettingsFileNotFound ex)
                {
                    Configuration.CreateNewNetworkSettingsFile();
                    DisplayInformationalStatus(ex.Message, TextColor.Alert, toolStripStatusNetworkConnectivityStatus);
                }

                cbRunAtWindowsStartup.Checked = Properties.Settings.Default.RunAtStartup;
                cbAutoRefresh.Checked         = Properties.Settings.Default.AutoRefresh;

                _isFormInitialized = true;

                // Delegate the rest the of time consuming (but non-UI) startup tasks to a worker thread,
                // so the main screen get show up quickly.
                startupWorker.RunWorkerAsync();

                DisplayInformationalStatus("Connecting", TextColor.Normal, toolStripLoginStatus);
                DisplayInformationalStatus(string.Format("Connecting to {0} Network(s)", Configuration.Instance.NetworkSettingCollection.NetWorkSettings.Count), TextColor.Normal, toolStripStatusNetworkConnectivityStatus);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MessageBox.Show(ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }