Skip to content

Commit ea6783b

Browse files
2.1.6.3 - System Tray Icon now shows the remaining time when the next screenshot will be taken when you hover the mouse pointer over it. This eliminates the need for the StatusMessage class (which basically just told you if Auto Screen Capture was either "Running" or "Stopped").
1 parent 956014a commit ea6783b

File tree

11 files changed

+72
-72
lines changed

11 files changed

+72
-72
lines changed

FormMain.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FormMain.cs

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public FormMain(string[] args)
8888
InitializeComponent();
8989

9090
Text = Properties.Settings.Default.ApplicationName;
91-
notifyIcon.Text = Properties.Settings.Default.ApplicationName;
91+
notifyIcon.Text = Properties.Settings.Default.ApplicationName + " (" + Properties.Settings.Default.ApplicationVersion + ")";
9292

9393
Log.Write("*** " + Properties.Settings.Default.ApplicationName + " (" + Properties.Settings.Default.ApplicationVersion + ") ***");
9494

@@ -961,17 +961,14 @@ private void StopScreenCapture()
961961
ScreenCapture.Count = 0;
962962
timerScreenCapture.Enabled = false;
963963

964-
// Let the user know of the last capture that was taken and the status of the session ("Stopped").
965-
DisplayCaptureStatus(false);
964+
ScreenCapture.Running = false;
966965

967966
DisableStopScreenCapture();
968967
EnableStartScreenCapture();
969968

970969
SearchDates();
971970
SearchSlides();
972971

973-
ScreenCapture.Running = false;
974-
975972
RunTriggersOfConditionType(TriggerConditionType.ScreenCaptureStopped);
976973
}
977974
}
@@ -1088,14 +1085,15 @@ private void StartScreenCapture()
10881085

10891086
ScreenCapture.Running = true;
10901087

1088+
ScreenCapture.DateTimeStartCapture = DateTime.Now;
1089+
10911090
RunTriggersOfConditionType(TriggerConditionType.ScreenCaptureStarted);
10921091

10931092
if (checkBoxInitialScreenshot.Checked)
10941093
{
10951094
Log.Write("Taking initial screenshots.");
10961095

10971096
TakeScreenshot();
1098-
DisplayCaptureStatus(true);
10991097
}
11001098

11011099
// Start taking screenshots.
@@ -1631,26 +1629,6 @@ private void DisableStartScreenCapture()
16311629
buttonBrowseFolder.Enabled = false;
16321630
}
16331631

1634-
/// <summary>
1635-
/// Displays the screen capture status.
1636-
/// </summary>
1637-
/// <param name="running">Can be "true" for "Running" or "false" for "Stopped".</param>
1638-
private void DisplayCaptureStatus(bool running)
1639-
{
1640-
string appName = Properties.Settings.Default.ApplicationName;
1641-
1642-
if (running)
1643-
{
1644-
appName += " - " + StatusMessage.RUNNING;
1645-
}
1646-
else
1647-
{
1648-
appName += " - " + StatusMessage.STOPPED;
1649-
}
1650-
1651-
notifyIcon.Text = appName;
1652-
}
1653-
16541632
/// <summary>
16551633
/// Plays the slideshow.
16561634
/// </summary>
@@ -2598,8 +2576,6 @@ private void Tick_timerPreviewCapture(object sender, EventArgs e)
25982576
/// <param name="e"></param>
25992577
private void Tick_timerScreenCapture(object sender, EventArgs e)
26002578
{
2601-
DisplayCaptureStatus(true);
2602-
26032579
if (!timerScreenCapture.Enabled)
26042580
{
26052581
StopScreenCapture();
@@ -2633,19 +2609,19 @@ private void TakeScreenshot()
26332609

26342610
AutoReset();
26352611

2636-
DateTime dateTimeScreenshotTaken = DateTime.Now;
2612+
ScreenCapture.DateTimePreviousScreenshot = DateTime.Now;
26372613

26382614
// Save a copy of an empty screenshot image file so that we can retrieve it later in the Slideshow.
26392615
if (CaptureScreenAllowed(1) || CaptureScreenAllowed(2) || CaptureScreenAllowed(3) || CaptureScreenAllowed(4) || CaptureScreenAllowed(5))
26402616
{
2641-
ScreenCapture.Save(FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ScreenshotListMacro, ScreenCapture.Format, null, dateTimeScreenshotTaken));
2617+
ScreenCapture.Save(FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ScreenshotListMacro, null));
26422618
}
26432619

