Beispiel #1
0
        public void Activate(bool activate, ViewType chgMode)
        {
            if (model != null)
            {
                btnSave.IsEnabled = !model.IsCheckMode;
                model.Message     = string.Empty;

                if (activate)
                {
                    using (new UIUtils.WaitCursor())
                    {
                        GrblSettings.Load();
                    }

                    if (treeView.SelectedItem != null && treeView.SelectedItem is GrblSettingDetails)
                    {
                        ShowSetting(treeView.SelectedItem as GrblSettingDetails, false);
                    }
                    else if (dgrSettings.SelectedItem != null)
                    {
                        ShowSetting(dgrSettings.SelectedItem as GrblSettingDetails, false);
                    }
                }
                else
                {
                    if (curSetting != null)
                    {
                        curSetting.Assign();
                    }

                    if (GrblSettings.HasChanges())
                    {
                        if (MessageBox.Show((string)FindResource("SaveSettings"), "ioSender", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
                        {
                            GrblSettings.Save();
                        }
                    }
                }
            }
        }