Skip to content

Commit

Permalink
Release v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dziemborowicz committed Jul 15, 2018
2 parents ed18c65 + b44e06a commit 87e6d2a
Show file tree
Hide file tree
Showing 20 changed files with 302 additions and 59 deletions.
30 changes: 21 additions & 9 deletions Hourglass.Bundle/Bundle.wxs
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="Hourglass" Version="1.9.0.0" Manufacturer="Chris Dziemborowicz" UpgradeCode="f1d002c9-cfc9-40fb-84af-96e7aec26e0b" IconSourceFile="$(var.Hourglass.ProjectDir)Resources\AppIcon.ico">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="MIT.rtf" LogoFile="Logo.png"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40ClientWeb"/>
<MsiPackage Id="HourglassSetup" SourceFile="$(var.Hourglass.Setup.TargetPath)"/>
</Chain>
</Bundle>
<Bundle Name="Hourglass"
Version="1.10.0.0"
Manufacturer="Chris Dziemborowicz"
UpgradeCode="f1d002c9-cfc9-40fb-84af-96e7aec26e0b"
IconSourceFile="$(var.Hourglass.ProjectDir)Resources\AppIcon.ico">

<!-- Specify a "sensible default" install location -->
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Hourglass" />

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="MIT.rtf" LogoFile="Logo.png" />
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40ClientWeb" />
<MsiPackage Id="HourglassSetup" SourceFile="$(var.Hourglass.Setup.TargetPath)">
<!-- Pass this selection down to the Hourglass.Setup msi -->
<MsiProperty Name="APPLICATIONFOLDER" Value="[InstallFolder]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>
Binary file modified Hourglass.Bundle/MIT.rtf
Binary file not shown.
2 changes: 1 addition & 1 deletion Hourglass.Setup/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="Hourglass" Language="1033" Version="1.9.0.0" Manufacturer="Chris Dziemborowicz" UpgradeCode="172d3713-8820-4374-8195-3e2374e7724f">
<Product Id="*" Name="Hourglass" Language="1033" Version="1.10.0.0" Manufacturer="Chris Dziemborowicz" UpgradeCode="172d3713-8820-4374-8195-3e2374e7724f">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>

<Icon Id="AppIcon.exe" SourceFile="$(var.Hourglass.ProjectDir)Resources\AppIcon.ico"/>
Expand Down
6 changes: 3 additions & 3 deletions Hourglass.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hourglass.Test")]
[assembly: AssemblyCopyright("Copyright © 2017 Chris Dziemborowicz")]
[assembly: AssemblyCopyright("Copyright © 2018 Chris Dziemborowicz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("002a4be7-7323-4bf9-ab08-5fc8978d9eb0")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
27 changes: 24 additions & 3 deletions Hourglass/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public static string Usage
/// </summary>
public Rect WindowBounds { get; private set; }

/// <summary>
/// Gets a value indicating whether the user interface should be locked, preventing the user from taking any
/// action until the timer expires.
/// </summary>
public bool LockInterface { get; private set; }

#endregion

#region Public Methods
Expand Down Expand Up @@ -224,7 +230,8 @@ public TimerOptions GetTimerOptions()
Sound = this.Sound,
LoopSound = this.LoopSound,
WindowTitleMode = this.WindowTitleMode,
WindowSize = this.GetWindowSize()
WindowSize = this.GetWindowSize(),
LockInterface = this.LockInterface
};
}

Expand Down Expand Up @@ -274,7 +281,8 @@ private static CommandLineArguments GetArgumentsFromMostRecentOptions()
WindowTitleMode = options.WindowTitleMode,
WindowState = windowSize.WindowState != WindowState.Minimized ? windowSize.WindowState : windowSize.RestoreWindowState,
RestoreWindowState = windowSize.RestoreWindowState,
WindowBounds = windowSize.RestoreBounds
WindowBounds = windowSize.RestoreBounds,
LockInterface = options.LockInterface
};
}

Expand Down Expand Up @@ -310,7 +318,8 @@ private static CommandLineArguments GetArgumentsFromFactoryDefaults()
WindowTitleMode = WindowTitleMode.ApplicationName,
WindowState = defaultOptions.WindowSize.WindowState,
RestoreWindowState = defaultOptions.WindowSize.RestoreWindowState,
WindowBounds = defaultWindowBoundsWithLocation
WindowBounds = defaultWindowBoundsWithLocation,
LockInterface = defaultOptions.LockInterface
};
}

