コード例 #1
0
 public AddonConfigNodeViewModel(IDemoConfigTranslations configTranslations)
 {
     // automatically update the DisplayName
     configTranslations.CreateDisplayNameBinding(this, nameof(IDemoConfigTranslations.Addons));
     CanActivate = false;
     Id          = nameof(ConfigIds.Addons);
 }
コード例 #2
0
        public UiConfigNodeViewModel(IDemoConfigTranslations configTranslations)
        {
            ConfigTranslations = configTranslations;

            // automatically update the DisplayName
            ConfigTranslations.CreateDisplayNameBinding(this, nameof(IDemoConfigTranslations.Ui));

            // automatically update the DisplayName
            CanActivate = false;
            Id          = nameof(ConfigIds.Ui);
        }
コード例 #3
0
        public ConfigViewModel(
            LanguageContainer languageContainer,
            IEnumerable <Lazy <IConfigScreen> > configScreens,
            IDemoConfigTranslations configTranslations,
            ICoreTranslations coreTranslations,
            IDemoConfiguration demoConfiguration)
        {
            ConfigScreens      = configScreens;
            ConfigTranslations = configTranslations;
            CoreTranslations   = coreTranslations;

            // automatically update the DisplayName
            CoreTranslations.CreateDisplayNameBinding(this, nameof(ICoreTranslations.Settings));

            // Set the current language (this should update all registered OnPropertyChanged anyway, so it can run in the background
            var lang = demoConfiguration.Language;

            Task.Run(async() => await languageContainer.ChangeLanguageAsync(lang).ConfigureAwait(false));
        }