public QueryEditor(ViewModels.ViewModel viewModel) : this() { this.InputBindings.Add(new KeyBinding(viewModel.KeyboardExecuteQueryCommand, new KeyGesture(Key.F5, ModifierKeys.None, "F5"))); this.InputBindings.Add(new KeyBinding(viewModel.KeyboardExecuteQueryCommand, new KeyGesture(Key.E, ModifierKeys.Control, "Ctrl-E"))); this.InputBindings.Add(new KeyBinding(viewModel.KeyboardCheckQueryCommand, new KeyGesture(Key.F5, ModifierKeys.Control, "Ctrl+F5"))); }
public MainWindow() { SplashScreen splash = new SplashScreen("Images/SplashScreen with socrates.png"); splash.Show(false); Thread.Sleep(2000); this.Model = new Model(); Properties.Settings.Default.PropertyChanged += SettingsChanged; InitializeComponent(); this.ViewModel = new ViewModels.ViewModel(this, this.Model); this.DataContext = this.ViewModel; // For some reason this is required for getting the commandparameter // binding mechanism to work for menu items this.ExecuteQueryMenuItem.DataContext = this.ViewModel; this.ResultsEditor.TextArea.Caret.PositionChanged += ResultNavigated; // var isOnline = this.Model.Server.IsServerOnline(); // If this is not zero, the combobox below disappears... splash.Close(TimeSpan.FromSeconds(0)); ConnectionWindow w = new ConnectionWindow(this.Model); var result = w.ShowDialog(); if (!(result.HasValue && result.Value)) { Environment.Exit(0); return; } try { // This call may throw when Basex complains when connecting or // asking for the active databases. this.PopulateUIFromServer(); } catch (Exception e) { this.Model.Status = e.Message; } // Create the first query page this.ViewModel.CreateNewQueryTabItem(); }