Ejemplo n.º 1
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);
     });
 }
Ejemplo n.º 2
0
 private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
 {
     await Dispatcher.CallOnUIThreadAsync(() =>
     {
         ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null);
     });
 }
Ejemplo n.º 3
0
 private async void ThemeSettingsService_OnRequestThemeUpdate(object sender, EventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null);
     });
 }
Ejemplo n.º 4
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.º 5
0
        public MainPage()
        {
            InitializeComponent();

            _defaultNewFileName = _resourceLoader.GetString("TextEditor_DefaultNewFileName");

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

            // Setup status bar
            ShowHideStatusBar(EditorSettingsService.ShowStatusBar);

            // Setup theme
            ThemeSettingsService.AppBackground = RootGrid;
            ThemeSettingsService.SetRequestedTheme();
            ThemeSettingsService.OnAccentColorChanged += ThemeSettingsService_OnAccentColorChanged;

            EditorSettingsService.OnDefaultLineEndingChanged   += EditorSettingsService_OnDefaultLineEndingChanged;
            EditorSettingsService.OnDefaultEncodingChanged     += EditorSettingsService_OnDefaultEncodingChanged;
            EditorSettingsService.OnStatusBarVisibilityChanged += (sender, visibility) => ShowHideStatusBar(visibility);

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

            Window.Current.VisibilityChanged += WindowVisibilityChangedEventHandler;
        }
Ejemplo n.º 6
0
        public MainPage()
        {
            InitializeComponent();

            _defaultNewFileName = _resourceLoader.GetString("TextEditor_DefaultNewFileName");

            NotificationCenter.Instance.SetNotificationDelegate(this);

            // Setup theme
            ThemeSettingsService.AppBackground = RootGrid;
            ThemeSettingsService.SetRequestedTheme();

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

            // Setup status bar
            ShowHideStatusBar(EditorSettingsService.ShowStatusBar);
            EditorSettingsService.OnStatusBarVisibilityChanged += (sender, visibility) => ShowHideStatusBar(visibility);

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

            Window.Current.VisibilityChanged += WindowVisibilityChangedEventHandler;

            InitControls();

            // Init shortcuts
            _keyboardCommandHandler = GetKeyboardCommandHandler();
        }
 private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme)
 {
     await Dispatcher.CallOnUIThreadAsync(() =>
     {
         ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar);
     });
 }
 private void InitializeThemeSettings()
 {
     ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar);
     ThemeSettingsService.OnBackgroundChanged  += ThemeSettingsService_OnBackgroundChanged;
     ThemeSettingsService.OnThemeChanged       += ThemeSettingsService_OnThemeChanged;
     ThemeSettingsService.OnAccentColorChanged += ThemeSettingsService_OnAccentColorChanged;
 }
Ejemplo n.º 9
0
 private async void ThemeSettingsService_OnRequestThemeUpdate(object sender, EventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar);
     });
 }
Ejemplo n.º 10
0
        public SettingsPage()
        {
            InitializeComponent();
            Loaded   += SettingsPage_Loaded;
            Unloaded += SettingsPage_Unloaded;

            if (App.IsGameBarWidget)
            {
                ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null);
            }
        }
Ejemplo n.º 11
0
        public MainPage()
        {
            InitializeComponent();

            _defaultNewFileName = _resourceLoader.GetString("TextEditor_DefaultNewFileName");

            NotificationCenter.Instance.SetNotificationDelegate(this);

            // Setup theme
            ThemeSettingsService.AppBackground = RootGrid;
            ThemeSettingsService.SetRequestedTheme();

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

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

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

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

            Window.Current.VisibilityChanged += WindowVisibilityChangedEventHandler;
            Window.Current.SizeChanged       += WindowSizeChanged;

            InitControls();

            // Init shortcuts
            _keyboardCommandHandler = GetKeyboardCommandHandler();
        }
Ejemplo n.º 12
0
        private XboxGameBarWidget _widget; // maintain throughout the lifetime of the settings widget

        public SettingsPage()
        {
            InitializeComponent();
            Loaded += SettingsPage_Loaded;

            if (App.IsGameBarWidget)
            {
                ThemeSettingsService.OnRequestThemeUpdate       += ThemeSettingsService_OnRequestThemeUpdate;
                ThemeSettingsService.OnRequestAccentColorUpdate += ThemeSettingsService_OnRequestAccentColorUpdate;

                ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null);
            }
        }
Ejemplo n.º 13
0
        public MainPage()
        {
            InitializeComponent();

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

            // Setup theme
            ThemeSettingsService.AppBackground = RootGrid;
            ThemeSettingsService.SetRequestedTheme();
            ThemeSettingsService.OnAccentColorChanged += ThemeSettingsService_OnAccentColorChanged;

            EditorSettingsService.OnDefaultLineEndingChanged += EditorSettingsService_OnDefaultLineEndingChanged;
            EditorSettingsService.OnDefaultEncodingChanged   += EditorSettingsService_OnDefaultEncodingChanged;

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

            Window.Current.VisibilityChanged += WindowVisibilityChangedEventHandler;
        }
Ejemplo n.º 14
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);
            }
        }