public void CloseWindow() { if (notificationServiceClient != null) { try { if (notificationServiceClient.State != CommunicationState.Faulted) { notificationServiceClient.Unsubscribe(userId); notificationServiceClient.Close(); } } catch { notificationServiceClient.Abort(); } } }