/// <summary> /// Removes the SearchProviders enumerator whose sync is not succeeded and /// Adds the Expert SearchProvider if its sync is succeeded. If the sync for /// Expert search provider is not succeeded then disables the ExpertSearch control /// and chcekbox. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void contactMgr_SearchProviderStateChanged(object sender, SearchProviderStateChangedEventArgs e) { if (e.NewStatus != SearchProviderStatusType.SyncSucceeded) { // Remove the SearchProviders enumerator to the // local application cache declared previously. activeSearchProviders.Remove(e.Provider); } if (e.Provider == SearchProviders.Expert && (e.NewStatus == SearchProviderStatusType.SyncSucceeded || e.NewStatus == SearchProviderStatusType.SyncSucceededForExternalOnly || e.NewStatus == SearchProviderStatusType.SyncSucceededForInternalOnly)) { activeSearchProviders.Add(SearchProviders.Expert); //Invoke delegate to update a property of control owned by UI thread from this Lync platform thread this.Invoke(new ControlEnablerDelegate(ControlEnabler), new object[] { ExpertSearch, true }); } //If the provider status is Expert and ALL of the enumerators in the if test return false then //disable the Expert search provider radio check box if (e.Provider == SearchProviders.Expert && (e.NewStatus != SearchProviderStatusType.SyncSucceeded && e.NewStatus != SearchProviderStatusType.SyncSucceededForExternalOnly && e.NewStatus != SearchProviderStatusType.SyncSucceededForInternalOnly)) { activeSearchProviders.Remove(SearchProviders.Expert); //Invoke delegates to update a property of controls owned by UI thread from this Lync platform thread //to avoid cross-thread exception raised on UI thread when it complains that properties are being updated //from a thread that does not “own” the control. this.Invoke(new ControlEnablerDelegate(ControlEnabler), new object[] { ExpertSearch, false }); this.Invoke(new RadioEnablerDelegate(RadioEnabler), new object[] { ExpertSearch, false }); } }
private void ContactManagerSearchProviderStateChanged(object sender, SearchProviderStateChangedEventArgs e) { if (e.NewStatus != SearchProviderStatusType.SyncSucceeded) { // Remove the SearchProviders enumerator to the local application cache declared previously activeSearchProviders.Remove(e.Provider); } // TODO: check which providers we will need. Do we need an external provider? if (e.Provider == SearchProviders.Expert) { this.expertSearchEnabled = e.NewStatus == SearchProviderStatusType.SyncSucceeded || e.NewStatus == SearchProviderStatusType.SyncSucceededForExternalOnly || e.NewStatus == SearchProviderStatusType.SyncSucceededForInternalOnly; if (this.expertSearchEnabled) { if (!this.activeSearchProviders.Contains(SearchProviders.Expert)) this.activeSearchProviders.Add(SearchProviders.Expert); } else { if (this.activeSearchProviders.Contains(SearchProviders.Expert)) this.activeSearchProviders.Remove(SearchProviders.Expert); } } }