示例#1
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);
            }
        }
示例#2
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");
        }
示例#3
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);
            }
        }