Exemple #1
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="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            PageShell shell = Window.Current.Content as PageShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                //init
                try
                {
                    LogUtil_UWP.Init();
                    SpecificUtils.Init(
                        new FileUtil_UWP(),
                        new ImageUtil_UWP(),
                        new HUDPopup_UWP(),
                        new ThreadUtil_UWP(),
                        new SQLiteUtil_UWP(),
                        new LogUtil_UWP()
                        );
                    DictService.Init();
                    NetService.Choose(0);
                }
                catch (Exception e)
                {
                    e.CopeWith("init app");
                }

                // Create a Frame to act as the navigation context and navigate to the first page
                shell = new PageShell();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }
            // Place our app shell in the current Window
            Window.Current.Content = shell;

            // Ensure the current window is active
            Window.Current.Activate();
        }
Exemple #2
0
 public App()
 {
     try
     {
         SpecificUtils.Init(
             DependencyService.Get <FileUtil>(),
             DependencyService.Get <ImageUtil>(),
             DependencyService.Get <HUDPopup>(),
             DependencyService.Get <ThreadUtil>(),
             DependencyService.Get <SQLiteUtil>(),
             DependencyService.Get <LogUtil>()
             );
         DictService.Init();
         NetService.Choose(0);
         MainPage = new MainPage();
     }
     catch (Exception e)
     {
         e.CopeWith("init app");
     }
 }