Пример #1
0
 protected override async void OnLaunched(LaunchActivatedEventArgs args)
 {
     Container = RegisterServices();
     if (!args.PrelaunchActivated)
     {
         await ActivationService.ActivateAsync(args);
     }
 }
Пример #2
0
 protected override async void OnLaunched(LaunchActivatedEventArgs args)
 {
     if (!args.PrelaunchActivated)
     {
         await ActivationService.ActivateAsync(args);
     }
 }
Пример #3
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();
        }
Пример #4
0
        /// <summary>
        /// Invoked when the application is activated by some means other than normal launching.
        /// </summary>
        /// <param name="args">Event data for the event.</param>
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            Debug.WriteLine("OnActivated()");
            //isActivating = true;
            if (args.Kind == ActivationKind.VoiceCommand)
            {
                // The arguments can represent many different activation types. Cast it so we can get the
                // parameters we care about out.
                var commandArgs = args as VoiceCommandActivatedEventArgs;

                Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

                // Get the name of the voice command and the text spoken. See AdventureWorksCommands.xml for
                // the <Command> tags this can be filled with.
                string voiceCommandName = speechRecognitionResult.RulePath[0];
                string textSpoken       = speechRecognitionResult.Text;

                //Action(textSpoken);

                /*
                 * switch (voiceCommandName)
                 * {
                 *  case "lockDevice":
                 *      Action(textSpoken);
                 *      break;
                 *
                 *  default:
                 *      // If we can't determine what page to launch, go to the default entry point.
                 *
                 *      break;
                 * }
                 */
            }
            else if (args.Kind == ActivationKind.Protocol)
            {
                //var commandArgs = args as ProtocolActivatedEventArgs;
                //Windows.Foundation.WwwFormUrlDecoder decoder = new Windows.Foundation.WwwFormUrlDecoder(commandArgs.Uri.Query);
                //var param = decoder.GetFirstValueByName("LaunchContext");
                //EndDevice test = JsonConvert.DeserializeObject<EndDevice>(param);

                //XBeeAction.PowerOff(Convert.ToUInt64(test.MacAddress), test.EndPointId);

                //var protocolEventArgs = args as ProtocolActivatedEventArgs;

                //switch (protocolEventArgs.Uri.Scheme)
                //{
                //    case "main-launchapplist":
                //        NavigationService.Navigate("IOTOIApp.ViewModels.AppListViewModel", "");
                //        break;
                //}
            }
            else
            {
                await ActivationService.ActivateAsync(args);
            }
        }
Пример #5
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            // initialize our services
            InitializeServices();

            // load our styles
            LoadStyles();

            await ActivationService.ActivateAsync(args);
        }
Пример #6
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            // initialize config, localization, and telemetry services
            InitializeServices();

            // load styles
            LoadAppResourceDictionaries();

            await ActivationService.ActivateAsync(args);
        }
Пример #7
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();
        }
Пример #8
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();
            }
        }
Пример #9
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationLanguages.PrimaryLanguageOverride =
                AppSettings.UsePrimaryLanguageOverride ?
                AppSettings.PrimaryLanguageOverride :
                Windows.System.UserProfile.GlobalizationPreferences.Languages[0];

            if (!e.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(e);
            }
        }
Пример #10
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            // initialize our services
            InitializeServices();

            // load our styles
            LoadStyles();

            if (!args.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(args);
            }
        }
Пример #11
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (!e.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(e);
            }
            else
            {
                await FontFinder.LoadFontsAsync();

                await Ioc.Default.GetService <UserCollectionsService>().LoadCollectionsAsync();
            }
        }
Пример #12
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            if (!args.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(args);

                InitEnvironment();
                await m_Environment.InitializeUserAsync();

                // periodic timer for delete fingerevents < 14 days ago
                TimeSpan period = TimeSpan.FromHours(12); // alle 12 h schauen
                m_Environment.startDeleteFingerEventsTimer(period);
            }
        }
Пример #13
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();
        }
Пример #14
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Debug.WriteLine("OnLaunched()");
            if (!e.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(e);
            }

            #region VCD Install
            try
            {
                // Install the main VCD. Since there's no simple way to test that the VCD has been imported, or that it's your most recent
                // version, it's not unreasonable to do this upon app load.
                StorageFile vcdStorageFile = await Package.Current.InstalledLocation.GetFileAsync(@"IOTOIAppCommands.xml");

                await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdStorageFile);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Installing Voice Commands Failed: " + ex.ToString());
            }
            #endregion
        }
Пример #15
0
 protected override async void OnActivated(IActivatedEventArgs args)
 {
     await ActivationService.ActivateAsync(args);
 }
Пример #16
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            await ActivationService.ActivateAsync(args);

            NavigationService.Navigate(typeof(LockedPage));
        }
Пример #17
0
 protected override async void OnActivated(IActivatedEventArgs args)
 {
     RegisterExceptionHandlingSynchronizationContext();
     await ActivationService.ActivateAsync(args);
 }
Пример #18
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();
            }
        }
Пример #19
0
 protected override async void OnFileActivated(FileActivatedEventArgs args)
 {
     base.OnFileActivated(args);
     await ActivationService.ActivateAsync(args);
 }
Пример #20
0
 /// <summary>
 ///     Invoked when the application is launched normally by the end user.  Other entry points
 ///     will be used such as when the application is launched to open a specific file.
 /// </summary>
 /// <param name="e">Details about the launch request and process.</param>
 protected override async void OnLaunched(LaunchActivatedEventArgs e)
 {
     await ActivationService.ActivateAsync(e);
 }
Пример #21
0
    //^^
    //{[{

    protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args)
    {
        await ActivationService.ActivateAsync(args);
    }