public WindowMain() { // wire up error notifier action ErrorNotifier.errorNotifierAction = new ErrorNotifierActionClient(); // init settings AppOptions = new ApplicationOptionsClient(); SettingsReaderWriter.loadApplicationSettingsFromDisk(AppOptions, this); SimulationOptionsForBinding = SettingsReaderWriter.loadSimulationOptionsFromDisk(); InitializeComponent(); initTraces(); initPredictorTypeList(); simulationResultsDictionary.filled += new EventHandler(simulationResultsDictionaryFilled); lbResults.DataContext = displayedResults; // the chart properties are not DependencyProperties so they have to be set programatically MainChart.ShowAM = AppOptions.ShowAM; MainChart.ShowGM = AppOptions.ShowGM; MainChart.ShowHM = AppOptions.ShowHM; MainChart.ShowLine = AppOptions.ShowLine; AppOptions.PropertyChanged += new PropertyChangedEventHandler(AppOptions_PropertyChanged); }
/// <summary> /// Tidies up and terminates the application. /// </summary> private void killApplication() { // abort any ongoing simulations abortAllWork(); // save app settings and connections to disk SettingsReaderWriter.saveSettingsToDisk(this.AppOptions, this.TCPConnections as IEnumerable <TCPSimulatorProxy>, this.SimulationOptionsForBinding); // disconnect any left connections, to be tidy foreach (TCPSimulatorProxy proxy in TCPConnections) { proxy.disconnect(); } Application.Current.Shutdown(); }