From e44ba867dc179e91a3f89057d292119c218db3c5 Mon Sep 17 00:00:00 2001 From: Paul Woolcock <11843015+phw198@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:38:31 +0000 Subject: [PATCH] Ensure push sync engine has active profile. --- src/OutlookGoogleCalendarSync/Sync/Timer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/OutlookGoogleCalendarSync/Sync/Timer.cs b/src/OutlookGoogleCalendarSync/Sync/Timer.cs index bec35f86..d956d155 100644 --- a/src/OutlookGoogleCalendarSync/Sync/Timer.cs +++ b/src/OutlookGoogleCalendarSync/Sync/Timer.cs @@ -148,6 +148,7 @@ public PushSyncTimer(Object owningProfile) { ResetLastRun(); this.Tag = "PushTimer"; this.Interval = 2 * 60000; + if (Program.InDeveloperMode) this.Interval = 30000; this.Tick += new EventHandler(ogcsPushTimer_Tick); } @@ -169,9 +170,14 @@ private void ogcsPushTimer_Tick(object sender, EventArgs e) { log.UltraFine("Push sync triggered."); try { - if (OutlookOgcs.Calendar.Instance.IOutlook.NoGUIexists()) return; - SettingsStore.Calendar profile = this.owningProfile as SettingsStore.Calendar; + + //In case the IOutlook.Connect() has to be called which needs an active profile + if (Sync.Engine.Calendar.Instance.Profile == null) + //Force in the push sync profile + Sync.Engine.Calendar.Instance.Profile = profile; + + if (OutlookOgcs.Calendar.Instance.IOutlook.NoGUIexists()) return; log.Fine("Push sync triggered for profile: " + Settings.Profile.Name(profile)); System.Collections.Generic.List items = OutlookOgcs.Calendar.Instance.GetCalendarEntriesInRange(profile, true);