Expand Down Expand Up @@ -575,6 +584,18 @@ private static CommandLineArguments GetCommandLineArguments(IEnumerable<string>
argumentsBasedOnFactoryDefaults.WindowBounds = argumentsBasedOnFactoryDefaults.WindowBounds.Merge(windowBounds);
break;

case "--lock-interface":
case "-z":
ThrowIfDuplicateSwitch(specifiedSwitches, "--lock-interface");

bool lockInterface = GetBoolValue(
arg,
remainingArgs);

argumentsBasedOnMostRecentOptions.LockInterface = lockInterface;
argumentsBasedOnFactoryDefaults.LockInterface = lockInterface;
break;

case "--use-factory-defaults":
case "-d":
ThrowIfDuplicateSwitch(specifiedSwitches, "--use-factory-defaults");
Expand Down
1 change: 1 addition & 0 deletions Hourglass/Managers/TimerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public override void Persist()
{
Settings.Default.Timers = this.timers
.Where(t => t.State != TimerState.Stopped && t.State != TimerState.Expired)
.Where(t => !t.Options.LockInterface)
.Take(MaxSavedTimers)
.ToList();
}
Expand Down
3 changes: 2 additions & 1 deletion Hourglass/Managers/TimerOptionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ orderby window.Menu.LastShowed descending
// Never save a title
this.mostRecentOptions.Title = string.Empty;

// Never save shutting down when expired
// Never save shutting down when expired or lock interface options
this.mostRecentOptions.ShutDownWhenExpired = false;
this.mostRecentOptions.LockInterface = false;
}
}
}
2 changes: 1 addition & 1 deletion Hourglass/Parsing/DateTimeToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public override DateTime GetEndTime(DateTime startTime)
dateTime = this.TimeToken.ToDateTime(startTime, datePart);
}

if (dateTime <= startTime)
if (dateTime < startTime)
{
throw new InvalidOperationException();
}
Expand Down
2 changes: 1 addition & 1 deletion Hourglass/Parsing/TimeSpanToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public override DateTime GetEndTime(DateTime startTime)
endTime = endTime.AddMonths(this.Months);
endTime = endTime.AddYears(this.Years);

if (endTime <= startTime)
if (endTime < startTime)
{
throw new InvalidOperationException();
}
Expand Down
2 changes: 1 addition & 1 deletion Hourglass/Properties/App.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.9.0.0" name="Hourglass"/>
<assemblyIdentity version="1.10.0.0" name="Hourglass"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
6 changes: 3 additions & 3 deletions Hourglass/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chris Dziemborowicz")]
[assembly: AssemblyProduct("Hourglass")]
[assembly: AssemblyCopyright("Copyright © 2017 Chris Dziemborowicz")]
[assembly: AssemblyCopyright("Copyright © 2018 Chris Dziemborowicz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: Guid("83DBAA61-6193-4288-BBB7-BEAEC33FE321")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
Expand Down
9 changes: 9 additions & 0 deletions Hourglass/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Hourglass/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1229,4 +1229,8 @@ $</value>
<value> · </value>
<comment>The separator for parts of the window title for the timer window</comment>
</data>
<data name="TimerStartZero" xml:space="preserve">
<value>0 seconds</value>
<comment>The zero-length value for a timer</comment>
</data>
</root>
16 changes: 16 additions & 0 deletions Hourglass/Resources/Usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ Options:
Default value last
Alias -b

--lock-interface on|off
Prevents the user from starting, pausing, resetting, or stopping the
timer, changing the timer options, or closing the timer window until the
timer expires.

This option is never remembered. It must be specified as a command-line
argument each time the timer is started.

Timers that are started with this option turned on never appear in the
"Saved timers" list.

Required no
Default value off
Alias -z

--use-factory-defaults
If specified, any options that are not explicitly set with another
switch are set to their factory default setting rather than the last
Expand All @@ -214,6 +229,7 @@ Options:
--open-saved-timers off
--window-state normal
--window-bounds auto,auto,350,150
--lock-interface off

Required no
Alias -d
Expand Down
6 changes: 6 additions & 0 deletions Hourglass/Serialization/TimerOptionsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public class TimerOptionsInfo
/// </summary>
public WindowSizeInfo WindowSize { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the user interface should be locked, preventing the user from taking
/// any action until the timer expires.
/// </summary>
public bool LockInterface { get; set; }

/// <summary>
/// Returns a <see cref="TimerOptionsInfo"/> for the specified <see cref="TimerOptions"/>.
/// </summary>
Expand Down
41 changes: 38 additions & 3 deletions Hourglass/Timing/TimerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ public class TimerOptions : INotifyPropertyChanged
/// </summary>
private WindowSize windowSize;

/// <summary>
/// A value indicating whether the user interface should be locked, preventing the user from taking any action
/// until the timer expires.
/// </summary>
private bool lockInterface;

#endregion

#region Constructors
Expand Down Expand Up @@ -165,6 +171,7 @@ public TimerOptions()
WindowState.Normal,
WindowState.Normal,
false /* isFullScreen */);
this.lockInterface = false;
}

/// <summary>
Expand Down Expand Up @@ -510,6 +517,29 @@ public WindowSize WindowSize
}
}

