Skip to content

Commit 2073ad7

Browse files
2.1.5.2 - Implemented "-hideSystemTrayIcon" command line argument.
1 parent ba66216 commit 2073ad7

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

FormMain.cs

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public partial class FormMain : Form
7474
private const string REGEX_COMMAND_LINE_DELAY = @"^-delay=(?<Hours>\d{2}):(?<Minutes>\d{2}):(?<Seconds>\d{2})\.(?<Milliseconds>\d{3})$";
7575
private const string REGEX_COMMAND_LINE_LOCK = "^-lock$";
7676
private const string REGEX_COMMAND_LINE_JPEG_LEVEL = @"^-jpeglevel=(?<JpegLevel>\d{1,3})$";
77+
private const string REGEX_COMMAND_LINE_HIDE_SYSTEM_TRAY_ICON = "^-hideSystemTrayIcon$";
7778

7879
/// <summary>
7980
/// Constructor for the main form. Arguments from the command line can be passed to it.
@@ -102,6 +103,17 @@ public FormMain(string[] args)
102103
/// <param name="sender"></param>
103104
/// <param name="e"></param>
104105
private void FormMain_Load(object sender, EventArgs e)
106+
{
107+
InitializeThreads();
108+
109+
DeleteSlides();
110+
SearchDates();
111+
112+
// Changing the value of this property will automatically call SearchSlides.
113+
toolStripComboBoxImageFormatFilter.SelectedIndex = Properties.Settings.Default.ImageFormatIndex;
114+
}
115+
116+
private void InitializeThreads()
105117
{
106118
runDeleteSlidesThread = new BackgroundWorker
107119
{
@@ -123,12 +135,6 @@ private void FormMain_Load(object sender, EventArgs e)
123135
WorkerSupportsCancellation = true
124136
};
125137
runSlideSearchThread.DoWork += new DoWorkEventHandler(DoWork_runSlideSearchThread);
126-
127-
DeleteSlides();
128-
SearchDates();
129-
130-
// Changing the value of this property will automatically call SearchSlides.
131-
toolStripComboBoxImageFormatFilter.SelectedIndex = Properties.Settings.Default.ImageFormatIndex;
132138
}
133139

134140
/// <summary>
@@ -420,17 +426,17 @@ private void FormViewer_FormClosing(object sender, FormClosingEventArgs e)
420426
// Close this window.
421427
CloseWindow();
422428

423-
if (runDateSearchThread.IsBusy)
429+
if (runDateSearchThread != null && runDateSearchThread.IsBusy)
424430
{
425431
runDateSearchThread.CancelAsync();
426432
}
427433

428-
if (runSlideSearchThread.IsBusy)
434+
if (runSlideSearchThread != null && runSlideSearchThread.IsBusy)
429435
{
430436
runSlideSearchThread.CancelAsync();
431437
}
432438

433-
if (runDeleteSlidesThread.IsBusy)
439+
if (runDeleteSlidesThread != null && runDeleteSlidesThread.IsBusy)
434440
{
435441
runDeleteSlidesThread.CancelAsync();
436442
}
@@ -520,7 +526,7 @@ private void SearchDates()
520526

521527
monthCalendar.BoldedDates = null;
522528

