示例#1
0
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            CoreWindowLogic.Stringify();
            deferral.Complete();
        }
示例#2
0
 private void HamburgerMenu_SplitViewMenuLoaded(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(_arguments))
     {
         CoreWindowLogic.LoadAppWithArguments(_arguments);
     }
 }
示例#3
0
        private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            CoreWindowLogic.EnableDisableSmtc();
            CoreWindowLogic.isBackground = false;
            deferral.Complete();
        }
示例#4
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            CoreWindowLogic.Stringify();
            CoreWindowLogic.DisposeObjects();
            deferral.Complete();
        }
示例#5
0
        private async void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            try
            {
                // BLogger.Logger.Info("Loading frame started...");
                Frame rootFrame = Window.Current.Content as Frame;

                // Do not repeat app initialization when the Window already has content
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context
                    rootFrame = new Frame();
                    // BLogger.Logger.Info("New frame created.");
                    //if (args.PreviousExecutionState == ApplicationExecutionState.Suspended)
                    //{
                    //    //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                    //    //TODO: Load state from previously suspended application
                    //}

                    rootFrame.NavigationFailed += OnNavigationFailed;
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;

                    BLogger.Logger.Info("Content set to Window successfully...");
                }
                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
                    BLogger.Logger.Info("Navigating to Shell...");
                    rootFrame.Navigate(typeof(Shell), arguments);
                }

                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(360, 100));
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    BLogger.Logger.Info("Trying to hide status bar.");
                    await StatusBar.GetForCurrentView().HideAsync();

                    BLogger.Logger.Info("Status bar hidden.");
                }
                if (args.Kind != ActivationKind.File)
                {
                    CoreWindowLogic.LoadSettings();
                }
                else
                {
                    CoreWindowLogic.LoadSettings(true);
                }
                Window.Current.Activate();
            }
            catch (Exception ex)
            {
                BLogger.Logger?.Info("Exception occured in LoadFrame Method", ex);
            }
        }
示例#6
0
        private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            BLogger.Logger.Info("App has entered background...");
            CoreWindowLogic.SaveSettings();
            CoreWindowLogic.UpdateSmtc();
            deferral.Complete();
        }
示例#7
0
        public Shell()
        {
            this.InitializeComponent();
            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            CoreWindowLogic logic = new CoreWindowLogic();

            ShellVM = DataContext as ShellViewModel;
        }
示例#8
0
        void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            var   stop      = Stopwatch.StartNew();
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                    //TODO: Load state from previously suspended application
                }
                rootFrame.NavigationFailed += OnNavigationFailed;
                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }
            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
                rootFrame.Navigate(typeof(Shell), arguments);
            }

            // CoreWindowLogic logic = new CoreWindowLogic();
            var view = ApplicationView.GetForCurrentView();

            view.SetPreferredMinSize(new Size(360, 100));
            if (RequestedTheme == ApplicationTheme.Dark)
            {
                view.TitleBar.BackgroundColor       = Color.FromArgb(20, 20, 20, 1);
                view.TitleBar.ButtonBackgroundColor = Color.FromArgb(20, 20, 20, 1);
            }
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                //view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                var statusBar = StatusBar.GetForCurrentView();
                statusBar.BackgroundColor   = RequestedTheme == ApplicationTheme.Light ? (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color : Color.FromArgb(20, 20, 20, 1);
                statusBar.BackgroundOpacity = 1;
                statusBar.ForegroundColor   = Colors.White;
            }
            if (args.Kind != ActivationKind.File)
            {
                CoreWindowLogic.LoadSettings();
            }
            else
            {
                CoreWindowLogic.LoadSettings(true);
            }
            Window.Current.Activate();
            stop.Stop();
            Debug.Write(stop.ElapsedMilliseconds.ToString() + "\r\n");
        }
示例#9
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            CoreWindowLogic.SaveSettings();
            await Task.Delay(500);

            deferral.Complete();
        }
示例#10
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            //ReduceMemoryUsage();
            CoreWindowLogic.Stringify();
            await Task.Delay(500);

            deferral.Complete();
        }
示例#11
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            SessionWatch.Stop();
            BLogger.Logger.Info("App suspended and session terminated. Session length: " + SessionWatch.Elapsed.TotalMinutes);
            CoreWindowLogic.SaveSettings();
            await Task.Delay(500);

            deferral.Complete();
        }
示例#12
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            CoreWindowLogic.SaveSettings();
            CoreWindowLogic.UpdateSmtc(true);
            CoreWindowLogic.EnableDisableSmtc();
            await Task.Delay(200);

            CoreWindowLogic.isBackground = true;
            deferral.Complete();
        }
