public Synchronizer(ref LastStatistic lastStatistic) { gp = GoogleProvider.GetProvider; op = OutlookProvider.Instance; syncinfo = new SyncInfo(MaxSteps); ouContacts = new Hashtable(); goContacts = new Hashtable(); _lastStatistic = lastStatistic; LoggerProvider.Instance.Logger.Debug("Synchronizer class created"); }
/// <summary> /// Remove synchronize keys from Outlook contact. In same delete all cache data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOutlokSync_Click(object sender, EventArgs e) { LoggerProvider.Instance.Logger.Info("User request for clear synchronize keys in Outlook. I remove all cache data for Google and Outlook."); Utils.RemoveCacheFile(false); Utils.RemoveCacheFile(true); pBar.Value = 1; pBar.Update(); pBar.Refresh(); OutlookProvider op = OutlookProvider.Instance; Outlook.Items it = op.OutlookItems(); int _ouMaxContacts = op.CountContact(); object works = null; Outlook.ContactItem oci = null; int counter = 0; for (int i = 0; i < _ouMaxContacts; i++) { pBar.Value = counter; pBar.PerformStep(); pBar.Refresh(); if (counter > pBar.Maximum) { counter = 0; } if (i == 0) { works = it.GetFirst(); } else { works = it.GetNext(); } if (works is Outlook.DistListItem) { continue; } oci = works as Outlook.ContactItem; if (works == null) { continue; } if (!string.IsNullOrEmpty(oci.User3)) { oci.User3 = string.Empty; oci.Save(); } } }