Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (UserSettingStorage.Instance.WindowLeft == 0 &&
                UserSettingStorage.Instance.WindowTop == 0)
            {
                Left             = UserSettingStorage.Instance.WindowLeft
                                 = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
                Top              = UserSettingStorage.Instance.WindowTop
                                 = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 5;
            }
            else
            {
                Left = UserSettingStorage.Instance.WindowLeft;
                Top  = UserSettingStorage.Instance.WindowTop;
            }

            Plugins.Init();

            InitProgressbarAnimation();

            //only works for win7+
            if (UserSettingStorage.Instance.OpacityMode == OpacityMode.DWM)
            {
                DwmDropShadow.DropShadowToWindow(this);
            }

            this.Background = Brushes.Transparent;
            HwndSource.FromHwnd(new WindowInteropHelper(this).Handle).CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);

            WindowIntelopHelper.DisableControlBox(this);
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 private void OnLoaded(object sender, RoutedEventArgs _)
 {
     InitProgressbarAnimation();
     WindowIntelopHelper.DisableControlBox(this);
     ThemeManager.Instance.ChangeTheme(_settings.Theme);
     InitializeNotifyIcon();
 }
Esempio n. 5
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            Left = GetWindowsLeft();
            Top  = GetWindowsTop();

            InitProgressbarAnimation();
            WindowIntelopHelper.DisableControlBox(this);
            CheckUpdate();
        }
Esempio n. 6
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme);
            InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language);

            Left = GetWindowsLeft();
            Top  = GetWindowsTop();

            InitProgressbarAnimation();
            WindowIntelopHelper.DisableControlBox(this);
            CheckUpdate();
        }
Esempio n. 7
0
        private void OnLoaded(object sender, RoutedEventArgs _)
        {
            InitProgressbarAnimation();
            WindowIntelopHelper.DisableControlBox(this);
            ThemeManager.Instance.ChangeTheme(_settings.Theme);
            InitializeNotifyIcon();

            var vm = (MainViewModel)DataContext;

            RegisterEvents(vm);

            // happlebao todo delete
            vm.Left = GetWindowsLeft();
            vm.Top  = GetWindowsTop();
            vm.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible;
        }