Beispiel #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);
                }
            }));
        }
Beispiel #2
0
        protected override void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            ResourceLoader resources = ResourceLoader.GetForCurrentView();

            string          aboutCommandTitle = resources.GetString("AboutTitle");
            SettingsCommand aboutCommand      = new SettingsCommand(aboutCommandTitle, aboutCommandTitle,
                                                                    async(handler) =>
            {
                try
                {
                    Core.IDictionaryService dictionaryService = Mvx.Resolve <Core.IDictionaryService>();

                    string aboutText      = await Utils.ReadResourceFile("ms-appx:///Resources/ContainerAbout.html");
                    string packageVersion = Utils.GetPackageVersion();
                    string engineVersion  = dictionaryService.GetEngineViersion().ToString();

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

                    AdditionalArticleViewModel viewModel = new AdditionalArticleViewModel();
                    viewModel.Header = aboutCommandTitle;
                    viewModel.Source = aboutText;

                    AdditionalArticleFlyout flyout = new AdditionalArticleFlyout();
                    flyout.SetViewModel(viewModel);
                    flyout.Show();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            });

            args.Request.ApplicationCommands.Add(aboutCommand);

            string          enterCodeCommandTitle = resources.GetString("EnterCodeTitle");
            SettingsCommand enterCodeCommand      = new SettingsCommand(enterCodeCommandTitle, enterCodeCommandTitle,
                                                                        (handler) =>
            {
                Utils.ShowEnterCodeFlyout();
            });

            args.Request.ApplicationCommands.Add(enterCodeCommand);
        }