Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
            }
        }