private async Task InitializeAsync()
        {
            // checks what theme was selected previous time
            await ThemeSelectorService.InitializeAsync();

            await Task.CompletedTask;
        }
Exemplo n.º 2
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            try
            {
                await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

                // We are remapping the default ViewNamePage and ViewNamePageViewModel naming to ViewNamePage and ViewNameViewModel to
                // gain better code reuse with other frameworks and pages within Windows Template Studio
                ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
                {
                    var viewModelTypeName = string.Format(CultureInfo.InvariantCulture, "RoomInfo.ViewModels.{0}ViewModel, RoomInfo", viewType.Name.Substring(0, viewType.Name.Length - 4));
                    return(Type.GetType(viewModelTypeName));
                });
            }
            catch (Exception e)
            {
                if (_databaseService != null)
                {
                    await _databaseService.AddExceptionLogItem(new ExceptionLogItem()
                    {
                        TimeStamp = DateTime.Now, Message = e.Message, Source = e.Source, StackTrace = e.StackTrace
                    });
                }
            }
            await base.OnInitializeAsync(args);
        }
        private async Task InitializeAsync()
        {
//{[{
            await ThemeSelectorService.InitializeAsync();

//}]}
        }
Exemplo n.º 4
0
        private async Task InitializeAsync()
        {
//^^
//{[{
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

//}]}
        }
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            await base.OnInitializeAsync(args);

//{[{
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

//}]}
        }
Exemplo n.º 6
0
        private async Task InitializeAsync()
        {
            await ThemeSelectorService.InitializeAsync();

            await RateAndFeedbackService.CheckShowRateReminder();

            await CortanaVCDInstallingService.InstallAsync();

            await Task.CompletedTask;
        }
Exemplo n.º 7
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
            {
                string viewModelTypeName = String.Format(CultureInfo.InvariantCulture, "LedMatrixIde.ViewModels.{0}ViewModel, LedMatrixIde", viewType.Name.Substring(0, viewType.Name.Length - 4));
                return(Type.GetType(viewModelTypeName));
            });

            await base.OnInitializeAsync(args);
        }
Exemplo n.º 8
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            // We are remapping the default ViewNamePage and ViewNamePageViewModel naming to ViewNamePage and ViewNameViewModel to
            // gain better code reuse with other frameworks and pages within Windows Template Studio
            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
            {
                var viewModelTypeName = string.Format(CultureInfo.InvariantCulture, "PDFSample.UWP.ViewModels.{0}ViewModel, PDFSample.UWP", viewType.Name.Substring(0, viewType.Name.Length - 4));
                return(Type.GetType(viewModelTypeName));
            });
            await base.OnInitializeAsync(args);
        }
Exemplo n.º 9
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            await Container.Resolve <ILiveTileService>().EnableQueueAsync().ConfigureAwait(false);

            Container.Resolve <IBackgroundTaskService>().RegisterBackgroundTasks();
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            // We are remapping the default ViewNamePage and ViewNamePageViewModel naming to ViewNamePage and ViewNameViewModel to
            // gain better code reuse with other frameworks and pages within Windows Template Studio
            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
            {
                var viewModelTypeName = string.Format(CultureInfo.InvariantCulture, "WTSGeneratedNavigation.ViewModels.{0}ViewModel, WTSGeneratedNavigation", viewType.Name.Substring(0, viewType.Name.Length - 4));
                return(Type.GetType(viewModelTypeName));
            });
            await base.OnInitializeAsync(args);
        }
Exemplo n.º 10
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)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter

                    //if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl"))
                    if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5, 0))
                    {
                        rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    }
                    else
                    {
                        rootFrame.Navigate(typeof(ConditionalXamlPage), e.Arguments);
                    }
                    // Ensure the current window is active
                    Window.Current.Activate();

                    await ThemeSelectorService.InitializeAsync();
                }
            }
        }
Exemplo n.º 11
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            var identityService = Container.Resolve <IIdentityService>();

            identityService.InitializeWithAadAndPersonalMsAccounts();
            await identityService.AcquireTokenSilentAsync();

            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            // We are remapping the default ViewNamePage and ViewNamePageViewModel naming to ViewNamePage and ViewNameViewModel to
            // gain better code reuse with other frameworks and pages within Windows Template Studio
            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
            {
                var viewModelTypeName = string.Format(CultureInfo.InvariantCulture, "PrismForcedLoginApp.ViewModels.{0}ViewModel, PrismForcedLoginApp", viewType.Name.Substring(0, viewType.Name.Length - 4));
                return(Type.GetType(viewModelTypeName));
            });
            await base.OnInitializeAsync(args);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (Window.Current.Content is null)
            {
                Window.Current.Content = new Shell();
            }

            if (e.PrelaunchActivated == false)
            {
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
                ExtendAcrylicIntoTitleBar();
            }

            LogService.ConfigLogger();
            DataLoadService.LoadFromDataAsync();
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            await ThemeSelectorService.SetRequestedThemeAsync();
        }
Exemplo n.º 13
0
        protected override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            await base.OnInitializeAsync(args);

            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            Clipboard.SetContent(new DataPackage());

            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;

            ApplicationView.PreferredLaunchViewSize      = new Size((int)bounds.Width, (int)bounds.Height);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            UnhandledException += (sender, e) =>
            {
            };
            // We are remapping the default ViewNamePage and ViewNamePageViewModel naming to ViewNamePage and ViewNameViewModel to
            // gain better code reuse with other frameworks and pages within Windows Template Studio
            ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
            {
                var viewModelTypeName = string.Format(CultureInfo.InvariantCulture, "Marimo.MappingGames.Uwp.ViewModels.{0}ViewModel, Marimo.MappingGames.Uwp", viewType.Name.Substring(0, viewType.Name.Length - 4));
                return(Type.GetType(viewModelTypeName));
            });
        }
Exemplo n.º 14
0
        private async Task InitializeAsync()
        {
            await ThemeSelectorService.InitializeAsync();

            await Task.CompletedTask;
        }
Exemplo n.º 15
0
 protected override async Task OnInitializeAsync(IActivatedEventArgs args)
 {
     await ThemeSelectorService.InitializeAsync();
 }
Exemplo n.º 16
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                    coreTitleBar.ExtendViewIntoTitleBar = true;
                    await DataService.CreateTheDatabaseAsync();
                    await DataService.RemoveFuturePeriodsAsync();
                    await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);
                    await ThemeSelectorService.SetRequestedThemeAsync();

                    await SettingsService.InitializeAsync();
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    HandleClosed();
                    try
                    {
                        await NotificationManager.Current.RemoveBreakFinishedToastNotificationScheduleAsync();
                        await NotificationManager.Current.RemovePomodoroFinishedToastNotificationScheduleAsync();
                    }
                    catch (Exception ex)
                    {
                        Microsoft.AppCenter.Crashes.Crashes.TrackError(ex);
                    }

                    var properties = new Dictionary<string, string>
                    {
                        { "Region", Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion},
                    };
                    Analytics.TrackEvent("Launched", properties);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();


                await Services.GetService<IFirstRunDisplayService>().ShowIfAppropriateAsync();
            }
        }
Exemplo n.º 17
0
        private async void SetTheme()
        {
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(true);

            await ThemeSelectorService.SetRequestedThemeAsync().ConfigureAwait(false);
        }