/// <summary>
        /// create system state notification
        /// </summary>
        /// <param name="diagnosticResult"></param>
        /// <param name="errorTitle"></param>
        /// <param name="e"></param>
        private void SetSystemState(NotificationCategory notificationCategory, DiagnosticResult diagnosticResult, string errorTitle, NotificationEventArgs e)
        {
            try
            {
                NotificationCategory category = notificationCategory;
                string errorMessage = null;
                Dispatch(() =>
                {
                    if ((category != NotificationCategory.SystemError_KeyProviderServiceError && category != NotificationCategory.SystemError_DatePolling) || diagnosticResult.Exception == null)
                        errorMessage = diagnosticResult.Exception == null ? ResourcesOfR6.Notification_UnknowMessage : diagnosticResult.Exception.ToString();

                    if (diagnosticResult.DiagnosticResultType == DiagnosticResultType.Error)
                        e.Push(new Notification(category,
                            errorTitle,
                            string.IsNullOrEmpty(errorMessage) ? null : typeof(SystemStateNotificationView), null, errorTitle, errorMessage));
                    else
                        e.Pop(category);
                });

            }
            catch (Exception ex)
            {
                MessageLogger.LogSystemError(MessageLogger.GetMethodName(), ex.GetTraceText());
            }
        }
Exemple #2
0
 private DiagnosticResult DiagnosticConnectionState(Action action)
 {
     DiagnosticResult diagnosticResult = new DiagnosticResult();
     try
     {
         action();
         diagnosticResult.DiagnosticResultType = DiagnosticResultType.Ok;
     }
     catch (Exception ex)
     {
         diagnosticResult.DiagnosticResultType = DiagnosticResultType.Error;
         diagnosticResult.Exception = ex;
     }
     return diagnosticResult;
 }
 /// <summary>
 ///test Internal web service
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CheckInternalSystemState(object sender, NotificationEventArgs e)
 {
     string errorMessage = string.Empty;
     internalDiagnosticResult = configProxy.TestInternalConnection();
     SetSystemState(NotificationCategory.SystemError_Internal, internalDiagnosticResult, ResourcesOfR6.Notification_InternalErrorMessage, e);
 }