private void OnLoaded(object sender, RoutedEventArgs _) { // todo is there a way to set blur only once? ThemeManager.Instance.SetBlurForWindow(); WindowsInteropHelper.DisableControlBox(this); InitProgressbarAnimation(); _viewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility)) { if (Visibility == Visibility.Visible) { Activate(); QueryTextBox.Focus(); SetWindowPosition(); _settings.ActivateTimes++; if (!_viewModel.LastQuerySelected) { QueryTextBox.SelectAll(); _viewModel.LastQuerySelected = true; } } } }; // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); }
private void OnLoaded(object sender, RoutedEventArgs _) { WindowIntelopHelper.DisableControlBox(this); ThemeManager.Instance.ChangeTheme(_settings.Theme); InitializeNotifyIcon(); InitProgressbarAnimation(); _viewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility)) { if (_viewModel.MainWindowVisibility.IsVisible()) { Activate(); QueryTextBox.Focus(); SetWindowPosition(); _settings.ActivateTimes++; if (_viewModel.QueryTextSelected) { QueryTextBox.SelectAll(); _viewModel.QueryTextSelected = false; } } } }; // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); }
private void RegisterEvents(MainViewModel vm) { vm.TextBoxSelected += (o, e) => QueryTextBox.SelectAll(); vm.CursorMovedToEnd += (o, e) => { QueryTextBox.Focus(); QueryTextBox.CaretIndex = QueryTextBox.Text.Length; }; vm.MainWindowVisibilityChanged += (o, e) => { if (vm.MainWindowVisibility.IsVisible()) { Activate(); QueryTextBox.Focus(); Left = GetWindowsLeft(); Top = GetWindowsTop(); _settings.ActivateTimes++; } else { _settings.WindowLeft = Left; _settings.WindowTop = Top; } }; }
private void OnLoaded(object sender, RoutedEventArgs _) { // todo is there a way to set blur only once? BlurWindowHelper.SetBlurForWindow(); WindowsInteropHelper.DisableControlBox(this); //InitProgressbarAnimation(); InitializePosition(); // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); MainViewModel.Current.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility)) { if (Visibility == Visibility.Visible) { Activate(); QueryTextBox.Focus(); UpdatePosition(); if (MainViewModel.Current.LastQuerySelected) { QueryTextBox.SelectAll(); MainViewModel.Current.LastQuerySelected = false; } } } }; InitializePosition(); }
private void OnLoaded(object sender, RoutedEventArgs _) { CheckUpdate(); ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language); InitProgressbarAnimation(); WindowIntelopHelper.DisableControlBox(this); var vm = (MainViewModel)DataContext; vm.TextBoxSelected += (o, e) => QueryTextBox.SelectAll(); vm.CursorMovedToEnd += (o, e) => { QueryTextBox.Focus(); QueryTextBox.CaretIndex = QueryTextBox.Text.Length; }; vm.MainWindowVisibilityChanged += (o, e) => { if (vm.MainWindowVisibility.IsVisible()) { Activate(); QueryTextBox.Focus(); } }; vm.Left = GetWindowsLeft(); vm.Top = GetWindowsTop(); vm.MainWindowVisibility = Visibility.Visible; }
/// <summary> /// event is fired when the 'UpdateButton' is clicked. /// </summary> private void UpdateButton_Click(object sender, EventArgs e) { // Change the text QueryTextBox.Text = "Update" + Environment.NewLine + "Set "; // Set Focus QueryTextBox.Focus(); }
private void SearchPage_Loaded(object sender, RoutedEventArgs e) { Loaded -= SearchPage_Loaded; App.EntriesManager.Construct(); // tfw best practice :p VisualStateManager.GoToState(this, QueryState.Name, true); QueryTextBox.Focus(FocusState.Programmatic); DictsCheck(); App.DictsManager.DictDatabaseChanged += (s, f) => DictsCheck(); }
private void OnLoaded(object sender, RoutedEventArgs _) { InitializeNotifyIcon(); // todo is there a way to set blur only once? ThemeManager.Instance.SetBlurForWindow(); WindowsInteropHelper.DisableControlBox(this); InitProgressbarAnimation(); InitializePosition(); // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); _viewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility)) { if (Visibility == Visibility.Visible) { Activate(); QueryTextBox.Focus(); UpdatePosition(); _settings.ActivateTimes++; if (!_viewModel.LastQuerySelected) { QueryTextBox.SelectAll(); _viewModel.LastQuerySelected = true; } } return; } if (e.PropertyName == nameof(MainViewModel.ProgressBarVisibility)) { if (_viewModel.ProgressBarVisibility == Visibility.Visible) { ProgressBar.BeginStoryboard(_progressBarStoryboard); } else { _progressBarStoryboard.Stop(ProgressBar); } } }; _settings.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(Settings.HideNotifyIcon)) { _notifyIcon.Visible = !_settings.HideNotifyIcon; } }; InitializePosition(); }
private void OnLoaded(object sender, RoutedEventArgs _) { // show notify icon when flowlauncher is hidden InitializeNotifyIcon(); // todo is there a way to set blur only once? ThemeManager.Instance.SetBlurForWindow(); WindowsInteropHelper.DisableControlBox(this); InitProgressbarAnimation(); InitializePosition(); // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); _viewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility)) { if (Visibility == Visibility.Visible) { Activate(); QueryTextBox.Focus(); UpdatePosition(); _settings.ActivateTimes++; if (!_viewModel.LastQuerySelected) { QueryTextBox.SelectAll(); _viewModel.LastQuerySelected = true; } } } }; _settings.PropertyChanged += (o, e) => { switch (e.PropertyName) { case nameof(Settings.HideNotifyIcon): _notifyIcon.Visible = !_settings.HideNotifyIcon; break; case nameof(Settings.Language): UpdateNotifyIconText(); break; } }; InitializePosition(); }
private void OnQueryVisible(object sender, DependencyPropertyChangedEventArgs e) { var visible = (bool)e.NewValue; if (visible) { // the Focusable and the IsVisible both needs to be true when set focus // logical is set in xaml QueryTextBox.Focus(); if (_viewModel.QueryTextSelected) { QueryTextBox.SelectAll(); _viewModel.QueryTextSelected = false; } } }
private void OnInsertClicked(object sender, RoutedEventArgs routedEventArgs) { var mi = (MenuItem)sender; var parent = (MenuItem)mi.Parent; var code = $"{parent.Header}.{mi.Header}"; var length = 0; QueryTextBox.Focus(); var start = QueryTextBox.CaretIndex; if (QueryTextBox.SelectionLength > 0) { length = QueryTextBox.SelectionLength; start = QueryTextBox.SelectionStart; } var methodInfo = Type.GetType($"Couchbase.Lite.Query.{parent.Header}, Couchbase.Lite").GetMethod(mi.Header.ToString()); var isProperty = false; var arguments = Enumerable.Empty <QueryArgument>(); if (methodInfo == null) { if (Type.GetType($"Couchbase.Lite.Query.{parent.Header}, Couchbase.Lite") .GetProperty(mi.Header.ToString()) == null) { throw new ApplicationException("Unknown item, weird..."); } isProperty = true; } else { arguments = methodInfo.GetParameters() .Select(x => new QueryArgument(x.ParameterType == typeof(string), x.Name)); } var range = ((QueryViewModel)DataContext).InsertQueryText(start, length, code, isProperty, arguments); QueryTextBox.SelectionStart = range.start; QueryTextBox.SelectionLength = range.length; }
private void OnOpenClicked(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); var result = dialog.ShowDialog(); if (result == true) { try { DataContext = new QueryViewModel(dialog.SelectedPath); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error opening database"); return; } ((QueryViewModel)DataContext).Error += ShowError; QueryTextBox.Focus(); ((QueryViewModel)DataContext).QueryText = "QueryBuilder.Select()"; QueryTextBox.SelectionStart = ((QueryViewModel)DataContext).QueryText.IndexOf('(') + 1; if (InsertMenu.Items.Count == 0) { PopulateInsertMenu(); } } }
private void OnMainWindowLoaded(object sender, RoutedEventArgs e) => QueryTextBox.Focus();
public MainWindow() { InitializeComponent(); QueryTextBox.Focus(); //TODO:ssdsf }