예제 #1
0
        void _clientLogic_ClientLogicUI(object sender, ClientLogicUIEventArgs e)
        {
            if (this.Dispatcher.CheckAccess())
            {
                // reset expected action
                _currentExpectedAction = ExpectedAction.None;

                switch (e.UIRequest)
                {
                case ClientLogicUIRequest.ProxySettingsUpdated:
                    // before closing try to reselect the active context Id on load
                    if (UserSettings.Settings.CurrentContextId != _activeContextIdOnLoad)
                    {
                        if ((_clientLogic.ContextCollection != null) && (_clientLogic.ContextCollection.Count > 0))
                        {
                            foreach (DisplayContext contextSettings in _clientLogic.ContextCollection)
                            {
                                if ((contextSettings.IsActive) && (contextSettings.Id == _activeContextIdOnLoad))
                                {
                                    UserSettings.Settings.CurrentContextId = contextSettings.Id;
                                    break;
                                }
                            }
                        }
                    }

                    // proxy settings updated on exit so close when complete
                    this.DialogResult = true;
                    break;

                case ClientLogicUIRequest.ContextCollectionReady:
                    UpdateState();
                    UpdateProyControl();

                    _updatingLogAndReportingStatus = true;
                    _updatingProfileStatus         = true;

                    checkBoxServiceLog.IsChecked = _clientLogic.ServiceLogEnabled;
                    listViewProfiles.Items.Refresh();

                    _updatingProfileStatus         = false;
                    _updatingLogAndReportingStatus = false;

                    if (_activateRequired)
                    {
                        _activateRequired = false;
                        _clientLogic.AdminActivateContext(_activateContextId);
                    }
                    break;

                case ClientLogicUIRequest.NewContextSettingsReady:
                    // get DB settings for the add operation - BeginInvoke to free up ClientLogic
                    this.Dispatcher.BeginInvoke(new Action(RunDBConfigForAdd));
                    break;

                case ClientLogicUIRequest.MoveIndexComplete:
                    // update contexts - BeginInvoke to free up ClientLogic
                    this.Dispatcher.BeginInvoke(new Action(UpdateContextSettings));
                    break;
                }
            }
            else
            {
                this.Dispatcher.BeginInvoke(new Action <object, ClientLogicUIEventArgs>(_clientLogic_ClientLogicUI), sender, e);
            }
        }