Skip to content

Commit d447d5b

Browse files
2.1.7.6 - Bug fixes.
1 parent 272386b commit d447d5b

File tree

3 files changed

+59
-38
lines changed

3 files changed

+59
-38
lines changed

FormMain.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,13 @@ private void FormViewer_FormClosing(object sender, FormClosingEventArgs e)
526526

527527
formRegion.RegionCollection.Save();
528528

529-
SaveSettings();
530-
531529
// Exit.
532530
Environment.Exit(0);
533531
}
534532
else
535533
{
534+
SaveSettings();
535+
536536
RunTriggersOfConditionType(TriggerConditionType.InterfaceClosing);
537537

538538
// If there isn't a Trigger for "InterfaceClosing" that performs an action
@@ -876,7 +876,7 @@ private void ShowInterface()
876876
{
877877
checkBoxPassphraseLock.Checked = false;
878878
Settings.User.GetByKey("LockScreenCaptureSession").Value = false;
879-
Settings.User.Save();
879+
SaveSettings();
880880

881881
Opacity = 100;
882882
toolStripMenuItemShowInterface.Enabled = false;
@@ -893,6 +893,8 @@ private void ShowInterface()
893893
WindowState = FormWindowState.Normal;
894894
}
895895

896+
RunTriggersOfConditionType(TriggerConditionType.InterfaceShowing);
897+
896898
Focus();
897899
}
898900
}
@@ -902,6 +904,8 @@ private void ShowInterface()
902904
/// </summary>
903905
private void HideInterface()
904906
{
907+
SaveSettings();
908+
905909
Log.Write("Hiding interface.");
906910

907911
// Pause the slideshow if you find it still playing.
@@ -917,6 +921,8 @@ private void HideInterface()
917921
Hide();
918922
Visible = false;
919923
ShowInTaskbar = false;
924+
925+
RunTriggersOfConditionType(TriggerConditionType.InterfaceHiding);
920926
}
921927

922928
/// <summary>
@@ -940,7 +946,7 @@ private void StopScreenCapture()
940946
{
941947
checkBoxPassphraseLock.Checked = false;
942948
Settings.User.GetByKey("LockScreenCaptureSession").Value = false;
943-
Settings.User.Save();
949+
SaveSettings();
944950

945951
ScreenCapture.Count = 0;
946952
timerScreenCapture.Enabled = false;
@@ -1422,7 +1428,7 @@ private void ExitApplication()
14221428

14231429
checkBoxPassphraseLock.Checked = false;
14241430
Settings.User.GetByKey("LockScreenCaptureSession").Value = false;
1425-
Settings.User.Save();
1431+
SaveSettings();
14261432

14271433
// Hide the system tray icon.
14281434
notifyIcon.Visible = false;
@@ -1452,8 +1458,6 @@ private void ExitApplication()
14521458

14531459
formRegion.RegionCollection.Save();
14541460

1455-
SaveSettings();
1456-
14571461
// Exit.
14581462
Environment.Exit(0);
14591463
}
@@ -2706,7 +2710,7 @@ private void Click_buttonSetPassphrase(object sender, EventArgs e)
27062710
if (textBoxPassphrase.Text.Length > 0)
27072711
{
27082712
Settings.User.GetByKey("Passphrase").Value = textBoxPassphrase.Text;
2709-
Settings.User.Save();
2713+
SaveSettings();
27102714

27112715
textBoxPassphrase.ReadOnly = true;
27122716
buttonSetPassphrase.Enabled = false;
@@ -2730,7 +2734,7 @@ private void Click_buttonClearPassphrase(object sender, EventArgs e)
27302734

27312735
Settings.User.GetByKey("LockScreenCaptureSession").Value = false;
27322736
Settings.User.GetByKey("Passphrase").Value = string.Empty;
2733-
Settings.User.Save();
2737+
SaveSettings();
27342738

27352739
textBoxPassphrase.Focus();
27362740
}

