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

            InitProgressbarAnimation();
            WindowIntelopHelper.DisableControlBox(this);
            CheckUpdate();
        }
Ejemplo 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();
        }
Ejemplo 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;
        }