public SettingsViewModel() { if (Helper.IsInDesignMode) { return; } this.FlashQualityList = this.FlashQualities.ToList(); this.FlashWindowList = this.FlashWindows.ToList(); this.BrowserVerticalPositionList = this.BrowserVerticalPositions.ToList(); this.BrowserHorizontalPositionList = this.BrowserHorizontalPositions.ToList(); this.Libraries = App.ProductInfo.Libraries.Aggregate( new List <BindableTextViewModel>(), (list, lib) => { list.Add(new BindableTextViewModel { Text = list.Count == 0 ? "Build with " : ", " }); list.Add(new HyperlinkViewModel { Text = lib.Name.Replace(' ', Convert.ToChar(160)), Uri = lib.Url }); // プロダクト名の途中で改行されないように、space を non-break space に置き換えてあげてるんだからねっっ return(list); }); this.Cultures = new[] { new CultureViewModel { DisplayName = "(auto)" } } .Concat(ResourceService.Current.SupportedCultures .Select(x => new CultureViewModel { DisplayName = x.EnglishName, Name = x.Name }) .OrderBy(x => x.DisplayName)) .ToList(); this.CompositeDisposable.Add(new PropertyChangedEventListener(Settings.Current) { (sender, args) => this.RaisePropertyChanged(args.PropertyName), }); this._IsDarkTheme = ThemeService.Current.Theme == Theme.Dark; this._IsLightTheme = ThemeService.Current.Theme == Theme.Light; var zoomFactor = new BrowserZoomFactor { Current = Settings.Current.BrowserZoomFactor }; this.CompositeDisposable.Add(new PropertyChangedEventListener(zoomFactor) { { "Current", (sender, args) => Settings.Current.BrowserZoomFactor = zoomFactor.Current }, }); this.BrowserZoomFactor = zoomFactor; var orientationMode = new WindowOrientaionMode { CurrentMode = Settings.Current.OrientationMode }; orientationMode.Refresh(); this.CompositeDisposable.Add(orientationMode); this.CompositeDisposable.Add(new PropertyChangedEventListener(orientationMode) { { "CurrentMode", (sender, args) => Settings.Current.OrientationMode = orientationMode.CurrentMode }, }); Settings.Current.Orientation = orientationMode; this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Translations) { (sender, args) => this.RaisePropertyChanged(args.PropertyName), }); if (Settings.Current.EnableUpdateNotification) { this.CheckForUpdates(); } this.ViewRangeSettingsCollection = ViewRangeCalcLogic.Logics.ToList(); this.SelectedViewRangeCalcType = this.ViewRangeSettingsCollection .FirstOrDefault(x => x.Id == Settings.Current.KanColleClientSettings.ViewRangeCalcType) ?? this.ViewRangeSettingsCollection.First(); this.ReloadPlugins(); }
public SettingsViewModel() { if (Helper.IsInDesignMode) { return; } this.VersionList = VersionTable.Keys.ToList(); if (Settings.Current.FeatureBrowserEmulation < 8000) { Settings.Current.FeatureBrowserEmulation = 8000; } this.SelectedVersion = CheckVer(Settings.Current.FeatureBrowserEmulation); this.Libraries = App.ProductInfo.Libraries.Aggregate( new List <BindableTextViewModel>(), (list, lib) => { list.Add(new BindableTextViewModel { Text = list.Count == 0 ? "Build with " : ", " }); list.Add(new HyperlinkViewModel { Text = lib.Name.Replace(' ', Convert.ToChar(160)), Uri = lib.Url }); // プロダクト名の途中で改行されないように、space を non-break space に置き換えてあげてるんだからねっっ return(list); }); this.Cultures = new[] { new CultureViewModel { DisplayName = "(auto)" } } .Concat(ResourceService.Current.SupportedCultures .Select(x => new CultureViewModel { DisplayName = x.EnglishName, Name = x.Name }) .OrderBy(x => x.DisplayName)) .ToList(); this.CompositeDisposable.Add(new PropertyChangedEventListener(Settings.Current) { (sender, args) => this.RaisePropertyChanged(args.PropertyName), }); this._IsDarkTheme = ThemeService.Current.Theme == Theme.Dark; this._IsLightTheme = ThemeService.Current.Theme == Theme.Light; var zoomFactor = new BrowserZoomFactor { Current = Settings.Current.BrowserZoomFactor }; this.CompositeDisposable.Add(new PropertyChangedEventListener(zoomFactor) { { "Current", (sender, args) => Settings.Current.BrowserZoomFactor = zoomFactor.Current }, }); this.BrowserZoomFactor = zoomFactor; this.ViewRangeSettingsCollection = ViewRangeCalcLogic.Logics .Select(x => new ViewRangeSettingsViewModel(x)) .ToList(); var orientationMode = new WindowOrientaionMode { CurrentMode = Settings.Current.OrientationMode }; this.CompositeDisposable.Add(orientationMode); this.CompositeDisposable.Add(new PropertyChangedEventListener(orientationMode) { { "Current", (sender, args) => Settings.Current.Orientation = orientationMode.Current }, { "CurrentMode", (sender, args) => Settings.Current.OrientationMode = orientationMode.CurrentMode }, }); Settings.Current.Orientation = orientationMode.Current; this.Orientation = orientationMode; this.ReloadPlugins(); }