Beispiel #1
0
        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            WpfConfiguration config = ConfigContent.Content as WpfConfiguration;

            try
            {
                configuration.OnSave();
                SelectedModuleInstance.OnSaved(config);
                ((ModuleBase)SelectedModuleInstance).SetConfigString();
            }
            catch
            {
                ErrorLog.AddError(ErrorType.Failure, "Error saving " + SelectedModule.Name);
            }

            ThreadPool.QueueUserWorkItem(o =>
            {
                try
                {
                    configuration.OnClosing();
                }
                catch
                {
                    ErrorLog.AddError(ErrorType.Failure, "Error closing " + SelectedModule.Name + "'s configuration");
                }
            });
            DialogResult = true;
        }
Beispiel #2
0
        private void Button_Save_Click(object sender, RoutedEventArgs e)
        {
            WpfConfiguration config = ConfigContent.Content as WpfConfiguration;

            try
            {
                configuration.OnSave();
                module.OnSaved(config);
                ((ModuleBase)module).SetConfigString();
            }
            catch
            {
                ErrorLog.AddError(ErrorType.Failure, "Error saving " + configuration.Name);
            }

            ThreadPool.QueueUserWorkItem(o =>
            {
                try
                {
                    configuration.OnClosing();
                }
                catch
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (System.Action)(() =>
                    {
                        ErrorLog.AddError(ErrorType.Failure, "Error closing " + configuration.Name + "'s configuration");
                    }));
                }
            });
            ((MainWindow)Application.Current.MainWindow).Save();
            DialogResult = true;
        }