public MainWindow() { this.Loaded += new RoutedEventHandler(MainWindow_Loaded); InitializeComponent(); this.DataContext = vm; SelectConnection.ViewModel = vm; this.selectRules.NewRuleButton.Click += new RoutedEventHandler(delegate(Object sender, RoutedEventArgs args) { String ruleName = "User-defined rule " + (dblint.AllExecutables.GetSQLRules().Count + 1); SQLRule newRule = SQLRuleCollection.AddSQLRule(ruleName); this.dblint.AllExecutables.AddExecutable(newRule); this.updateSQLRuleSet(); }); this.selectRules.OnDeleteRule += new DeleteRuleHandler(delegate(Rule rule) { SQLRuleCollection.RemoveSQLRule(rule.Name); this.dblint.AllExecutables.RemoveExecutable(rule.Executable); this.updateSQLRuleSet(); }); this.selectRules.SaveConfigButon.Click += new RoutedEventHandler(delegate(Object sender, RoutedEventArgs args) { var saveConfigOptions = new SaveConfigOptions(); var res = saveConfigOptions.ShowDialog(); if (res.HasValue && res.Value == true) { this.saveConfig(saveConfigOptions); } }); this.selectRules.LoadConfigButon.Click += new RoutedEventHandler(delegate(Object sender, RoutedEventArgs args) { Microsoft.Win32.OpenFileDialog loadDialog = new Microsoft.Win32.OpenFileDialog(); loadDialog.DefaultExt = ".xml"; loadDialog.Filter = "XML Document (.xml)|*.xml"; bool?result = loadDialog.ShowDialog(); if (result == true) { this.loadConfig(loadDialog.FileName); } }); this.loadConfig(Settings.XMLCONFIG); this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); }