/// <summary>
/// Gets or sets a value indicating whether the user interface should be locked, preventing the user from taking
/// any action until the timer expires.
/// </summary>
public bool LockInterface
{
get
{
return this.lockInterface;
}

set
{
if (this.lockInterface == value)
{
return;
}

this.lockInterface = value;
this.OnPropertyChanged("LockInterface");
}
}

#endregion

#region Public Methods
Expand Down Expand Up @@ -563,6 +593,7 @@ public void Set(TimerOptions options)
this.loopSound = options.loopSound;
this.windowTitleMode = options.windowTitleMode;
this.windowSize = WindowSize.FromWindowSize(options.WindowSize);
this.lockInterface = options.lockInterface;

this.OnPropertyChanged(
"Title",
Expand All @@ -578,7 +609,8 @@ public void Set(TimerOptions options)
"Sound",
"LoopSound",
"WindowTitleMode",
"WindowSize");
"WindowSize",
"LockInterface");
}

/// <summary>
Expand Down Expand Up @@ -606,6 +638,7 @@ public void Set(TimerOptionsInfo info)
this.loopSound = info.LoopSound;
this.windowTitleMode = info.WindowTitleMode;
this.windowSize = WindowSize.FromWindowSizeInfo(info.WindowSize);
this.lockInterface = info.LockInterface;

this.OnPropertyChanged(
"Title",
Expand All @@ -621,7 +654,8 @@ public void Set(TimerOptionsInfo info)
"Sound",
"LoopSound",
"WindowTitleMode",
"WindowSize");
"WindowSize",
"LockInterface");
}

/// <summary>
Expand All @@ -645,7 +679,8 @@ public TimerOptionsInfo ToTimerOptionsInfo()
SoundIdentifier = this.sound?.Identifier,
LoopSound = this.loopSound,
WindowTitleMode = this.windowTitleMode,
WindowSize = WindowSizeInfo.FromWindowSize(this.windowSize)
WindowSize = WindowSizeInfo.FromWindowSize(this.windowSize),
LockInterface = this.lockInterface
};
}

Expand Down
11 changes: 10 additions & 1 deletion Hourglass/Timing/TimerStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,24 @@ public static TimerStart Default
get { return TimerStart.FromString(Resources.TimerStartDefault); }
}

/// <summary>
/// Gets the zero-length <see cref="TimerStart"/> object.
/// </summary>
public static TimerStart Zero
{
get { return TimerStart.FromString(Resources.TimerStartZero); }
}

/// <summary>
/// Gets a value indicating whether the <see cref="TimerStart"/> can be used to start a timer now.
/// </summary>
public bool IsCurrent
{
get
{
DateTime now = DateTime.Now;
DateTime endTime;
return this.timerStartToken.TryGetEndTime(DateTime.Now, out endTime) && endTime > DateTime.Now;
return this.timerStartToken.TryGetEndTime(now, out endTime) && endTime >= now;
}
}

Expand Down
7 changes: 7 additions & 0 deletions Hourglass/Windows/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ public void Bind(TimerWindow window)
/// <param name="e">The event data.</param>
private void WindowContextMenuOpening(object sender, ContextMenuEventArgs e)
{
// Do not show the context menu if the user interface is locked
if (this.timerWindow.Options.LockInterface)
{
e.Handled = true;
return;
}

// Update dynamic items
this.UpdateRecentInputsMenuItem();
this.UpdateSavedTimersMenuItem();
Expand Down
Loading

0 comments on commit 87e6d2a

Please sign in to comment.