Log.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ public static void Write(string message, Exception ex)
5757
sw.Flush();
5858
sw.Close();
5959
}
60+
61+
using (StreamWriter sw = new StreamWriter(FileSystem.LogsFolder + logFile + extension, true))
62+
{
63+
sw.WriteLine("[(v" + Settings.Application.GetByKey("Version").Value + ") " +
64+
DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "] " + message + " - Error: " +
65+
ex.Message);
66+
67+
sw.Flush();
68+
sw.Close();
69+
}
6070
}
6171
else
6272
{

modules/screen/ScreenshotCollection.cs

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,46 +34,53 @@ public static class ScreenshotCollection
3434

3535
public static void Add(Screenshot newScreenshot, ScreenshotType screenshotType)
3636
{
37-
// Make sure we only intend to add the new screenshot to the user's XML formatted settings.
38-
if (screenshotType == ScreenshotType.User)
37+
try
3938
{
40-
XmlNode xScreenshots = xDoc.GetElementsByTagName(XML_FILE_SCREENSHOTS_NODE).Item(0);
39+
// Make sure we only intend to add the new screenshot to the user's XML formatted settings.
40+
if (screenshotType == ScreenshotType.User)
41+
{
42+
XmlNode xScreenshots = xDoc.GetElementsByTagName(XML_FILE_SCREENSHOTS_NODE).Item(0);
4143

42-
XmlElement xNewScreenshot = xDoc.CreateElement(XML_FILE_SCREENSHOT_NODE);
44+
XmlElement xNewScreenshot = xDoc.CreateElement(XML_FILE_SCREENSHOT_NODE);
4345

44-
XmlElement xNewScreenshotIndex = xDoc.CreateElement(SCREENSHOT_INDEX);
45-
xNewScreenshotIndex.InnerText = newScreenshot.Index.ToString();
46+
XmlElement xNewScreenshotIndex = xDoc.CreateElement(SCREENSHOT_INDEX);
47+
xNewScreenshotIndex.InnerText = newScreenshot.Index.ToString();
4648

47-
XmlElement xNewScreenshotDate = xDoc.CreateElement(SCREENSHOT_DATE);
48-
xNewScreenshotDate.InnerText = newScreenshot.Date;
49+
XmlElement xNewScreenshotDate = xDoc.CreateElement(SCREENSHOT_DATE);
50+
xNewScreenshotDate.InnerText = newScreenshot.Date;
4951

50-
XmlElement xNewScreenshotPath = xDoc.CreateElement(SCREENSHOT_PATH);
51-
xNewScreenshotPath.InnerText = newScreenshot.Path;
52+
XmlElement xNewScreenshotPath = xDoc.CreateElement(SCREENSHOT_PATH);
53+
xNewScreenshotPath.InnerText = newScreenshot.Path;
5254

53-
XmlElement xNewScreenshotScreen = xDoc.CreateElement(SCREENSHOT_SCREEN);
54-
xNewScreenshotScreen.InnerText = newScreenshot.Screen.ToString();
55+
XmlElement xNewScreenshotScreen = xDoc.CreateElement(SCREENSHOT_SCREEN);
56+
xNewScreenshotScreen.InnerText = newScreenshot.Screen.ToString();
5557

56-
XmlElement xNewScreenshotFormat = xDoc.CreateElement(SCREENSHOT_FORMAT);
57-
xNewScreenshotFormat.InnerText = newScreenshot.Format;
58+
XmlElement xNewScreenshotFormat = xDoc.CreateElement(SCREENSHOT_FORMAT);
59+
xNewScreenshotFormat.InnerText = newScreenshot.Format;
5860

59-
XmlElement xNewScreenshotFilename = xDoc.CreateElement(SCREENSHOT_FILENAME);
60-
xNewScreenshotFilename.InnerText = newScreenshot.Filename;
61+
XmlElement xNewScreenshotFilename = xDoc.CreateElement(SCREENSHOT_FILENAME);
62+
xNewScreenshotFilename.InnerText = newScreenshot.Filename;
6163

62-
XmlElement xNewScreenshotSlidename = xDoc.CreateElement(SCREENSHOT_SLIDENAME);
63-
xNewScreenshotSlidename.InnerText = newScreenshot.Slidename;
64+
XmlElement xNewScreenshotSlidename = xDoc.CreateElement(SCREENSHOT_SLIDENAME);
65+
xNewScreenshotSlidename.InnerText = newScreenshot.Slidename;
6466

65-
// Append all the nodes in the appropriate locations.
66-
xNewScreenshot.AppendChild(xNewScreenshotIndex);
67-
xNewScreenshot.AppendChild(xNewScreenshotDate);
68-
xNewScreenshot.AppendChild(xNewScreenshotPath);
69-
xNewScreenshot.AppendChild(xNewScreenshotScreen);
70-
xNewScreenshot.AppendChild(xNewScreenshotFormat);
71-
xNewScreenshot.AppendChild(xNewScreenshotFilename);
72-
xNewScreenshot.AppendChild(xNewScreenshotSlidename);
73-
xScreenshots.AppendChild(xNewScreenshot);
67+
// Append all the nodes in the appropriate locations.
68+
xNewScreenshot.AppendChild(xNewScreenshotIndex);
69+
xNewScreenshot.AppendChild(xNewScreenshotDate);
70+
xNewScreenshot.AppendChild(xNewScreenshotPath);
71+
xNewScreenshot.AppendChild(xNewScreenshotScreen);
72+
xNewScreenshot.AppendChild(xNewScreenshotFormat);
73+
xNewScreenshot.AppendChild(xNewScreenshotFilename);
74+
xNewScreenshot.AppendChild(xNewScreenshotSlidename);
75+
xScreenshots.AppendChild(xNewScreenshot);
7476

75-
// Add the new screenshot to the collection of screenshots.
76-
_screenshotList.Add(newScreenshot);
77+
// Add the new screenshot to the collection of screenshots.
78+
_screenshotList.Add(newScreenshot);
79+
}
80+
}
81+
catch (Exception ex)
82+
{
83+
Log.Write("ScreenshotCollection::Add", ex);
7784
}
7885
}
7986

0 commit comments

Comments
 (0)