示例#13
0
 public Shell()
 {
     this.InitializeComponent();
     CoreWindowLogic.InitSmtc();
     ShellVM = DataContext as ShellViewModel;
     Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
     Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
     {
         var ignored = false;
         hamburgerMenu.BackRequested(ref ignored);
         a.Handled = true;
     };
 }
示例#14
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            await LockscreenHelper.ResetLockscreenImage();

            _sessionWatch?.Stop();
            BLogger.I("App suspended and session terminated. Session length: " + _sessionWatch.Elapsed.TotalMinutes);
            CoreWindowLogic.SaveSettings();
            //CoreWindowLogic.DisposeObjects();
            await Task.Delay(500);

            deferral.Complete();
        }
示例#15
0
        public Shell()
        {
            this.InitializeComponent();
            CoreWindowLogic win = new CoreWindowLogic();

            this.DataContext = ShellVM;
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
            {
                var ignored = false;
                hamburgerMenu.BackRequested(ref ignored);
            };
        }
示例#16
0
        private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            if (!firsttime)
            {
                CoreWindowLogic.EnableDisableSmtc();
            }
            else
            {
                firsttime = false;
            }
            CoreWindowLogic.isBackground = false;
            BLogger.Logger.Info("App left background and is now in foreground...");
            deferral.Complete();
        }
示例#17
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 void OnLaunched(LaunchActivatedEventArgs e)
        {
            _sessionWatch = Stopwatch.StartNew();
            BLogger.I("App launched and session started...");
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            if (e.PreviousExecutionState != ApplicationExecutionState.Running)
            {
                LoadFrame(e, e.Arguments);
            }
            else if (e.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                CoreWindowLogic.LoadAppWithArguments(e.Arguments);
            }
        }
示例#18
0
        private async void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
        {
            var deferral = e.GetDeferral();

            CoreWindowLogic.SaveSettings();
            CoreWindowLogic.UpdateSmtc(true);
            if (!firsttime)
            {
                CoreWindowLogic.EnableDisableSmtc();
            }
            else
            {
                firsttime = false;
            }
            await Task.Delay(200);

            CoreWindowLogic.isBackground = true;
            BLogger.Logger.Info("App has entered background...");
            deferral.Complete();
        }
示例#19
0
        void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;
                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }
            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
                rootFrame.Navigate(typeof(Shell), arguments);
            }

            var view = ApplicationView.GetForCurrentView();

            if (RequestedTheme == ApplicationTheme.Dark)
            {
                view.TitleBar.BackgroundColor       = Color.FromArgb(20, 20, 20, 1);
                view.TitleBar.ButtonBackgroundColor = Color.FromArgb(20, 20, 20, 1);
            }

            Window.Current.Activate();

            if (args.Kind != ActivationKind.File)
            {
                CoreWindowLogic.Replay();
            }
            else
            {
                CoreWindowLogic.Replay(true);
            }
        }
示例#20
0
        private async void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            try
            {
                BLogger.I("Loading frame started...");
                //we need to init this in the UI thread regardless of this being the launch code. (Consult issue #207)
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                                                                                            () =>
                {
                    BLogger.I("Initializing switch...");
                    new InitializeSwitch(SharedLogic.Instance.NotificationManager, new SettingsHelper(), new BreadDispatcher(), ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1));
                });

                Frame rootFrame = Window.Current.Content as Frame;
                new InternetConnectivityHelper();
                var vm = Current.Resources["AlbumArtistVM"];
                ThemeManager.SetThemeColor(SettingsHelper.GetLocalSetting <string>("NowPlayingPicture", null));


                // Do not repeat app initialization when the Window already has content
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context
                    rootFrame = new Frame();
                    BLogger.I("New frame created.");
                    //if (args.PreviousExecutionState == ApplicationExecutionState.Suspended)
                    //{
                    //    //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                    //    //TODO: Load state from previously suspended application
                    //}

                    rootFrame.NavigationFailed += OnNavigationFailed;
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;

                    BLogger.I("Content set to Window successfully...");
                }
                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
                    BLogger.I("Navigating to Shell...");
                    rootFrame.Navigate(typeof(Shell), arguments);
                }

                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(360, 100));
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    BLogger.I("Trying to hide status bar.");
                    await StatusBar.GetForCurrentView().HideAsync();

                    BLogger.I("Status bar hidden.");
                }
                else
                {
                    CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                    coreTitleBar.ExtendViewIntoTitleBar = true;
                }
                if (args.Kind != ActivationKind.File)
                {
                    CoreWindowLogic.LoadSettings();
                }
                else
                {
                    CoreWindowLogic.LoadSettings(true);
                }
                Window.Current.Activate();
            }
            catch (Exception ex)
            {
                BLogger.E("Exception occured in LoadFrame Method. Arguments: {arguments}.", ex, arguments);
            }
        }