예제 #1
0
 private async void ThemeSettingsService_OnBackgroundChanged(object sender, Brush backgroundBrush)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         RootGrid.Background = backgroundBrush;
     });
 }
예제 #2
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         SetAppIconBasedOnTheme(theme);
     });
 }
예제 #3
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, EventArgs args)
 {
     await ThreadUtility.CallOnUIThreadAsync(Window.Current?.Dispatcher ?? Dispatcher, () =>
     {
         ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null, Application.Current.RequestedTheme);
     });
 }
예제 #4
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, EventArgs args)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar, Application.Current.RequestedTheme);
     });
 }
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         SetSelectionHighlightColor(color);
     });
 }
예제 #6
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         LeftBox.SelectionHighlightColor  = new SolidColorBrush(color);
         RightBox.SelectionHighlightColor = new SolidColorBrush(color);
     });
 }
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         LeftBox.SelectionHighlightColor  = Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush;
         RightBox.SelectionHighlightColor = Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush;
     });
 }
예제 #8
0
 private async void UISettings_AdvancedEffectsEnabledChanged(UISettings sender, object args)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         BackgroundTintOpacitySlider.IsEnabled = UISettings.AdvancedEffectsEnabled &&
                                                 PowerManager.EnergySaverStatus != EnergySaverStatus.On;
     });
 }
예제 #9
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, EventArgs args)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         SetAppIconBasedOnTheme(ThemeSettingsService.UseWindowsTheme
             ? ThemeSettingsService.ApplicationThemeToElementTheme(Application.Current.RequestedTheme)
             : ThemeSettingsService.ThemeMode);
     });
 }
예제 #10
0
 private async void OnStatusBarVisibilityChanged(object sender, bool visible)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         if (ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay)
         {
             ShowHideStatusBar(visible);
         }
     });
 }
예제 #11
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         BackgroundTintOpacitySlider.Foreground = new SolidColorBrush(color);
         AccentColorPicker.ColorChanged        -= AccentColorPicker_OnColorChanged;
         AccentColorPicker.Color         = color;
         AccentColorPicker.ColorChanged += AccentColorPicker_OnColorChanged;
     });
 }
예제 #12
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(_dispatcher, () =>
     {
         if (Sets.Items == null)
         {
             return;
         }
         foreach (SetsViewItem item in Sets.Items)
         {
             item.Icon.Foreground = Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush;
             item.SelectionIndicatorForeground = Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush;
         }
     });
 }
예제 #13
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(_dispatcher, () =>
     {
         if (Sets.Items == null)
         {
             return;
         }
         foreach (SetsViewItem item in Sets.Items)
         {
             item.Icon.Foreground = new SolidColorBrush(color);
             item.SelectionIndicatorForeground = new SolidColorBrush(color);
         }
     });
 }
예제 #14
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, ThemeSettingsService.SetRequestedAccentColor);
 }
예제 #15
0
        public NotepadsMainPage()
        {
            InitializeComponent();

            _defaultNewFileName = _resourceLoader.GetString("TextEditor_DefaultNewFileName");

            NotificationCenter.Instance.SetNotificationDelegate(this);

            // Setup theme
            ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar, Application.Current.RequestedTheme);
            ThemeSettingsService.OnBackgroundChanged  += ThemeSettingsService_OnBackgroundChanged;
            ThemeSettingsService.OnThemeChanged       += ThemeSettingsService_OnThemeChanged;
            ThemeSettingsService.OnAccentColorChanged += ThemeSettingsService_OnAccentColorChanged;

            // Setup custom Title Bar
            Window.Current.SetTitleBar(AppTitleBar);

            // Setup status bar
            ShowHideStatusBar(EditorSettingsService.ShowStatusBar);
            EditorSettingsService.OnStatusBarVisibilityChanged += async(sender, visibility) =>
            {
                await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
                {
                    if (ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay)
                    {
                        ShowHideStatusBar(visibility);
                    }
                });
            };

            // Session backup and restore toggle
            EditorSettingsService.OnSessionBackupAndRestoreOptionChanged += async(sender, isSessionBackupAndRestoreEnabled) =>
            {
                await ThreadUtility.CallOnUIThreadAsync(Dispatcher, async() =>
                {
                    if (isSessionBackupAndRestoreEnabled)
                    {
                        SessionManager.IsBackupEnabled = true;
                        SessionManager.StartSessionBackup(startImmediately: true);
                    }
                    else
                    {
                        SessionManager.IsBackupEnabled = false;
                        SessionManager.StopSessionBackup();
                        await SessionManager.ClearSessionDataAsync();
                    }
                });
            };

            // Sharing
            Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView().DataRequested += MainPage_DataRequested;
            Windows.UI.Core.Preview.SystemNavigationManagerPreview.GetForCurrentView().CloseRequested   += MainPage_CloseRequested;

            if (App.IsGameBarWidget)
            {
                TitleBarReservedArea.Width = .0f;
            }
            else
            {
                Window.Current.SizeChanged       += WindowSizeChanged;
                Window.Current.VisibilityChanged += WindowVisibilityChangedEventHandler;
            }

            InitControls();

            // Init shortcuts
            _keyboardCommandHandler = GetKeyboardCommandHandler();

            //Register for printing
            if (!PrintManager.IsSupported())
            {
                MenuPrintButton.Visibility    = Visibility.Collapsed;
                MenuPrintAllButton.Visibility = Visibility.Collapsed;
                MenuPrintSeparator.Visibility = Visibility.Collapsed;
            }
            else
            {
                PrintArgs.RegisterForPrinting(this);
            }
        }