public void SignOut()
        {
            ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageManager.SignOut.");
            InstantMessageProvider instantMessageProvider = Interlocked.Exchange <InstantMessageProvider>(ref this.provider, null);

            if (instantMessageProvider != null)
            {
                if (this.notifier != null)
                {
                    InstantMessagePayloadUtilities.GenerateUnavailablePayload(this.notifier, null, "Signed out manually.", InstantMessageServiceError.ClientSignOut, false);
                }
                instantMessageProvider.Dispose();
            }
        }
        public void TerminateProvider(string reason)
        {
            ExTraceGlobals.InstantMessagingTracer.TraceDebug((long)this.GetHashCode(), "InstantMessageManager.TerminateProvider.");
            InstantMessageProvider instantMessageProvider = Interlocked.Exchange <InstantMessageProvider>(ref this.provider, null);

            if (instantMessageProvider != null)
            {
                if (this.notifier != null)
                {
                    InstantMessagePayloadUtilities.GenerateUnavailablePayload(this.notifier, null, "Disconnected from IM by server due to timeout: " + reason, InstantMessageServiceError.ServerTimeout, false);
                }
                instantMessageProvider.Dispose();
            }
        }