26442620
// Active Window
26452621
if (CaptureScreenAllowed(5))
26462622
{
2647-
ScreenCapture.TakeScreenshot(_imageFormatCollection, null, dateTimeScreenshotTaken, ScreenCapture.Format, "5", FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ApplicationMacro, ScreenCapture.Format, "5", dateTimeScreenshotTaken), 5, ScreenshotType.Application, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2648-
ScreenCapture.TakeScreenshot(_imageFormatCollection, null, dateTimeScreenshotTaken, ScreenCapture.Format, textBoxScreen5Name.Text, ScreenCapture.Folder + MacroParser.ParseTags(_imageFormatCollection, ScreenCapture.Macro, ScreenCapture.Format, textBoxScreen5Name.Text, dateTimeScreenshotTaken), 5, ScreenshotType.User, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2623+
ScreenCapture.TakeScreenshot(_imageFormatCollection, null, "5", FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ApplicationMacro, "5"), 5, ScreenshotType.Application, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2624+
ScreenCapture.TakeScreenshot(_imageFormatCollection, null, textBoxScreen5Name.Text, ScreenCapture.Folder + MacroParser.ParseTags(_imageFormatCollection, ScreenCapture.Macro, textBoxScreen5Name.Text), 5, ScreenshotType.User, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
26492625
}
26502626

26512627
// All screens.
@@ -2679,8 +2655,8 @@ private void TakeScreenshot()
26792655

26802656
if (!string.IsNullOrEmpty(screenName))
26812657
{
2682-
ScreenCapture.TakeScreenshot(_imageFormatCollection, screen, dateTimeScreenshotTaken, ScreenCapture.Format, count.ToString(), FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ApplicationMacro, ScreenCapture.Format, count.ToString(), dateTimeScreenshotTaken), count, ScreenshotType.Application, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2683-
ScreenCapture.TakeScreenshot(_imageFormatCollection, screen, dateTimeScreenshotTaken, ScreenCapture.Format, screenName, ScreenCapture.Folder + MacroParser.ParseTags(_imageFormatCollection, ScreenCapture.Macro, ScreenCapture.Format, screenName, dateTimeScreenshotTaken), count, ScreenshotType.User, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2658+
ScreenCapture.TakeScreenshot(_imageFormatCollection, screen, count.ToString(), FileSystem.UserAppDataLocalDirectory + MacroParser.ParseTags(_imageFormatCollection, MacroParser.ApplicationMacro, count.ToString()), count, ScreenshotType.Application, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
2659+
ScreenCapture.TakeScreenshot(_imageFormatCollection, screen, screenName, ScreenCapture.Folder + MacroParser.ParseTags(_imageFormatCollection, ScreenCapture.Macro, screenName), count, ScreenshotType.User, (long)numericUpDownJpegQualityLevel.Value, checkBoxMouse.Checked);
26842660
}
26852661
}
26862662
}
@@ -3403,5 +3379,25 @@ private void RunTriggersOfConditionType(TriggerConditionType conditionType)
34033379
}
34043380
}
34053381
}
3382+
3383+
/// <summary>
3384+
/// Displays the remaining time for when the next screenshot will be taken
3385+
/// when the mouse pointer moves over the system tray icon.
3386+
/// </summary>
3387+
/// <param name="sender"></param>
3388+
/// <param name="e"></param>
3389+
private void notifyIcon_MouseMove(object sender, MouseEventArgs e)
3390+
{
3391+
int remainingHours = ScreenCapture.TimeRemainingForNextScreenshot.Hours;
3392+
int remainingMinutes = ScreenCapture.TimeRemainingForNextScreenshot.Minutes;
3393+
int remainingSeconds = ScreenCapture.TimeRemainingForNextScreenshot.Seconds;
3394+
3395+
string remainingHoursStr = (remainingHours > 0 ? remainingHours.ToString() + " hour" + (remainingHours > 1 ? "s" : string.Empty) + ", " : string.Empty);
3396+
string remainingMinutesStr = (remainingMinutes > 0 ? remainingMinutes.ToString() + " minute" + (remainingMinutes > 1 ? "s" : string.Empty) + ", " : string.Empty);
3397+
3398+
notifyIcon.Text = "Next screenshot in " +
3399+
remainingHoursStr + remainingMinutesStr + remainingSeconds.ToString() +
3400+
" second" + (remainingSeconds > 1 ? "s" : string.Empty) + " at " + ScreenCapture.DateTimeNextScreenshot.ToShortTimeString();
3401+
}
34063402
}
34073403
}

MacroParser.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ public static class MacroParser
1717
public static readonly string ScreenshotListMacro = @"%year%-%month%-%day%\%year%-%month%-%day%_%hour%-%minute%-%second%-%millisecond%.%format%";
1818
public static readonly string ApplicationMacro = @"%year%-%month%-%day%\%screen%\%year%-%month%-%day%_%hour%-%minute%-%second%-%millisecond%.%format%";
1919

