예제 #1
0
        /// <summary>
        /// 在将要挂起应用程序执行时调用。  在不知道应用程序
        /// 无需知道应用程序会被终止还是会恢复,
        /// 并让内存内容保持不变。
        /// </summary>
        /// <param name="sender">挂起的请求的源。</param>
        /// <param name="e">有关挂起请求的详细信息。</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var def = e.SuspendingOperation.GetDeferral();

            try
            {
                await JumplistManager.RefreshJumplistAsync();
            }
            finally
            {
                def.Complete();
            }
        }
예제 #2
0
        private void lanunchCore(IActivatedEventArgs e, bool prelaunchActivated)
        {
#if !DEBUG
            if (!AppCenter.Configured)
            {
                var region = new Windows.Globalization.GeographicRegion();
                AppCenter.SetCountryCode(region.CodeTwoLetter);
                AppCenter.Start(Telemetry.AppCenterKey, typeof(Analytics), typeof(Crashes));
            }
#endif
            var notificator = Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView();
            if (notificator.Handlers.Count == 0)
            {
                notificator.Handlers.Add(new Services.ContentDialogNotification());
                notificator.Handlers.Add(new Services.InAppToastNotification());
            }
            var jumplist       = JumplistManager.RefreshJumplistAsync();
            var currentWindow  = Window.Current;
            var currentContent = currentWindow.Content;
            if (currentContent is null)
            {
                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(320, 500));
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                currentContent        = new SplashControl(e.SplashScreen);
                currentWindow.Content = currentContent;
            }
            if (currentContent is SplashControl sc)
            {
                if (!prelaunchActivated)
                {
                    sc.EnableGoToContent();
                }
            }
            else
            {
                currentWindow.Activate();
            }
            ((Opportunity.UWP.Converters.Typed.StringToBooleanConverter)Resources["EmptyStringToFalseConverter"]).ValuesForFalse.Add("");
        }