public void DoneWithUploadResponse() { if (this.InvokeRequired) { ResponseDoneDelegate del = new ResponseDoneDelegate(DoneWithUploadResponse); this.Invoke(del); } else { progressbar.Value = 0; status_display.Text = "Ready"; progressbar.Style = ProgressBarStyle.Continuous; // This can be false now that the upload is completed. this.shouldForceClose = false; //string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //StringBuilder sb = new StringBuilder(); //sb.Append(this.state.response); //using (StreamWriter outfile = new StreamWriter(mydocpath + @"\result.txt")) //{ // outfile.Write(sb.ToString()); //} XmlDocument response_document = new XmlDocument(); response_document.LoadXml(this.state.response); XmlElement status = (XmlElement)response_document.SelectSingleNode("//div[@name='status']"); if (status == null) { string message = "There was a server error submitting your file.\n\rPress Ok to try again, Cancel to quit."; DialogResult choice = MessageBox.Show(message, "Upload Problem", MessageBoxButtons.OKCancel); if (choice == System.Windows.Forms.DialogResult.Cancel) { forceClose(); return; } else { return; } } if (status.GetAttribute("title").Equals("0")) { MessageBox.Show("Upload succeeded"); forceClose(); return; } else { string message = "The error \"{0}\" was returned when you attempted to submit your podcast.\n\rPress Ok to try again, Cancel to quit."; DialogResult choice = MessageBox.Show(String.Format(message, status.FirstChild.Value), "Upload Problem", MessageBoxButtons.OKCancel); if (choice == System.Windows.Forms.DialogResult.Cancel) { forceClose(); return; } else { return; } } } }
public void DoneWithUploadResponse() { if (this.InvokeRequired) { ResponseDoneDelegate del = new ResponseDoneDelegate(DoneWithUploadResponse); this.Invoke(del); } else { progressbar.Value = 0; status_display.Text = "Ready"; progressbar.Style = ProgressBarStyle.Continuous; // This can be false now that the upload is completed. this.shouldForceClose = false; //string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //StringBuilder sb = new StringBuilder(); //sb.Append(this.state.response); //using (StreamWriter outfile = new StreamWriter(mydocpath + @"\result.txt")) //{ // outfile.Write(sb.ToString()); //} XmlDocument response_document = new XmlDocument(); response_document.LoadXml(this.state.response); XmlElement status = (XmlElement)response_document.SelectSingleNode("//div[@name='status']"); if (status == null) { string message = "There was a server error submitting your file.\n\rPress Ok to try again, Cancel to quit."; DialogResult choice = MessageBox.Show(message, "Upload Problem", MessageBoxButtons.OKCancel); if (choice == System.Windows.Forms.DialogResult.Cancel) { forceClose(); return; } else { return; } } if (status.GetAttribute("title").Equals("0")) { MessageBox.Show("Upload succeeded"); forceClose(); return; } else { string message = "The error \"{0}\" was returned when you attempted to submit your podcast.\n\rPress Ok to try again, Cancel to quit."; DialogResult choice = MessageBox.Show(String.Format(message, status.FirstChild.Value), "Upload Problem", MessageBoxButtons.OKCancel); if (choice == System.Windows.Forms.DialogResult.Cancel) { forceClose(); return; } else { return; } } } }