Skip to content

Commit

Permalink
Bugfix: Stop update check if latest version has been skipped.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Mar 6, 2022
1 parent 7d39569 commit dc7135d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/OutlookGoogleCalendarSync/Extensions/MessageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +21,7 @@ public struct FLASHWINFO {
}

[Flags]
public enum FlashMode {
private enum flashMode {
/// <summary>Stop flashing. The system restores the window to its original state.</summary>
FLASHW_STOP = 0,
/// <summary>Flash the window caption.</summary>
Expand All @@ -45,7 +45,7 @@ public enum FlashMode {
/// <param name="hWnd">The handle for the window to flash</param>
/// <param name="fm">Bitwise flags</param>
/// <returns></returns>
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));
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/OutlookGoogleCalendarSync/Forms/UpdateInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public List<Object> 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 {
Expand All @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/OutlookGoogleCalendarSync/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ private async Task<Boolean> 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;
Expand Down

0 comments on commit dc7135d

Please sign in to comment.