Пример #1
0
        private static void LoadSharedEnvironmentManager()
        {
            if (SharedEnvironmentManager != null)
            {
                SharedEnvironmentManager.Dispose();
            }

            SharedEnvironmentManager = new ChoSharedEnvironmentManager(_sharedEnvironmentConfigFilePath);
            LoadFrxConfigPath();

            if (_sharedEnvConfigFileWatcher != null)
            {
                _sharedEnvConfigFileWatcher.Dispose();
            }

            if (!_sharedEnvironmentConfigFilePath.IsNullOrWhiteSpace())
            {
                _sharedEnvConfigFileWatcher = new ChoConfigurationChangeFileWatcher("SharedEnvConfigFileWatcher", _sharedEnvironmentConfigFilePath);
                _sharedEnvConfigFileWatcher.DoNotUseGlobalQueue = true;
                _sharedEnvConfigFileWatcher.SetConfigurationChangedEventHandler("OnSharedEnvironmentFileChanged", (sender, e) =>
                {
                    if (SharedEnvironmentManager != null)
                    {
                        SharedEnvironmentManager.Dispose();
                    }

                    SharedEnvironmentManager = new ChoSharedEnvironmentManager(_sharedEnvironmentConfigFilePath);
                    LoadFrxConfigPath();

                    OnEnvironmentChanged();
                });

                _sharedEnvConfigFileWatcher.StartWatching();
            }
        }
Пример #2
0
        public static void ShowWnd()
        {
            if (_isShown)
            {
                return;
            }

            _isShown = true;
            if (Environment.UserInteractive)
            {
                if (!ChoServiceCommandLineArgs.HasServiceParams())
                {
                    if (ChoApplication.ApplicationMode == ChoApplicationMode.Windows ||
                        ChoApplication.ApplicationMode == ChoApplicationMode.Console)
                    {
                        if (!ChoAppFrxSettings.Me.DoNotShowEnvSelectionWnd)
                        {
                            ChoEnvironmentDetails environmentDetails = null;

                            ChoSharedEnvironmentManager sharedEnvironmentManager = new ChoSharedEnvironmentManager();
                            environmentDetails = ChoEnvironmentSettings.GetEnvironmentDetails();
                            if (environmentDetails != null)
                            {
                                if (environmentDetails.Freeze)
                                {
                                    return;
                                }
                            }

                            if (sharedEnvironmentManager.EnvironmentDetails != null &&
                                sharedEnvironmentManager.EnvironmentDetails.Length >= 1)
                            {
                                if (sharedEnvironmentManager.EnvironmentDetails.Length == 1)
                                {
                                    return;
                                }

                                ChoChooseEnvironmentFrm frm1 = new ChoChooseEnvironmentFrm();
                                if (frm1.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                                {
                                    Environment.Exit(-101);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
        private void ChoChooseEnvironmentFrm_Load(object sender, EventArgs e)
        {
            ChoEnvironmentDetails environmentDetails = null;

            this.ActiveControl = cmbEnvironments;

            ChoSharedEnvironmentManager sharedEnvironmentManager = new ChoSharedEnvironmentManager();

            environmentDetails = ChoEnvironmentSettings.GetEnvironmentDetails();
            if (environmentDetails != null)
            {
                if (environmentDetails.Freeze)
                {
                    btnOK_Click(this, null);
                    return;
                }
            }

            if (sharedEnvironmentManager.EnvironmentDetails != null &&
                sharedEnvironmentManager.EnvironmentDetails.Length >= 1)
            {
                _bs.DataSource                = new List <ChoEnvironmentDetails>(sharedEnvironmentManager.EnvironmentDetails);
                cmbEnvironments.DataSource    = _bs;
                cmbEnvironments.DisplayMember = "Name";
                cmbEnvironments.ValueMember   = "Name";

                txtEnvComment.DataBindings.Add("Text", _bs, "Comment");

                if (sharedEnvironmentManager.EnvironmentDetails.Length == 1)
                {
                    btnOK_Click(this, null);
                }

                if (environmentDetails != null)
                {
                    cmbEnvironments.SelectedItem = environmentDetails.Name;
                }
            }
            else
            {
                btnOK_Click(this, null);
            }
        }