-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from micahmo/release/v2.0.9
Release/v2.0.9
- Loading branch information
Showing
18 changed files
with
286 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using WgServerforWindows.Controls; | ||
using WgServerforWindows.Properties; | ||
|
||
namespace WgServerforWindows.Models | ||
{ | ||
public class BootTaskDelaySubCommand : PrerequisiteItem | ||
{ | ||
#region PrerequisiteItem members | ||
|
||
public BootTaskDelaySubCommand() : base | ||
( | ||
title: string.Empty, | ||
successMessage: Resources.BootTaskDelaySuccess, | ||
errorMessage: string.Empty, | ||
resolveText: string.Empty, | ||
configureText: Resources.BootTaskDelayConfigure | ||
) | ||
{ | ||
} | ||
|
||
public override BooleanTimeCachedProperty Fulfilled { get; } = new BooleanTimeCachedProperty(TimeSpan.FromSeconds(1), () => true); | ||
|
||
public override void Resolve() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Configure() | ||
{ | ||
DateTime backingObject = new DateTime(1, 1, 1, | ||
GlobalAppSettings.Instance.BootTaskDelay.Hours, | ||
GlobalAppSettings.Instance.BootTaskDelay.Minutes, | ||
GlobalAppSettings.Instance.BootTaskDelay.Seconds); | ||
|
||
var selectionWindowModel = new SelectionWindowModel<DateTime> | ||
{ | ||
Title = Resources.BootDelaySelectionTitle, | ||
Text = Resources.BootDelaySelectionText, | ||
SelectedItem = new SelectionItem<DateTime> { BackingObject = backingObject }, | ||
IsList = false, | ||
IsTimeSpan = true | ||
}; | ||
|
||
new SelectionWindow | ||
{ | ||
DataContext = selectionWindowModel | ||
}.ShowDialog(); | ||
|
||
if (selectionWindowModel.DialogResult == true) | ||
{ | ||
var timeSpan = new TimeSpan( | ||
selectionWindowModel.SelectedItem.BackingObject.Hour, | ||
selectionWindowModel.SelectedItem.BackingObject.Minute, | ||
selectionWindowModel.SelectedItem.BackingObject.Second); | ||
|
||
GlobalAppSettings.Instance.BootTaskDelay = timeSpan; | ||
GlobalAppSettings.Instance.Save(); | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.IO; | ||
using GalaSoft.MvvmLight; | ||
using Jot; | ||
using Jot.Storage; | ||
|
||
namespace WgServerforWindows.Models | ||
{ | ||
/// <summary> | ||
/// Defines system-wide, application-wide settings which will be persisted across sessions | ||
/// </summary> | ||
internal class GlobalAppSettings : ObservableObject | ||
{ | ||
#region Singleton member | ||
|
||
/// <summary> | ||
/// Singleton instance | ||
/// </summary> | ||
public static GlobalAppSettings Instance { get; } = new GlobalAppSettings(); | ||
|
||
#endregion | ||
|
||
#region Private constructor | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
private GlobalAppSettings() | ||
{ | ||
// Set up AppSettings tracking | ||
Tracker.Configure<GlobalAppSettings>() | ||
.Property(a => a.BootTaskDelay) | ||
.Track(this); | ||
} | ||
|
||
#endregion | ||
|
||
#region Public methods | ||
|
||
public void Save() | ||
{ | ||
Tracker.Persist(this); | ||
} | ||
|
||
#endregion | ||
|
||
#region Public properties | ||
|
||
/// <summary> | ||
/// Boot task delay time | ||
/// </summary> | ||
public TimeSpan BootTaskDelay | ||
{ | ||
get => _bootTaskDelay; | ||
set => Set(nameof(BootTaskDelay), ref _bootTaskDelay, value); | ||
} | ||
private TimeSpan _bootTaskDelay; | ||
|
||
/// <summary> | ||
/// The public tracker instance located in Public\Documents. Can be used to track things other than the <see cref="Instance"/>. | ||
/// </summary> | ||
public Tracker Tracker { get; } = new Tracker(new JsonFileStore(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), "WS4W"))); | ||
|
||
#endregion | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using WgServerforWindows.Controls; | ||
using WgServerforWindows.Properties; | ||
|
||
namespace WgServerforWindows.Models | ||
{ | ||
public class SettingsPrerequisite : PrerequisiteItem | ||
{ | ||
#region PrerequisiteItem members | ||
|
||
public SettingsPrerequisite(BootTaskDelaySubCommand bootTaskDelaySubCommand) : base | ||
( | ||
title: string.Empty, | ||
successMessage: string.Empty, | ||
errorMessage: string.Empty, | ||
resolveText: string.Empty, | ||
configureText: Resources.SettingsConfigure | ||
) | ||
{ | ||
SubCommands.Add(bootTaskDelaySubCommand); | ||
} | ||
|
||
public override BooleanTimeCachedProperty Fulfilled { get; } = new BooleanTimeCachedProperty(TimeSpan.FromSeconds(1), () => true); | ||
|
||
public override BooleanTimeCachedProperty HasIcon { get; } = new BooleanTimeCachedProperty(TimeSpan.Zero, () => false); | ||
|
||
public override void Resolve() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Configure() | ||
{ | ||
if (Control is PrerequisiteItemControl prerequisiteItemControl) | ||
{ | ||
prerequisiteItemControl.SplitButtonFulfilled.IsOpen = true; | ||
} | ||
} | ||
|
||
public override BooleanTimeCachedProperty IsInformational { get; } = new BooleanTimeCachedProperty(TimeSpan.Zero, () => true); | ||
|
||
#endregion | ||
} | ||
} |
Oops, something went wrong.