20-
public static string ParseTags(ImageFormatCollection imageFormatCollection, string path, string imageFormat, string screenName, DateTime dateTimeScreenshotTaken)
20+
public static string ParseTags(ImageFormatCollection imageFormatCollection, string path, string screenName)
2121
{
22-
if (!string.IsNullOrEmpty(imageFormat))
22+
if (!string.IsNullOrEmpty(ScreenCapture.Format))
2323
{
24-
path = path.Replace("%format%", imageFormatCollection.GetByName(imageFormat).Extension.TrimStart('.'));
24+
path = path.Replace("%format%", imageFormatCollection.GetByName(ScreenCapture.Format).Extension.TrimStart('.'));
2525
}
2626

2727
if (!string.IsNullOrEmpty(screenName))
2828
{
2929
path = path.Replace("%screen%", screenName);
3030
}
3131

32-
path = path.Replace("%year%", dateTimeScreenshotTaken.ToString("yyyy"));
33-
path = path.Replace("%month%", dateTimeScreenshotTaken.ToString("MM"));
34-
path = path.Replace("%day%", dateTimeScreenshotTaken.ToString("dd"));
35-
path = path.Replace("%hour%", dateTimeScreenshotTaken.ToString("HH"));
36-
path = path.Replace("%minute%", dateTimeScreenshotTaken.ToString("mm"));
37-
path = path.Replace("%second%", dateTimeScreenshotTaken.ToString("ss"));
38-
path = path.Replace("%millisecond%", dateTimeScreenshotTaken.ToString("fff"));
32+
path = path.Replace("%year%", ScreenCapture.DateTimePreviousScreenshot.ToString("yyyy"));
33+
path = path.Replace("%month%", ScreenCapture.DateTimePreviousScreenshot.ToString("MM"));
34+
path = path.Replace("%day%", ScreenCapture.DateTimePreviousScreenshot.ToString("dd"));
35+
path = path.Replace("%hour%", ScreenCapture.DateTimePreviousScreenshot.ToString("HH"));
36+
path = path.Replace("%minute%", ScreenCapture.DateTimePreviousScreenshot.ToString("mm"));
37+
path = path.Replace("%second%", ScreenCapture.DateTimePreviousScreenshot.ToString("ss"));
38+
path = path.Replace("%millisecond%", ScreenCapture.DateTimePreviousScreenshot.ToString("fff"));
3939

4040
return path;
4141
}

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.1.6.2")]
36-
[assembly: AssemblyFileVersion("2.1.6.2")]
35+
[assembly: AssemblyVersion("2.1.6.3")]
36+
[assembly: AssemblyFileVersion("2.1.6.3")]
3737
[assembly: NeutralResourcesLanguageAttribute("en-CA")]

Properties/Settings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Properties/Settings.settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Value Profile="(Default)">60000</Value>
77
</Setting>
88
<Setting Name="ApplicationVersion" Type="System.String" Scope="Application">
9-
<Value Profile="(Default)">2.1.6.2</Value>
9+
<Value Profile="(Default)">2.1.6.3</Value>
1010
</Setting>
1111
<Setting Name="ImageFormatFilter" Type="System.String" Scope="User">
1212
<Value Profile="(Default)">*.*</Value>

StatusMessage.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@
406406
<applicationSettings>
407407
<AutoScreenCapture.Properties.Settings>
408408
<setting name="ApplicationVersion" serializeAs="String">
409-
<value>2.1.6.2</value>
409+
<value>2.1.6.3</value>
410410
</setting>
411411
<setting name="ApplicationName" serializeAs="String">
412412
<value>Auto Screen Capture</value>

app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<assemblyIdentity
44
type="win32"
55
name="GavinKendall.AutoScreenCapture"
6-
version="2.1.6.2"/>
6+
version="2.1.6.3"/>
77
<asmv3:application>
88
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
99
<dpiAware>True/PM</dpiAware>

autoscreen.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
<Compile Include="modules\screen_capture\Screenshot.cs" />
117117
<Compile Include="modules\screen_capture\ScreenshotCollection.cs" />
118118
<Compile Include="modules\screen_capture\ScreenshotType.cs" />
119-
<Compile Include="StatusMessage.cs" />
120119
<Compile Include="MacroParser.cs" />
121120
<Compile Include="modules\triggers\Trigger.cs" />
122121
<Compile Include="modules\triggers\TriggerCollection.cs" />

0 commit comments

Comments
 (0)