Ejemplo n.º 1
0
 private void Search([CanBeNull] object sender, [CanBeNull] EventArgs e)
 {
     try
     {
         if (CheckSqlServer())
         {
             MainWindowHelper.Search();
         }
     }
     catch (Exception ex)
     {
         WindowHelper.HandleError("Failed to search", true, ex);
     }
 }
Ejemplo n.º 2
0
 private void Search([CanBeNull] object sender, [CanBeNull] EventArgs e)
 {
     try
     {
         if (this.CheckSqlServer())
         {
             MainWindowHelper.Search();
         }
     }
     catch (Exception ex)
     {
         this.HandleError(ex);
     }
 }
Ejemplo n.º 3
0
        private void ItemsTreeViewKeyPressed([CanBeNull] object sender, [NotNull] KeyEventArgs e)
        {
            try
            {
                Assert.ArgumentNotNull(e, nameof(e));

                if (e.Handled)
                {
                    return;
                }

                e.Handled = true;
                Key key = e.Key;
                switch (key)
                {
                case Key.Delete:
                {
                    if (CheckSqlServer())
                    {
                        new DeleteInstanceButton().OnClick(this, MainWindowHelper.SelectedInstance);
                    }

                    return;
                }

                case Key.F2:
                {
                    if (CheckSqlServer())
                    {
                        // MainWindowHelper.Rename();
                    }

                    return;
                }

                case Key.Escape:
                {
                    if (string.IsNullOrEmpty(SearchTextBox.Text))
                    {
                        // this.WindowState = WindowState.Minimized;
                    }

                    SearchTextBox.Text = string.Empty;
                    if (CheckSqlServer())
                    {
                        MainWindowHelper.Search();
                    }

                    return;
                }

                case Key.F3:
                {
                    InstanceList.ContextMenu.IsOpen = true;
                    return;
                }

                case Key.F5:
                {
                    RefreshInstances();
                    return;
                }

                case Key.C:
                {
                    if ((Keyboard.IsKeyToggled(Key.LeftCtrl) | Keyboard.IsKeyToggled(Key.RightCtrl)) && MainWindowHelper.SelectedInstance != null)
                    {
                        System.Windows.Clipboard.SetText(MainWindowHelper.SelectedInstance.Name);
                        return;
                    }

                    break;
                }
                }

                e.Handled = false;
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("Failed to handle tree view key pressed", true, ex);
            }
        }
Ejemplo n.º 4
0
        private void SearchTextBoxKeyPressed([CanBeNull] object sender, [NotNull] KeyEventArgs e)
        {
            try
            {
                Assert.ArgumentNotNull(e, nameof(e));

                if (e.Handled)
                {
                    return;
                }

                e.Handled = true;
                Key key = e.Key;
                switch (key)
                {
                case Key.Escape:
                {
                    if (string.IsNullOrEmpty(SearchTextBox.Text))
                    {
                        // this.WindowState = WindowState.Minimized;
                    }

                    SearchTextBox.Text = string.Empty;
                    if (CheckSqlServer())
                    {
                        MainWindowHelper.Search();
                    }

                    return;
                }

                case Key.Enter:
                {
                    if (CheckSqlServer())
                    {
                        MainWindowHelper.Search();
                    }

                    return;
                }

                case Key.F5:
                {
                    RefreshInstances();
                    return;
                }

                default:
                {
                    if (WindowsSettings.AppInstanceSearchEnabled.Value)
                    {
                        Timer.Change(TimeSpan.FromMilliseconds(WindowsSettings.AppInstanceSearchTimeout.Value), TimeSpan.FromMilliseconds(-1));
                    }

                    e.Handled = false;
                    return;
                }
                }
            }
            catch (Exception ex)
            {
                WindowHelper.HandleError("Failed to search", true, ex);
            }
        }