public MainWindow() { InitializeComponent(); this.Loaded += MainWindow_Loaded; try { DbUtil.prepareTables(); loadSettings(); } catch(Exception e) { MessageBox.Show("Fail to init database:"+e.Message); Environment.Exit(-1); } this.DataContext = this; OpenNewEditorCommand = new OpenEditorCommand(()=>{ QuickLancherEditor qle = new QuickLancherEditor(); qle.Owner = this; qle.AddedNewQuickCommand += Qle_AddedNewQuickCommand; qle.ShowDialog(); }); KeyBinding OpenCmdKeyBinding = new KeyBinding(OpenNewEditorCommand,Key.N,ModifierKeys.Control); InputBindings.Add(OpenCmdKeyBinding); loadQuickCommandsFromDb(""); commandsList.ItemsSource = quickCommands; }
private void newquickcommand_Click(object sender, RoutedEventArgs e) { QuickLancherEditor qle = new QuickLancherEditor(); qle.Owner = this; qle.AddedNewQuickCommand += Qle_AddedNewQuickCommand; qle.ShowDialog(); }
private void edit_Click(object sender, RoutedEventArgs e) { //QuickCommand qc = ((System.Windows.Controls.Button)sender).Tag as QuickCommand; QuickCommand qc = this.commandsList.SelectedItem as QuickCommand; QuickLancherEditor qle = new QuickLancherEditor(); qle.Owner = this; qle.QCommand = qc; qle.AddedNewQuickCommand += Qle_AddedNewQuickCommand; qle.ShowDialog(); }