diff --git a/src/OutlookGoogleCalendarSync/Extensions/MessageBox.cs b/src/OutlookGoogleCalendarSync/Extensions/MessageBox.cs index 0fcea1a7..f13464ff 100644 --- a/src/OutlookGoogleCalendarSync/Extensions/MessageBox.cs +++ b/src/OutlookGoogleCalendarSync/Extensions/MessageBox.cs @@ -12,7 +12,7 @@ public static class OgcsMessageBox { static extern bool FlashWindowEx(ref FLASHWINFO pwfi); [StructLayout(LayoutKind.Sequential)] - public struct FLASHWINFO { + private struct FLASHWINFO { public UInt32 cbSize; public IntPtr hwnd; public UInt32 dwFlags; @@ -21,7 +21,7 @@ public struct FLASHWINFO { } [Flags] - public enum FlashMode { + private enum flashMode { /// Stop flashing. The system restores the window to its original state. FLASHW_STOP = 0, /// Flash the window caption. @@ -45,7 +45,7 @@ public enum FlashMode { /// The handle for the window to flash /// Bitwise flags /// - public static bool FlashWindow(IntPtr hWnd, FlashMode fm) { + private static bool flashWindow(IntPtr hWnd, flashMode fm) { FLASHWINFO fInfo = new FLASHWINFO(); fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); @@ -75,12 +75,12 @@ public static DialogResult Show(string text, string caption, MessageBoxButtons b if (mainFrm.InvokeRequired) { mainFrm.Invoke(new System.Action(() => { mainFrm.MainFormShow(); - FlashWindow(mainFrm.Handle, FlashMode.FLASHW_ALL | FlashMode.FLASHW_TIMERNOFG); + flashWindow(mainFrm.Handle, flashMode.FLASHW_ALL | flashMode.FLASHW_TIMERNOFG); dr = MessageBox.Show(mainFrm, text, caption, buttons, icon); })); } else { mainFrm.MainFormShow(); - FlashWindow(mainFrm.Handle, FlashMode.FLASHW_ALL | FlashMode.FLASHW_TIMERNOFG); + flashWindow(mainFrm.Handle, flashMode.FLASHW_ALL | flashMode.FLASHW_TIMERNOFG); dr = MessageBox.Show(mainFrm, text, caption, buttons, icon); } log.Debug("Response: " + dr.ToString()); @@ -105,12 +105,12 @@ public static DialogResult Show(string text, string caption, MessageBoxButtons b if (mainFrm.InvokeRequired) { mainFrm.Invoke(new System.Action(() => { mainFrm.MainFormShow(); - FlashWindow(mainFrm.Handle, FlashMode.FLASHW_ALL | FlashMode.FLASHW_TIMERNOFG); + flashWindow(mainFrm.Handle, flashMode.FLASHW_ALL | flashMode.FLASHW_TIMERNOFG); dr = MessageBox.Show(mainFrm, text, caption, buttons, icon, defaultButton); })); } else { mainFrm.MainFormShow(); - FlashWindow(mainFrm.Handle, FlashMode.FLASHW_ALL | FlashMode.FLASHW_TIMERNOFG); + flashWindow(mainFrm.Handle, flashMode.FLASHW_ALL | flashMode.FLASHW_TIMERNOFG); dr = MessageBox.Show(mainFrm, text, caption, buttons, icon, defaultButton); } log.Debug("Response: " + dr.ToString()); diff --git a/src/OutlookGoogleCalendarSync/Forms/UpdateInfo.cs b/src/OutlookGoogleCalendarSync/Forms/UpdateInfo.cs index a581b71d..c2976457 100644 --- a/src/OutlookGoogleCalendarSync/Forms/UpdateInfo.cs +++ b/src/OutlookGoogleCalendarSync/Forms/UpdateInfo.cs @@ -32,7 +32,7 @@ public UpdateInfo(String releaseVersion, String releaseType, String html, out Di lTitle.Text = "A new " + (releaseType == "alpha" ? "alpha " : "") + "release of OGCS is available"; lSummary.Text = "Would you like to upgrade to v" + releaseVersion + " now?"; - if (html == null) { + if (string.IsNullOrEmpty(html)) { String githubReleaseNotes = Program.OgcsWebsite + "/release-notes"; anchorRequested = "v" + releaseVersion.Replace(".", "") + "---" + releaseType; log.Debug("Browser anchor: " + anchorRequested); diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs index fc27cc29..f5cb9f77 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs @@ -540,6 +540,7 @@ public List FilterItems(Items outlookItems, String filter) { public MAPIFolder GetFolderByID(String entryID) { NameSpace ns = null; try { + if (oApp == null) OutlookOgcs.Calendar.AttachToOutlook(ref oApp); ns = oApp.GetNamespace("mapi"); return ns.GetFolderFromID(entryID); } finally { @@ -550,6 +551,7 @@ public MAPIFolder GetFolderByID(String entryID) { public void GetAppointmentByID(String entryID, out AppointmentItem ai) { NameSpace ns = null; try { + if (oApp == null) OutlookOgcs.Calendar.AttachToOutlook(ref oApp); ns = oApp.GetNamespace("mapi"); ai = ns.GetItemFromID(entryID) as AppointmentItem; } finally { diff --git a/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs b/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs index c74ef48d..5de996db 100644 --- a/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs +++ b/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs @@ -19,6 +19,10 @@ public Calendar() { setDefaults(); } + public override String ToString() { + return this._ProfileName + ": O[" + this.UseOutlookCalendar.Name + "] " + this.SyncDirection.ToString() + " G[" + this.UseGoogleCalendar.ToString() + "]"; + } + //Default values before loading from xml and attribute not yet serialized [OnDeserializing] void OnDeserializing(StreamingContext context) { diff --git a/src/OutlookGoogleCalendarSync/Updater.cs b/src/OutlookGoogleCalendarSync/Updater.cs index 690ca58c..430065a5 100644 --- a/src/OutlookGoogleCalendarSync/Updater.cs +++ b/src/OutlookGoogleCalendarSync/Updater.cs @@ -126,9 +126,9 @@ private async Task githubCheck() { foreach (ReleaseEntry update in updates.ReleasesToApply.OrderBy(x => x.Version).Reverse()) { log.Info("New " + update.Version.SpecialVersion + " version available: " + update.Version.Version.ToString()); - if (!this.isManualCheck && update.Version.Version.ToString() == Settings.Instance.SkipVersion) { + if (!this.isManualCheck && update.Version.Version.ToString() == Settings.Instance.SkipVersion && update == updates.ReleasesToApply.Last()) { log.Info("The user has previously requested to skip this version."); - break; + return false; } String localFile = updates.PackageDirectory + "\\" + update.Filename;