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 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 _) { 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 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; }
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 _) { 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; } } }