Exemple #1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that
            // the window is active
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

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

            //// Create a Frame to act navigation context and navigate to the first page
            //var rootFrame = new Frame();
            //if (!rootFrame.Navigate(typeof(MainPage)))
            //{
            //    throw new Exception("Failed to create initial page");
            //}

            LoggingService.Init(AppDatabase.Current);
            LoggingService.Start();
            LoggingService.LogInformation("launching app...", "App.OnLaunched");

            AlertService.Init(AppDatabase.Current);
            AlertService.Start();
            LoggingService.LogInformation("initialized alerts...", "App.OnLaunched");

            GestureService.Init();
            LoggingService.LogInformation("initialized gensture manager...", "App.OnLaunched");

            AppDatabase.Current.LoadInstances();
            LoggingService.LogInformation("loaded appstate ...", "App.OnLaunched");

            AppService.Init();
            AppService.Start();
            LoggingService.LogInformation("initialized app services ...", "App.OnLaunched");

            WindowLayoutService.Init();
            LoggingService.LogInformation("initialized window layout services ...", "App.OnLaunched");


            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = new MasterPage(false); //rootFrame;
            Window.Current.Activate();
        }
Exemple #2
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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            //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();

            //    // Set the default language
            //    rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

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

            //    // 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

            //    //if (!rootFrame.Navigate(typeof(SplashScreen), e.Arguments))
            //    if (!rootFrame.Navigate(typeof(ModernCSApp2.MasterPage), e.Arguments))
            //    {
            //        throw new Exception("Failed to create initial page");
            //    }
            //}



            LoggingService.Init(AppDatabase.Current);
            LoggingService.Start();
            LoggingService.LogInformation("launching app...", "App.OnLaunched");

            AlertService.Init(AppDatabase.Current);
            AlertService.Start();
            LoggingService.LogInformation("initialized alerts...", "App.OnLaunched");

            GestureService.Init();
            LoggingService.LogInformation("initialized gensture manager...", "App.OnLaunched");

            AppDatabase.Current.LoadInstances();
            LoggingService.LogInformation("loaded appstate ...", "App.OnLaunched");

            AppService.Init();
            AppService.Start();
            LoggingService.LogInformation("initialized app services ...", "App.OnLaunched");

            WindowLayoutService.Init();
            LoggingService.LogInformation("initialized window layout services ...", "App.OnLaunched");



            var mp = new ModernCSApp.MasterPage(false);
            Window.Current.Content = mp;

            // Ensure the current window is active
            Window.Current.Activate();
        }