コード例 #1
0
ファイル: ModalDialog.cs プロジェクト: seemantr/mkdp
 private void ImgurUpload_ImgurUploadError(object sender, ImgurUploadErrorEventArgs e)
 {
     ModalDialog._logger.Trace("Imgur upload error event fired");
     if (this.TextBox_URL.Dispatcher.CheckAccess())
     {
         this.ProcessImgurError(e);
         return;
     }
     this.TextBox_URL.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, delegate
     {
         this.ProcessImgurError(e);
     });
 }
コード例 #2
0
ファイル: ModalDialog.cs プロジェクト: seemantr/mkdp
        private void ProcessImgurError(ImgurUploadErrorEventArgs e)
        {
            this.ToggleBusyIndicator(false);
            if (e.Exception != null && e.Exception.GetType() == typeof(RestResponseException))
            {
                RestResponseException ex = e.Exception as RestResponseException;
                ModalDialog._logger.ErrorException("Processing Imgur error exception", ex);
                string str = string.Empty;
                if (ex.Response == null)
                {
                    str = ex.Message;
                }
                else
                {
                    if (ex.Response.ErrorException != null)
                    {
                        str = ex.Response.ErrorMessage;
                    }
                    else
                    {
                        JsonDeserializer     jsonDeserializer     = new JsonDeserializer();
                        MashapeErrorResponse mashapeErrorResponse = jsonDeserializer.Deserialize <MashapeErrorResponse>(ex.Response);
                        str = mashapeErrorResponse.Message;
                    }
                }
                string message         = LocalizationProvider.GetLocalizedString("Error_UploadingImageToImgurMessage", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + str;
                string localizedString = LocalizationProvider.GetLocalizedString("Error_UploadingImageToImgur", false, "MarkdownPadStrings");
                MessageBoxHelper.ShowWarningMessageBox(message, localizedString);
                return;
            }
            System.Exception exception        = e.Exception;
            string           localizedString2 = LocalizationProvider.GetLocalizedString("Error_UploadingImageToImgurMessage", false, "MarkdownPadStrings");
            string           localizedString3 = LocalizationProvider.GetLocalizedString("Error_UploadingImageToImgur", false, "MarkdownPadStrings");

            MessageBoxHelper.ShowErrorMessageBox(localizedString2, localizedString3, exception, "");
        }