/// <summary> /// Uploads an application to the online database (as background thread). /// </summary> /// <param name="argument">The ApplicationJob which is to be uploaded</param> private static void ShareOnline(object argument) { ApplicationJob job = argument as ApplicationJob; if (job == null) { return; } try { IKetarinRpc proxy = XmlRpcProxyGen.Create <IKetarinRpc>(); proxy.Timeout = 10000; proxy.SaveApplication(job.GetXmlWithoutGlobalVariables(), Settings.GetValue("AuthorGuid") as string); } catch (XmlRpcFaultException ex) { LogDialog.Log("Could not submit '" + job.Name + "' to the online database: " + ex.FaultString); } catch (Exception) { // No internet, server down, whatever. We don't have to care. } }
/// <summary> /// Automatically fills the application name text box based on the /// FileHippo ID (to be used as background procress). /// </summary> private void AutoFillApplicationName(object fileHippoId) { string appName = string.Empty; try { appName = ExternalServices.FileHippoAppName(fileHippoId as string); if (string.IsNullOrEmpty(appName)) { return; } } catch (Exception ex) { // Ignore any errors, since optional process in background LogDialog.Log("FileHippo application name could not be determined", ex); return; } finally { // Make sure that form does still exist if (Visible) { this.BeginInvoke((MethodInvoker) delegate() { // Reset cursor Cursor = Cursors.Default; // Only fill the application name if it is still empty if (string.IsNullOrEmpty(txtApplicationName.Text)) { txtApplicationName.Text = appName; } }); } } }
private void bLoad_Click(object sender, EventArgs e) { // Load URL contents and show a wait cursor in the meantime Cursor = Cursors.WaitCursor; try { using (WebClient client = new WebClient(this.UserAgent)) { string expandedUrl = null; string postData = null; // Note: The Text property might modify the text value using (ProgressDialog dialog = new ProgressDialog("Loading URL", "Please wait while the content is being downloaded...")) { dialog.OnDoWork = delegate { expandedUrl = CurrentVariable.ExpandedUrl; if (dialog.Cancelled) { return(false); } client.SetPostData(CurrentVariable); postData = client.PostData; CurrentVariable.TempContent = client.DownloadString(new Uri(expandedUrl)); return(true); }; dialog.OnCancel = delegate { dialog.Cancel(); }; dialog.ShowDialog(this); // Did an error occur? if (!dialog.Cancelled && dialog.Error != null) { LogDialog.Log("Failed loading URL", dialog.Error); // Check whether or not the URL is valid and show an error message if necessary if (dialog.Error is ArgumentNullException || string.IsNullOrEmpty(expandedUrl)) { MessageBox.Show(this, "The URL you entered is empty and cannot be loaded.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (dialog.Error is UriFormatException) { MessageBox.Show(this, "The specified URL '" + expandedUrl + "' is not valid.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(this, "The contents of the URL can not be loaded: " + dialog.Error.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } rtfContent.Text = CurrentVariable.TempContent; // For Regex: Go to match after thread finish this.gotoMatch = true; UpdateRegexMatches(); // For Start/End: Go to match now RefreshRtfFormatting(); this.GoToMatch(); // Show page preview if desired if (cmnuBrowser.Checked) { PreviewDialog.ShowPreview(this, expandedUrl, postData); } } } catch (Exception ex) { MessageBox.Show(this, "An error occured when loading the URL: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor = Cursors.Default; } }
private LogDialog() { this.InitializeComponent(); m_Instance = this; this.txtLog.ContextMenu = this.contextMenu; }
private LogDialog() { InitializeComponent(); m_Instance = this; }