示例#1
0
        private SettingsCommand CreateAboutCommand(Core.IDictionaryService dictionaryService)
        {
            ResourceLoader resources         = ResourceLoader.GetForCurrentView();
            string         aboutCommandTitle = resources.GetString("AboutTitle");

            return(new SettingsCommand(aboutCommandTitle, aboutCommandTitle,
                                       async(handler) =>
            {
                try
                {
                    Core.IParametersManager parametersManager = Mvx.Resolve <Core.IParametersManager>();
                    Core.DictionaryInfo info = parametersManager.Get <Core.DictionaryInfo>(Core.Parameters.LaunchedProduct);

                    string aboutText = await Utils.ReadResourceFile("ms-appx:///Resources/ProductAbout.html");
                    string packageVersion = Utils.GetPackageVersion();
                    string engineVersion = dictionaryService.GetEngineViersion().ToString();
                    string databaseVersion = dictionaryService.GetDictionaryVersion().ToString();
                    string productName = info.Name;

                    aboutText = aboutText.Replace("${version}", packageVersion);
                    aboutText = aboutText.Replace("${engine_version}", engineVersion);
                    aboutText = aboutText.Replace("${product_name}", productName);
                    aboutText = aboutText.Replace("${database_version}", databaseVersion);

                    ShowFlyout(aboutCommandTitle, aboutText);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }));
        }
示例#2
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame          = new Frame();
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

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

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                Setup setup = new Setup(rootFrame);
                setup.Initialize();

                Core.IParametersManager parametersManager = Mvx.Resolve <Core.IParametersManager>();
                parametersManager.Set(Core.Parameters.LaunchedTileId, e.TileId);

                IMvxAppStart app = Mvx.Resolve <IMvxAppStart>();
                app.Start();
            }

            Window.Current.Activate();
        }