523-
if (!runDateSearchThread.IsBusy)
529+
if (runDateSearchThread != null && !runDateSearchThread.IsBusy)
524530
{
525531
runDateSearchThread.RunWorkerAsync();
526532
}
@@ -531,7 +537,7 @@ private void SearchDates()
531537
/// </summary>
532538
private void DeleteSlides()
533539
{
534-
if (!runDeleteSlidesThread.IsBusy)
540+
if (runDeleteSlidesThread != null && !runDeleteSlidesThread.IsBusy)
535541
{
536542
runDeleteSlidesThread.RunWorkerAsync();
537543
}
@@ -547,7 +553,7 @@ private void SearchSlides()
547553
ClearPreview();
548554
DisableToolStripButtons();
549555

550-
if (!runSlideSearchThread.IsBusy)
556+
if (runSlideSearchThread != null && !runSlideSearchThread.IsBusy)
551557
{
552558
runSlideSearchThread.RunWorkerAsync();
553559
}
@@ -1110,13 +1116,13 @@ private void StartScreenCapture(string folder, string macro, string format, int
11101116
}
11111117

11121118
// Stop the folder search thread if it's busy.
1113-
if (runDateSearchThread.IsBusy)
1119+
if (runDateSearchThread != null && runDateSearchThread.IsBusy)
11141120
{
11151121
runDateSearchThread.CancelAsync();
11161122
}
11171123

11181124
// Stop the file search thread if it's busy.
1119-
if (runSlideSearchThread.IsBusy)
1125+
if (runSlideSearchThread != null && runSlideSearchThread.IsBusy)
11201126
{
11211127
runSlideSearchThread.CancelAsync();
11221128
}
@@ -1515,17 +1521,17 @@ private void Exit()
15151521
// Close this window.
15161522
CloseWindow();
15171523

1518-
if (runDateSearchThread.IsBusy)
1524+
if (runDateSearchThread != null && runDateSearchThread.IsBusy)
15191525
{
15201526
runDateSearchThread.CancelAsync();
15211527
}
15221528

1523-
if (runSlideSearchThread.IsBusy)
1529+
if (runSlideSearchThread != null && runSlideSearchThread.IsBusy)
15241530
{
15251531
runSlideSearchThread.CancelAsync();
15261532
}
15271533

1528-
if (runDeleteSlidesThread.IsBusy)
1534+
if (runDeleteSlidesThread != null && runDeleteSlidesThread.IsBusy)
15291535
{
15301536
runDeleteSlidesThread.CancelAsync();
15311537
}
@@ -1864,6 +1870,7 @@ private void ParseCommandLineArguments(string[] args)
18641870
toolStripMenuItemCloseWindowOnStartCapture.Checked = true;
18651871
toolStripMenuItemScheduleAtApplicationStartup.Checked = false;
18661872
toolStripMenuItemShowSlideshowOnStopScreenCapture.Checked = false;
1873+
toolStripMenuItemShowSystemTrayIcon.Checked = true;
18671874

18681875
#endregion Default Values for Command Line Arguments/Options
18691876

@@ -1878,6 +1885,7 @@ private void ParseCommandLineArguments(string[] args)
18781885
Regex rgxCommandLineScheduleStopAt = new Regex(REGEX_COMMAND_LINE_STOPAT);
18791886
Regex rgxCommandLineScheduleStartAt = new Regex(REGEX_COMMAND_LINE_STARTAT);
18801887
Regex rgxCommandLineJpegLevel = new Regex(REGEX_COMMAND_LINE_JPEG_LEVEL);
1888+
Regex rgxCommandLineHideSystemTrayIcon = new Regex(REGEX_COMMAND_LINE_HIDE_SYSTEM_TRAY_ICON);
18811889

18821890
#region Command Line Argument Parsing
18831891

@@ -1985,6 +1993,11 @@ private void ParseCommandLineArguments(string[] args)
19851993
jpegLevel = cmdJpegLevel;
19861994
}
19871995
}
1996+
1997+
if (rgxCommandLineHideSystemTrayIcon.IsMatch(args[i]))
1998+
{
1999+
toolStripMenuItemShowSystemTrayIcon.Checked = false;
2000+
}
19882001
}
19892002

19902003
#endregion Command Line Argument Parsing
@@ -1998,6 +2011,8 @@ private void ParseCommandLineArguments(string[] args)
19982011
numericUpDownImageResolutionRatio.Value = ratio;
19992012
comboBoxScheduleImageFormat.SelectedItem = imageFormat;
20002013

2014+
InitializeThreads();
2015+
20012016
if (isScheduled)
20022017
{
20032018
toolStripMenuItemScheduleAtApplicationStartup.Checked = true;

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.5.1")]
36-
[assembly: AssemblyFileVersion("2.1.5.1")]
35+
[assembly: AssemblyVersion("2.1.5.2")]
36+
[assembly: AssemblyFileVersion("2.1.5.2")]
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.5.1</Value>
9+
<Value Profile="(Default)">2.1.5.2</Value>
1010
</Setting>
1111
<Setting Name="ImageFormatFilter" Type="System.String" Scope="User">
1212
<Value Profile="(Default)">*.*</Value>

app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@
439439
<applicationSettings>
440440
<AutoScreenCapture.Properties.Settings>
441441
<setting name="ApplicationVersion" serializeAs="String">
442-
<value>2.1.5.1</value>
442+
<value>2.1.5.2</value>
443443
</setting>
444444
<setting name="ApplicationName" serializeAs="String">
445445
<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.5.0"/>
6+
version="2.1.5.2"/>
77
<asmv3:application>
88
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
99
<dpiAware>True/PM</dpiAware>

0 commit comments

Comments
 (0)