Ejemplo n.º 1
0
 private async void ThemeSettingsService_OnBackgroundChanged(object sender, Brush backgroundBrush)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         RootGrid.Background = backgroundBrush;
     });
 }
Ejemplo n.º 2
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         SetAppIconBasedOnTheme(theme);
     });
 }
Ejemplo n.º 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);
     });
 }
Ejemplo n.º 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);
     });
 }
Ejemplo n.º 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);
     });
 }
Ejemplo n.º 7
0
 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;
     });
 }
Ejemplo n.º 8
0
 private async void UISettings_AdvancedEffectsEnabledChanged(UISettings sender, object args)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         BackgroundTintOpacitySlider.IsEnabled = UISettings.AdvancedEffectsEnabled &&
                                                 PowerManager.EnergySaverStatus != EnergySaverStatus.On;
     });
 }
Ejemplo n.º 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);
     });
 }
Ejemplo n.º 10
0
 private async void OnStatusBarVisibilityChanged(object sender, bool visible)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () =>
     {
         if (ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay)
         {
             ShowHideStatusBar(visible);
         }
     });
 }
Ejemplo n.º 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;
     });
 }
Ejemplo n.º 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;
         }
     });
 }
Ejemplo n.º 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);
         }
     });
 }
Ejemplo n.º 14
0
 private async void ThemeSettingsService_OnAccentColorChanged(object sender, Color color)
 {
     await ThreadUtility.CallOnUIThreadAsync(Dispatcher, ThemeSettingsService.SetRequestedAccentColor);
 }
Ejemplo n.º 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);
            }
        }