-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
173 additions
and
157 deletions.
There are no files selected for viewing
96 changes: 48 additions & 48 deletions
96
source/Grabacr07.KanColleViewer/Models/Settings/GeneralSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
using MetroTrilithon.Serialization; | ||
|
||
namespace Grabacr07.KanColleViewer.Models.Settings | ||
{ | ||
public static class GeneralSettings | ||
{ | ||
/// <summary> | ||
/// カルチャ設定を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<string> Culture { get; } | ||
= new SerializableProperty<string>(GetKey(), Providers.Roaming) { AutoSave = true }; | ||
|
||
/// <summary> | ||
/// アプリケーションがプロキシ モード (ブラウザーを表示せず、プロキシとしてのみ使用するモード) で動作するかどうかを示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<bool> IsProxyMode { get; } | ||
= new SerializableProperty<bool>(GetKey(), Providers.Roaming, false); | ||
|
||
/// <summary> | ||
/// アプリケーション終了時の確認動作を示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<ExitConfirmationType> ExitConfirmationType { get; } | ||
= new SerializableProperty<ExitConfirmationType>(GetKey(), Providers.Roaming, Models.ExitConfirmationType.None) { AutoSave = true }; | ||
|
||
/// <summary> | ||
/// ブラウザーの拡大鏡を示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<double> BrowserZoomFactor { get; } | ||
= new SerializableProperty<double>(GetKey(), Providers.Local, 1.0); | ||
|
||
/// <summary> | ||
/// ユーザー スタイル シート設定を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<string> UserStyleSheet { get; } | ||
= new SerializableProperty<string>(GetKey(), Providers.Roaming, Properties.Settings.Default.OverrideStyleSheet) { AutoSave = true }; | ||
|
||
|
||
private static string GetKey([CallerMemberName] string propertyName = "") | ||
{ | ||
return nameof(GeneralSettings) + "." + propertyName; | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
using MetroTrilithon.Serialization; | ||
|
||
namespace Grabacr07.KanColleViewer.Models.Settings | ||
{ | ||
public static class GeneralSettings | ||
{ | ||
/// <summary> | ||
/// カルチャ設定を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<string> Culture { get; } | ||
= new SerializableProperty<string>(GetKey(), Providers.Roaming) { AutoSave = true }; | ||
|
||
/// <summary> | ||
/// アプリケーションがプロキシ モード (ブラウザーを表示せず、プロキシとしてのみ使用するモード) で動作するかどうかを示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<bool> IsProxyMode { get; } | ||
= new SerializableProperty<bool>(GetKey(), Providers.Roaming, false); | ||
|
||
/// <summary> | ||
/// アプリケーション終了時の確認動作を示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<ExitConfirmationType> ExitConfirmationType { get; } | ||
= new SerializableProperty<ExitConfirmationType>(GetKey(), Providers.Roaming, Models.ExitConfirmationType.None) { AutoSave = true }; | ||
|
||
/// <summary> | ||
/// ブラウザーの拡大鏡を示す設定値を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<double> BrowserZoomFactor { get; } | ||
= new SerializableProperty<double>(GetKey(), Providers.Local, 1.0); | ||
|
||
/// <summary> | ||
/// ユーザー スタイル シート設定を取得します。 | ||
/// </summary> | ||
public static SerializableProperty<string> UserStyleSheet { get; } | ||
= new SerializableProperty<string>(GetKey(), Providers.Roaming, Properties.Settings.Default.OverrideStyleSheet) { AutoSave = true }; | ||
|
||
|
||
private static string GetKey([CallerMemberName] string propertyName = "") | ||
{ | ||
return nameof(GeneralSettings) + "." + propertyName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 83 additions & 68 deletions
151
source/Grabacr07.KanColleViewer/ViewModels/Settings/UserStyleSheetSettingsViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,83 @@ | ||
using Grabacr07.KanColleViewer.Models.Settings; | ||
using Grabacr07.KanColleWrapper; | ||
using Livet; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using MetroTrilithon.Mvvm; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Settings | ||
{ | ||
public class UserStyleSheetSettingsViewModel : ViewModel | ||
{ | ||
private bool isBackToDefaultValue; | ||
|
||
#region UserStyleSheet 変更通知プロパティ | ||
|
||
private string _UserStyleSheet; | ||
|
||
public string UserStyleSheet | ||
{ | ||
get { return this._UserStyleSheet; } | ||
set | ||
{ | ||
this.isBackToDefaultValue = false; | ||
if (this._UserStyleSheet != value) | ||
{ | ||
this._UserStyleSheet = value; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
|
||
public void Initialize() | ||
{ | ||
GeneralSettings.UserStyleSheet.Subscribe(x => this.UserStyleSheet = x).AddTo(this); | ||
|
||
if (!GeneralSettings.UserStyleSheet.Provider.IsLoaded) | ||
GeneralSettings.UserStyleSheet.Provider.Load(); | ||
this.isBackToDefaultValue = !GeneralSettings.UserStyleSheet.Provider.TryGetValue(GeneralSettings.UserStyleSheet.Key, out this._UserStyleSheet); | ||
this._UserStyleSheet = GeneralSettings.UserStyleSheet; | ||
this.RaisePropertyChanged(nameof(this.UserStyleSheet)); | ||
} | ||
|
||
public void Apply() | ||
{ | ||
if (this.isBackToDefaultValue) | ||
GeneralSettings.UserStyleSheet.Reset(); | ||
else | ||
GeneralSettings.UserStyleSheet.Value = this.UserStyleSheet; | ||
} | ||
|
||
public void Cancel() | ||
{ | ||
this.UserStyleSheet = GeneralSettings.UserStyleSheet; | ||
} | ||
|
||
public void BackToDefaultValue() | ||
{ | ||
this.UserStyleSheet = GeneralSettings.UserStyleSheet.Default; | ||
this.isBackToDefaultValue = true; | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Grabacr07.KanColleViewer.Models.Settings; | ||
using Livet; | ||
using MetroTrilithon.Mvvm; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Settings | ||
{ | ||
public class UserStyleSheetSettingsViewModel : ViewModel | ||
{ | ||
#region UserStyleSheet 変更通知プロパティ | ||
|
||
private string _UserStyleSheet; | ||
|
||
public string UserStyleSheet | ||
{ | ||
get { return this._UserStyleSheet; } | ||
set | ||
{ | ||
if (this._UserStyleSheet != value) | ||
{ | ||
this._UserStyleSheet = value; | ||
this.IsEditing = true; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
#region IsEditing 変更通知プロパティ | ||
|
||
private bool _IsEditing; | ||
|
||
public bool IsEditing | ||
{ | ||
get { return this._IsEditing; } | ||
set | ||
{ | ||
if (this._IsEditing != value) | ||
{ | ||
this._IsEditing = value; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
|
||
public void Initialize() | ||
{ | ||
GeneralSettings.UserStyleSheet | ||
.Subscribe(x => | ||
{ | ||
this.UserStyleSheet = x; | ||
this.IsEditing = false; | ||
}) | ||
.AddTo(this); | ||
|
||
this._UserStyleSheet = GeneralSettings.UserStyleSheet; | ||
this.RaisePropertyChanged(nameof(this.UserStyleSheet)); | ||
} | ||
|
||
public void Apply() | ||
{ | ||
GeneralSettings.UserStyleSheet.Value = this.UserStyleSheet; | ||
} | ||
|
||
public void Cancel() | ||
{ | ||
this.UserStyleSheet = GeneralSettings.UserStyleSheet; | ||
this.IsEditing = false; | ||
} | ||
|
||
public void BackToDefaultValue() | ||
{ | ||
this.UserStyleSheet = GeneralSettings.UserStyleSheet.Default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters