More changes for the PleaseWaitForm, rewrote the jira plug-in to use it. Added some more comments to the code. Fixed the context menu, added a separator for the plug-in entries. Fixed an issue with the PickerDestination, when an export is canceled the menu was shown visible in the task-bar.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1986 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-08-13 14:17:12 +00:00
commit 431b31cc5e
10 changed files with 130 additions and 77 deletions

View file

@ -113,17 +113,19 @@ namespace GreenshotJiraPlugin {
// COPY stream to buffer
buffer = stream.ToArray();
}
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait));
try {
jiraPlugin.JiraConnector.addAttachment(jira.Key, filename, buffer);
// Run upload in the background
new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait),
delegate() {
jiraPlugin.JiraConnector.addAttachment(jira.Key, filename, buffer);
}
);
LOG.Debug("Uploaded to Jira.");
backgroundForm.CloseDialog();
surface.UploadURL = jiraPlugin.JiraConnector.getURL(jira.Key);
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", FormatUpload(jira)));
surface.Modified = false;
return true;
} catch (Exception e) {
backgroundForm.CloseDialog();
MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message);
}
} else {
@ -140,17 +142,19 @@ namespace GreenshotJiraPlugin {
// COPY stream to buffer
buffer = stream.ToArray();
}
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait));
try {
jiraForm.upload(buffer);
// Run upload in the background
new PleaseWaitForm().ShowAndWait(Description, Language.GetString("jira", LangKey.communication_wait),
delegate() {
jiraForm.upload(buffer);
}
);
LOG.Debug("Uploaded to Jira.");
backgroundForm.CloseDialog();
surface.UploadURL = jiraPlugin.JiraConnector.getURL(jiraForm.getJiraIssue().Key);
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", FormatUpload(jiraForm.getJiraIssue())));
surface.Modified = false;
return true;
} catch(Exception e) {
backgroundForm.CloseDialog();
MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message);
}
}