diff --git a/src/OutlookGoogleCalendarSync/GoogleOgcs/EventColour.cs b/src/OutlookGoogleCalendarSync/GoogleOgcs/EventColour.cs index 162ff7ae..aa3472ba 100644 --- a/src/OutlookGoogleCalendarSync/GoogleOgcs/EventColour.cs +++ b/src/OutlookGoogleCalendarSync/GoogleOgcs/EventColour.cs @@ -178,7 +178,7 @@ public EventColour() { } /// public List ActivePalette { get { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); List activePalette = new List(); if (profile.UseGoogleCalendar == null) return activePalette; diff --git a/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs b/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs index 276a974e..0670115a 100644 --- a/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs +++ b/src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs @@ -260,7 +260,7 @@ public Event GetCalendarEntry(String eventId) { } public List GetCalendarEntriesInRange() { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); return GetCalendarEntriesInRange(profile.SyncStart, profile.SyncEnd); } @@ -270,7 +270,7 @@ public List GetCalendarEntriesInRange(DateTime from, DateTime to) { String pageToken = null; Int16 pageNum = 1; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); log.Debug("Retrieving all events from Google: " + from.ToShortDateString() + " -> " + to.ToShortDateString()); do { @@ -1485,7 +1485,7 @@ public void GetSettings() { } } private void getCalendarSettings() { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (!profile.AddReminders || !profile.UseGoogleDefaultReminder) return; @@ -1604,7 +1604,7 @@ private EventColour.Palette getColour(String aiCategories, EventColour.Palette g public EventColour.Palette GetColour(OlCategoryColor categoryColour) { EventColour.Palette gColour = null; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (profile.ColourMaps.Count > 0) { KeyValuePair kvp = profile.ColourMaps.FirstOrDefault(cm => OutlookOgcs.Calendar.Categories.OutlookColour(cm.Key) == categoryColour); if (kvp.Key != null) { diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs index a17640bf..9e043adf 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCalendar.cs @@ -148,7 +148,7 @@ public List FilterCalendarEntries(SettingsStore.Calendar profil if (OutlookItems != null) { log.Fine(OutlookItems.Count + " calendar items exist."); if (profile is null) - profile = Settings.Instance.ProfileInPlay(); + profile = Settings.Profile.InPlay(); OutlookItems.Sort("[Start]", Type.Missing); OutlookItems.IncludeRecurrences = false; @@ -947,7 +947,7 @@ private String getColour(String gColourId, String oColour) { public String GetCategoryColour(String gColourId, Boolean createMissingCategory = true) { OlCategoryColor? outlookColour = null; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (profile.ColourMaps.Count > 0) { KeyValuePair kvp = profile.ColourMaps.FirstOrDefault(cm => cm.Value == gColourId); if (kvp.Key != null) { diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCategories.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCategories.cs index a65ed231..41b5af4b 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCategories.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookCategories.cs @@ -116,7 +116,7 @@ public void Dispose() { public void Get(Outlook.Application oApp, Outlook.MAPIFolder calendar) { Outlook.Store store = null; try { - if (Settings.Instance.ProfileInPlay().OutlookService == OutlookOgcs.Calendar.Service.DefaultMailbox) + if (Settings.Profile.InPlay().OutlookService == OutlookOgcs.Calendar.Service.DefaultMailbox) this.categories = oApp.Session.Categories; else { try { diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs index 964a7bf8..7d78f47d 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookNew.cs @@ -49,7 +49,7 @@ public void Connect() { oNS = GetCurrentUser(oNS); - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (!profile.OutlookGalBlocked && currentUserName == "Unknown") { log.Info("Current username is \"Unknown\""); @@ -209,7 +209,7 @@ public NameSpace GetCurrentUser(NameSpace oNS) { Recipient currentUser = null; try { DateTime triggerOOMsecurity = DateTime.Now; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); try { currentUser = oNS.CurrentUser; if (!Forms.Main.Instance.IsHandleCreated && (DateTime.Now - triggerOOMsecurity).TotalSeconds > 1) { @@ -284,7 +284,7 @@ public NameSpace GetCurrentUser(NameSpace oNS) { private MAPIFolder getCalendarStore(NameSpace oNS) { MAPIFolder defaultCalendar = null; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (profile.OutlookService == OutlookOgcs.Calendar.Service.AlternativeMailbox && profile.MailboxName != "") { log.Debug("Finding Alternative Mailbox calendar folders"); Folders binFolders = null; @@ -428,7 +428,7 @@ private MAPIFolder getSharedCalendar(NameSpace oNS, String sharedURI, Boolean in private void getDefaultCalendar(NameSpace oNS, ref MAPIFolder defaultCalendar) { log.Debug("Finding default Mailbox calendar folders"); try { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); Boolean updateGUI = profile.Equals(Forms.Main.Instance.ActiveCalendarProfile); if (updateGUI) { Forms.Main.Instance.rbOutlookDefaultMB.CheckedChanged -= Forms.Main.Instance.rbOutlookDefaultMB_CheckedChanged; @@ -705,7 +705,7 @@ public void RefreshCategories() { Extensions.OutlookColourPicker outlookColours = new Extensions.OutlookColourPicker(); outlookColours.AddColourItems(); - if (Settings.Instance.ProfileInPlay().Equals(Forms.Main.Instance.ActiveCalendarProfile)) { + if (Settings.Profile.InPlay().Equals(Forms.Main.Instance.ActiveCalendarProfile)) { Forms.Main.Instance.ddOutlookColour = outlookColours; foreach (OutlookOgcs.Categories.ColourInfo cInfo in Forms.Main.Instance.ddOutlookColour.Items) { if (cInfo.OutlookCategory.ToString() == Forms.Main.Instance.ActiveCalendarProfile.SetEntriesColourValue && diff --git a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookOld.cs b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookOld.cs index ed8303bc..85d12d75 100644 --- a/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookOld.cs +++ b/src/OutlookGoogleCalendarSync/OutlookOgcs/OutlookOld.cs @@ -40,7 +40,7 @@ public void Connect() { log.Info("Exchange connection mode: " + exchangeConnectionMode.ToString()); oNS = GetCurrentUser(oNS); - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (!profile.OutlookGalBlocked && currentUserName == "Unknown") { log.Info("Current username is \"Unknown\""); @@ -178,7 +178,7 @@ public OlExchangeConnectionMode ExchangeConnectionMode() { private const String PR_IPM_WASTEBASKET_ENTRYID = "http://schemas.microsoft.com/mapi/proptag/0x35E30102"; public NameSpace GetCurrentUser(NameSpace oNS) { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); //We only need the current user details when syncing meeting attendees. //If GAL had previously been detected as blocked, let's always try one attempt to see if it's been opened up @@ -243,7 +243,7 @@ public NameSpace GetCurrentUser(NameSpace oNS) { private MAPIFolder getCalendarStore(NameSpace oNS) { MAPIFolder defaultCalendar = null; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (profile.OutlookService == OutlookOgcs.Calendar.Service.DefaultMailbox) { getDefaultCalendar(oNS, ref defaultCalendar); } @@ -283,7 +283,7 @@ private MAPIFolder getSharedCalendar(NameSpace oNS, String sharedURI) { private void getDefaultCalendar(NameSpace oNS, ref MAPIFolder defaultCalendar) { log.Debug("Finding default Mailbox calendar folders"); try { - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); Boolean updateGUI = profile.Equals(Forms.Main.Instance.ActiveCalendarProfile); if (updateGUI) { Forms.Main.Instance.rbOutlookDefaultMB.CheckedChanged -= Forms.Main.Instance.rbOutlookDefaultMB_CheckedChanged; @@ -395,7 +395,7 @@ public List FilterItems(Items outlookItems, String filter) { AppointmentItem ai = null; if (outlookItems[i] is AppointmentItem) { ai = outlookItems[i] as AppointmentItem; - SettingsStore.Calendar profile = Settings.Instance.ProfileInPlay(); + SettingsStore.Calendar profile = Settings.Profile.InPlay(); if (ai.IsRecurring && ai.Start.Date < profile.SyncStart && ai.End.Date < profile.SyncStart) o2003recurring.Add(outlookItems[i]); } diff --git a/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs b/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs index 8fae1d6b..4b637da8 100644 --- a/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs +++ b/src/OutlookGoogleCalendarSync/SettingsStore/Calendar.cs @@ -299,7 +299,7 @@ public void LogSettings() { public static SettingsStore.Calendar GetCalendarProfile(Object settingsStore) { if (settingsStore is SettingsStore.Calendar) return settingsStore as SettingsStore.Calendar; - else throw new ArgumentException("Expected calendar settings, received " + Settings.GetProfileType(settingsStore)); + else throw new ArgumentException("Expected calendar settings, received " + Settings.Profile.GetType(settingsStore)); } #region Override Methods diff --git a/src/OutlookGoogleCalendarSync/SettingsStore/Settings.cs b/src/OutlookGoogleCalendarSync/SettingsStore/Settings.cs index 81533e4e..6fc2dd6f 100644 --- a/src/OutlookGoogleCalendarSync/SettingsStore/Settings.cs +++ b/src/OutlookGoogleCalendarSync/SettingsStore/Settings.cs @@ -412,48 +412,61 @@ public static void configureLoggingLevel(string logLevel) { ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).RaiseConfigurationChanged(EventArgs.Empty); } - public enum ProfileType { - Calendar, - Global, - Unknown - } - public static ProfileType GetProfileType(Object settingsStore) { - switch (settingsStore.GetType().ToString()) { - case "OutlookGoogleCalendarSync.Settings": return ProfileType.Global; - case "OutlookGoogleCalendarSync.SettingsStore.Calendar": return ProfileType.Calendar; + /// + /// Deregister all profiles from Push Sync + /// + public void DeregisterAllForPushSync() { + foreach (SettingsStore.Calendar calendar in Settings.Instance.Calendars) { + calendar.DeregisterForPushSync(); } - log.Warn("Unknown profile type: " + settingsStore.GetType().ToString()); - return ProfileType.Unknown; } - public SettingsStore.Calendar ProfileInPlay() { - StackTrace stackTrace = new StackTrace(); - StackFrame[] stackFrames = stackTrace.GetFrames().Reverse().ToArray(); + public class Profile { + public enum Type { + Calendar, + Global, + Unknown + } + public static Type GetType(Object settingsStore) { + switch (settingsStore.GetType().ToString()) { + case "OutlookGoogleCalendarSync.Settings": return Type.Global; + case "OutlookGoogleCalendarSync.SettingsStore.Calendar": return Type.Calendar; + } + log.Warn("Unknown profile type: " + settingsStore.GetType().ToString()); + return Type.Unknown; + } - String[] FormMethods = new String[] { "updateGUIsettings", "UpdateGUIsettings_Profile", "b__0", "miCatRefresh_Click", "GetMyGoogleCalendars_Click", - "btColourMap_Click", "ColourPicker_Enter", "ddGoogleColour_SelectedIndexChanged" }; - String[] TimerMethods = new String[] { "OnTick" }; - - foreach (StackFrame frame in stackFrames) { - //log.Debug("Frame:" + frame.GetMethod().Name); - if (FormMethods.Contains(frame.GetMethod().Name)) - return Forms.Main.Instance.ActiveCalendarProfile; - else if (TimerMethods.Contains(frame.GetMethod().Name)) - return Sync.Engine.Calendar.Instance.Profile; + public static String Name(Object settingsStore) { + switch (GetType(settingsStore)) { + case Type.Calendar: return (settingsStore as SettingsStore.Calendar)._ProfileName; + } + return ""; } - String stackString = ""; - stackFrames.Reverse().ToList().ForEach(sf => stackString += sf.GetMethod().Name + " < "); - log.Warn(stackString); - log.Error("Unknown profile being referenced."); - return Forms.Main.Instance.ActiveCalendarProfile; - } - /// - /// Deregister all profiles from Push Sync - /// - public void DeregisterAllForPushSync() { - foreach(SettingsStore.Calendar calendar in Settings.Instance.Calendars) { - calendar.DeregisterForPushSync(); + /// + /// Dynamically determine which profile is being used. + /// + /// Currently hard-coded to a Calendar profile + public static SettingsStore.Calendar InPlay() { + StackTrace stackTrace = new StackTrace(); + StackFrame[] stackFrames = stackTrace.GetFrames().Reverse().ToArray(); + + String[] FormMethods = new String[] { "updateGUIsettings", "UpdateGUIsettings_Profile", "b__0", "miCatRefresh_Click", "GetMyGoogleCalendars_Click", + "btColourMap_Click", "ColourPicker_Enter", "ddGoogleColour_SelectedIndexChanged" }; + String[] TimerMethods = new String[] { "OnTick" }; + + foreach (StackFrame frame in stackFrames) { + //log.Debug("Frame:" + frame.GetMethod().Name); + if (FormMethods.Contains(frame.GetMethod().Name)) + return Forms.Main.Instance.ActiveCalendarProfile; + else if (TimerMethods.Contains(frame.GetMethod().Name)) + return Sync.Engine.Calendar.Instance.Profile; + } + String stackString = ""; + stackFrames.Reverse().ToList().ForEach(sf => stackString += sf.GetMethod().Name + " < "); + log.Warn(stackString); + log.Error("Unknown profile being referenced."); + return Forms.Main.Instance.ActiveCalendarProfile; } } } diff --git a/src/OutlookGoogleCalendarSync/Sync/Calendar.cs b/src/OutlookGoogleCalendarSync/Sync/Calendar.cs index e5c98c83..70cacd2c 100644 --- a/src/OutlookGoogleCalendarSync/Sync/Calendar.cs +++ b/src/OutlookGoogleCalendarSync/Sync/Calendar.cs @@ -83,20 +83,6 @@ public void StartSync(Boolean updateSyncSchedule = true) { this.Profile.OgcsTimer.NextSyncDateText = "In progress..."; - StringBuilder sb = new StringBuilder(); - Forms.Main.Instance.Console.BuildOutput("Sync version: " + System.Windows.Forms.Application.ProductVersion, ref sb); - Forms.Main.Instance.Console.BuildOutput("Profile: " + this.Profile._ProfileName, ref sb); - Forms.Main.Instance.Console.BuildOutput((Sync.Engine.Instance.ManualForceCompare ? "Full s" : "S") + "ync started at " + DateTime.Now.ToString(), ref sb); - Forms.Main.Instance.Console.BuildOutput("Syncing from " + this.Profile.SyncStart.ToShortDateString() + - " to " + this.Profile.SyncEnd.ToShortDateString(), ref sb); - mainFrm.Console.BuildOutput(this.Profile.SyncDirection.Name, ref sb); - - //Make the clock emoji show the right time - int minsPastHour = DateTime.Now.Minute; - minsPastHour = (int)minsPastHour - (minsPastHour % 30); - sb.Insert(0, ":clock" + DateTime.Now.ToString("hh").TrimStart('0') + (minsPastHour == 00 ? "" : "30") + ":"); - mainFrm.Console.Update(sb); - if (this.Profile.OutlookPush) this.Profile.DeregisterForPushSync(); Sync.Engine.SyncResult syncResult = Sync.Engine.SyncResult.Fail; @@ -110,10 +96,26 @@ public void StartSync(Boolean updateSyncSchedule = true) { log.Info("User opted to abandon further syncs."); syncResult = Sync.Engine.SyncResult.Abandon; break; - } else + } else { log.Info("User opted to retry sync straight away."); + mainFrm.Console.Clear(); + } } + StringBuilder sb = new StringBuilder(); + mainFrm.Console.BuildOutput("Sync version: " + System.Windows.Forms.Application.ProductVersion, ref sb); + mainFrm.Console.BuildOutput("Profile: " + this.Profile._ProfileName, ref sb); + mainFrm.Console.BuildOutput((Sync.Engine.Instance.ManualForceCompare ? "Full s" : "S") + "ync started at " + DateTime.Now.ToString(), ref sb); + mainFrm.Console.BuildOutput("Syncing from " + this.Profile.SyncStart.ToShortDateString() + + " to " + this.Profile.SyncEnd.ToShortDateString(), ref sb); + mainFrm.Console.BuildOutput(this.Profile.SyncDirection.Name, ref sb); + + //Make the clock emoji show the right time + int minsPastHour = DateTime.Now.Minute; + minsPastHour = (int)minsPastHour - (minsPastHour % 30); + sb.Insert(0, ":clock" + DateTime.Now.ToString("hh").TrimStart('0') + (minsPastHour == 00 ? "" : "30") + ":"); + mainFrm.Console.Update(sb); + //Kick off the sync in the background thread Sync.Engine.Instance.bwSync.DoWork += new DoWorkEventHandler( delegate (object o, DoWorkEventArgs args) { diff --git a/src/OutlookGoogleCalendarSync/Sync/Engine.cs b/src/OutlookGoogleCalendarSync/Sync/Engine.cs index 21dd4aa8..4029e57a 100644 --- a/src/OutlookGoogleCalendarSync/Sync/Engine.cs +++ b/src/OutlookGoogleCalendarSync/Sync/Engine.cs @@ -54,10 +54,17 @@ private void QueueTimer_Tick(object sender, EventArgs e) { Engine.Instance.Start(updateSyncSchedule: (job.RequestedBy == "AutoSyncTimer")); } + private Object activeProfile; /// /// The profile currently set to be synced, either manually from GUI settings or scheduled from a Timer. /// - public Object ActiveProfile; + public Object ActiveProfile { + get { return activeProfile; } + set { + activeProfile = value; + log.Debug("ActiveProfile set to: " + Settings.Profile.Name(activeProfile)); + } + } /// /// Get the earliest upcoming sync time @@ -103,15 +110,13 @@ public void Sync_Requested(object sender = null, EventArgs e = null) { Forms.Main.Instance.NotificationTray.UpdateItem("delayRemove", enabled: false); Timer aTimer = sender as Timer; Object timerProfile = null; - String profileName = ""; if (aTimer.Tag.ToString() == "PushTimer" && aTimer is PushSyncTimer) timerProfile = (aTimer as PushSyncTimer).owningProfile; else if (aTimer.Tag.ToString() == "AutoSyncTimer" && aTimer is SyncTimer) timerProfile = (aTimer as SyncTimer).owningProfile; - if (timerProfile is SettingsStore.Calendar) - profileName = (timerProfile as SettingsStore.Calendar)._ProfileName; + String profileName = Settings.Profile.Name(timerProfile); if (Sync.Engine.Instance.queue.Exists(q => q.ContainsKey(profileName))) log.Warn("Sync of profile '" + profileName + "' requested by " + aTimer.Tag.ToString() + " already previously queued."); @@ -175,7 +180,7 @@ public void AbortSync() { } private void Start(Boolean updateSyncSchedule = true) { - if (Settings.GetProfileType(this.ActiveProfile) == Settings.ProfileType.Calendar) { + if (Settings.Profile.GetType(this.ActiveProfile) == Settings.Profile.Type.Calendar) { Forms.Main.Instance.NotificationTray.ShowBubbleInfo("Autosyncing calendars: " + (this.ActiveProfile as SettingsStore.Calendar).SyncDirection.Name + "..."); Sync.Engine.Calendar.Instance.Profile = this.ActiveProfile as SettingsStore.Calendar; Sync.Engine.Calendar.Instance.StartSync(updateSyncSchedule); diff --git a/src/OutlookGoogleCalendarSync/Sync/Timer.cs b/src/OutlookGoogleCalendarSync/Sync/Timer.cs index b7c54831..741e444a 100644 --- a/src/OutlookGoogleCalendarSync/Sync/Timer.cs +++ b/src/OutlookGoogleCalendarSync/Sync/Timer.cs @@ -28,7 +28,7 @@ public String NextSyncDateText { set { nextSyncDateText = value; var profile = owningProfile as SettingsStore.Calendar; - if (Forms.Main.Instance.ProfileVal == profile._ProfileName) + if (profile.Equals(Forms.Main.Instance.ActiveCalendarProfile)) Forms.Main.Instance.NextSyncVal = value; } } @@ -48,7 +48,7 @@ public SyncTimer(Object owningProfile) { private void ogcsTimer_Tick(object sender, EventArgs e) { if (Forms.ErrorReporting.Instance.Visible) return; - log.Debug("Scheduled sync triggered."); + log.Debug("Scheduled sync triggered for profile: "+ Settings.Profile.Name(this.owningProfile)); if (!Sync.Engine.Instance.SyncingNow) { Forms.Main.Instance.Sync_Click(sender, null); @@ -87,7 +87,7 @@ public void SetNextSync(int delayMins, Boolean fromNow = false, Boolean calculat this.nextSyncDate = fromNow ? now.AddMinutes(delayMins) : this.LastSyncDate.AddMinutes(delayMins); if (calculateInterval) CalculateInterval(); else this.NextSyncDate = this.nextSyncDate; - log.Info("Next sync scheduled for " + this.NextSyncDateText); + log.Info("Next sync scheduled for profile '"+ Settings.Profile.Name(owningProfile) +"' at " + this.NextSyncDateText); } else { this.NextSyncDateText = "Inactive"; Activate(false); diff --git a/src/OutlookGoogleCalendarSync/XMLManager.cs b/src/OutlookGoogleCalendarSync/XMLManager.cs index 4ccc2260..17d190f8 100644 --- a/src/OutlookGoogleCalendarSync/XMLManager.cs +++ b/src/OutlookGoogleCalendarSync/XMLManager.cs @@ -124,11 +124,11 @@ public static void ExportElement(Object settingStore, String nodeName, object no XElement xe = null; XElement xeProfile = null; try { - if (Settings.GetProfileType(settingStore) == Settings.ProfileType.Calendar) { + if (Settings.Profile.GetType(settingStore) == Settings.Profile.Type.Calendar) { //It's a Calendar setting SettingsStore.Calendar calSettings = settingStore as SettingsStore.Calendar; XElement xeCalendars = settingsXE.Elements(ns + "Calendars").First(); - List xeCalendar = xeCalendars.Elements(ns + Settings.ProfileType.Calendar.ToString()).ToList(); + List xeCalendar = xeCalendars.Elements(ns + Settings.Profile.Type.Calendar.ToString()).ToList(); xeProfile = xeCalendar.First(c => c.Element(ns + "_ProfileName").Value == calSettings._ProfileName); xe = xeProfile.Elements(ns + nodeName).First(); } else if (settingStore is Settings) {