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; }
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_OnRequestThemeUpdate(object sender, EventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { ThemeSettingsService.SetRequestedTheme(RootGrid, Window.Current.Content, ApplicationView.GetForCurrentView().TitleBar); }); }
private async void ThemeSettingsService_OnRequestThemeUpdate(object sender, EventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null); }); }
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); }); }
private async void ThemeSettingsService_OnRequestAccentColorUpdate(object sender, EventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { ThemeSettingsService.SetRequestedAccentColor(); }); }
private async void ThemeSettingsService_OnThemeChanged(object sender, ElementTheme theme) { await Dispatcher.CallOnUIThreadAsync(() => { ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null); }); }
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; }
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 System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e) { if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(e); Window.Current.Content = rootFrame; } ThemeSettingsService.Initialize(); EditorSettingsService.Initialize(); var appLaunchSettings = new Dictionary <string, string>() { { "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString() }, { "ThemeMode", ThemeSettingsService.ThemeMode.ToString() }, { "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString() }, { "AppBackgroundTintOpacity", $"{(int) (ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}" }, { "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString() }, { "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString() }, { "EditorDefaultEncoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultEncoding) }, { "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString() }, { "EditorDefaultDecoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultDecoding) }, { "EditorFontFamily", EditorSettingsService.EditorFontFamily }, { "EditorFontSize", EditorSettingsService.EditorFontSize.ToString() }, { "IsSessionSnapshotEnabled", EditorSettingsService.IsSessionSnapshotEnabled.ToString() }, }; LoggingService.LogInfo($"AppLaunchSettings: {string.Join(";", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}"); Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings); await ActivationService.ActivateAsync(rootFrame, e); Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); }
private async void ThemeSettingsService_OnThemeChanged(object sender, EventArgs args) { await ThreadUtility.CallOnUIThreadAsync(Dispatcher, () => { SetAppIconBasedOnTheme(ThemeSettingsService.UseWindowsTheme ? ThemeSettingsService.ApplicationThemeToElementTheme(Application.Current.RequestedTheme) : ThemeSettingsService.ThemeMode); }); }
private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e) { bool rootFrameCreated = false; if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(e); Window.Current.Content = rootFrame; rootFrameCreated = true; ThemeSettingsService.Initialize(); EditorSettingsService.Initialize(); } var appLaunchSettings = new Dictionary <string, string>() { { "OSArchitecture", SystemInformation.OperatingSystemArchitecture.ToString() }, { "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString() }, { "ThemeMode", ThemeSettingsService.ThemeMode.ToString() }, { "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString() }, { "AppBackgroundTintOpacity", $"{(int) (ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}" }, { "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString() }, { "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString() }, { "EditorDefaultEncoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultEncoding) }, { "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString() }, { "EditorDefaultDecoding", EditorSettingsService.EditorDefaultDecoding == null ? "Auto" : EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultDecoding) }, { "EditorFontFamily", EditorSettingsService.EditorFontFamily }, { "EditorFontSize", EditorSettingsService.EditorFontSize.ToString() }, { "IsSessionSnapshotEnabled", EditorSettingsService.IsSessionSnapshotEnabled.ToString() }, { "IsShadowWindow", (!IsFirstInstance && !IsGameBarWidget).ToString() }, { "IsGameBarWidget", IsGameBarWidget.ToString() }, { "AlwaysOpenNewWindow", EditorSettingsService.AlwaysOpenNewWindow.ToString() }, { "IsHighlightMisspelledWordsEnabled", EditorSettingsService.IsHighlightMisspelledWordsEnabled.ToString() }, { "IsLineHighlighterEnabled", EditorSettingsService.IsLineHighlighterEnabled.ToString() }, { "EditorDefaultSearchEngine", EditorSettingsService.EditorDefaultSearchEngine.ToString() } }; LoggingService.LogInfo($"AppLaunchSettings: {string.Join(";", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}"); Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings); try { await ActivationService.ActivateAsync(rootFrame, e); } catch (Exception ex) { throw new Exception("AppFailedToActivate", ex); } if (rootFrameCreated) { Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); } }
private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e) { if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(e); Window.Current.Content = rootFrame; } ThemeSettingsService.Initialize(); EditorSettingsService.Initialize(); Analytics.TrackEvent("AppLaunch_Settings", new Dictionary <string, string>() { { "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString() }, { "ThemeMode", ThemeSettingsService.ThemeMode.ToString() }, { "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString() }, { "AppBackgroundTintOpacity", $"{(int)(ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}" }, { "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString() }, { "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString() }, { "EditorDefaultEncoding", EncodingUtility.GetEncodingBodyName(EditorSettingsService.EditorDefaultEncoding) }, { "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString() }, { "EditorDefaultDecoding", EncodingUtility.GetEncodingBodyName(EditorSettingsService.EditorDefaultDecoding) }, { "EditorFontFamily", EditorSettingsService.EditorFontFamily }, { "EditorFontSize", EditorSettingsService.EditorFontSize.ToString() }, }); await ActivationService.ActivateAsync(rootFrame, e); //await LoggingService.InitializeAsync(); Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); }
public SettingsPage() { InitializeComponent(); Loaded += SettingsPage_Loaded; Unloaded += SettingsPage_Unloaded; if (App.IsGameBarWidget) { ThemeSettingsService.SetRequestedTheme(null, Window.Current.Content, null); } }
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(); }
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); } }
private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e) { if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(e); Window.Current.Content = rootFrame; } ThemeSettingsService.Initialize(); EditorSettingsService.Initialize(); await ActivationService.ActivateAsync(rootFrame, e); Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); }
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; }
private void ThemeRadioButton_OnChecked(object sender, RoutedEventArgs e) { if (sender is RadioButton radioButton) { switch (radioButton.Tag) { case "Light": ThemeSettingsService.UseWindowsTheme = false; ThemeSettingsService.SetTheme(ElementTheme.Light); break; case "Dark": ThemeSettingsService.UseWindowsTheme = false; ThemeSettingsService.SetTheme(ElementTheme.Dark); break; case "Default": ThemeSettingsService.UseWindowsTheme = true; break; } } }
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); } }
private async Task ActivateAsync(IActivatedEventArgs e) { bool rootFrameCreated = false; if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = CreateRootFrame(e); Window.Current.Content = rootFrame; rootFrameCreated = true; ThemeSettingsService.Initialize(); AppSettingsService.Initialize(); } var appLaunchSettings = new Dictionary <string, string>() { { "OSArchitecture", SystemInformation.OperatingSystemArchitecture.ToString() }, { "OSVersion", $"{SystemInformation.OperatingSystemVersion.Major}.{SystemInformation.OperatingSystemVersion.Minor}.{SystemInformation.OperatingSystemVersion.Build}" }, { "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString() }, { "ThemeMode", ThemeSettingsService.ThemeMode.ToString() }, { "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString() }, { "AppBackgroundTintOpacity", $"{(int) (ThemeSettingsService.AppBackgroundPanelTintOpacity * 10.0) * 10}" }, { "ShowStatusBar", AppSettingsService.ShowStatusBar.ToString() }, { "IsSessionSnapshotEnabled", AppSettingsService.IsSessionSnapshotEnabled.ToString() }, { "IsShadowWindow", (!IsPrimaryInstance && !IsGameBarWidget).ToString() }, { "IsGameBarWidget", IsGameBarWidget.ToString() }, { "AlwaysOpenNewWindow", AppSettingsService.AlwaysOpenNewWindow.ToString() }, { "IsHighlightMisspelledWordsEnabled", AppSettingsService.IsHighlightMisspelledWordsEnabled.ToString() }, { "IsSmartCopyEnabled", AppSettingsService.IsSmartCopyEnabled.ToString() } }; LoggingService.LogInfo($"[{nameof(App)}] Launch settings: \n{string.Join("\n", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}."); Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings); var appLaunchEditorSettings = new Dictionary <string, string>() { { "EditorDefaultLineEnding", AppSettingsService.EditorDefaultLineEnding.ToString() }, { "EditorDefaultEncoding", EncodingUtility.GetEncodingName(AppSettingsService.EditorDefaultEncoding) }, { "EditorDefaultTabIndents", AppSettingsService.EditorDefaultTabIndents.ToString() }, { "EditorDefaultDecoding", AppSettingsService.EditorDefaultDecoding == null ? "Auto" : EncodingUtility.GetEncodingName(AppSettingsService.EditorDefaultDecoding) }, { "EditorFontFamily", AppSettingsService.EditorFontFamily }, { "EditorFontSize", AppSettingsService.EditorFontSize.ToString() }, { "EditorFontStyle", AppSettingsService.EditorFontStyle.ToString() }, { "EditorFontWeight", AppSettingsService.EditorFontWeight.Weight.ToString() }, { "EditorDefaultSearchEngine", AppSettingsService.EditorDefaultSearchEngine.ToString() }, { "DisplayLineHighlighter", AppSettingsService.EditorDisplayLineHighlighter.ToString() }, { "DisplayLineNumbers", AppSettingsService.EditorDisplayLineNumbers.ToString() }, }; LoggingService.LogInfo($"[{nameof(App)}] Editor settings: \n{string.Join("\n", appLaunchEditorSettings.Select(x => x.Key + "=" + x.Value).ToArray())}."); Analytics.TrackEvent("AppLaunch_Editor_Settings", appLaunchEditorSettings); try { await ActivationService.ActivateAsync(rootFrame, e); } catch (Exception ex) { var diagnosticInfo = new Dictionary <string, string>() { { "Message", ex?.Message }, { "Exception", ex?.ToString() }, }; Analytics.TrackEvent("AppFailedToActivate", diagnosticInfo); Crashes.TrackError(ex, diagnosticInfo); throw; } if (rootFrameCreated) { ExtendViewIntoTitleBar(); Window.Current.Activate(); } }