コード例 #1
0
        public DeveloperSettingsPage()
        {
            this.InitializeComponent();

            var container = ServiceLocator.Container;

            _cultureChangedEvent    = container.GetInstance <IObservable <CultureChangedEventArgs> >();
            _cultureChangedObserver = container.GetInstance <ICommandHandler <CultureChangedEventArgs> >();
            _themeChangedObserver   = container.GetInstance <ICommandHandler <ThemeChangedEventArgs> >();
            _translationManager     = container.GetInstance <TranslationManager>();

            _translations = new DevSettingsPageStrings(_translationManager);

            UpdateUiTest();

            _cultureChangedEvent.Subscribe(_ => { UpdateUiTest(); });

            GermanBtn.Events().Click
            .Subscribe(_ =>
            {
                var germanCulture            = new CultureInfo("de-DE");
                CultureInfo.CurrentCulture   = germanCulture;
                CultureInfo.CurrentUICulture = germanCulture;

                _cultureChangedObserver.Handle(new CultureChangedEventArgs(germanCulture));
            });

            English.Events().Click
            .Subscribe(_ =>
            {
                var englishCulture           = new CultureInfo("en-EN");
                CultureInfo.CurrentCulture   = englishCulture;
                CultureInfo.CurrentUICulture = englishCulture;

                _cultureChangedObserver.Handle(new CultureChangedEventArgs(englishCulture));
            });

            LightThemeBtn.Events().Click
            .Subscribe(_ => { _themeChangedObserver.Handle(new ThemeChangedEventArgs(AppTheme.DefaultLightModeTheme)); });

            DarkThemeBtn.Events().Click
            .Subscribe(_ => { _themeChangedObserver.Handle(new ThemeChangedEventArgs(AppTheme.DefaultDarkModeTheme)); });
        }