示例#1
0
 private void XmlToJsonButton_Click(object sender, EventArgs e)
 {
     if (xmlValid)
     {
         Form waitForm = new WaitForm(this);
         waitForm.Show(this);
         string      xmlToSend      = xml?.Replace("<", "&lt;");
         string      body           = @"<XmlToJson xmlns=""http://chanhduong.org/""><xml>" + xmlToSend + "</xml></XmlToJson>";
         SoapService soapService    = new SoapService(ChanhDuongURL);
         string      textMessage    = "";
         string      captionMessage = "";
         try
         {
             soapService.SendRequest(body).Wait();
             XmlToJsonResponse result = (XmlToJsonResponse)SerializerSoapXml.Deserialize(typeof(XmlToJsonResponse), soapService.response);
             textMessage    = result.XmlToJsonResult;
             captionMessage = "Json";
         }
         catch (Exception ex)
         {
             textMessage    = ex.Message;
             captionMessage = "Error";
         }
         finally
         {
             waitForm.Close();
             MessageBox.Show(textMessage, captionMessage, MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("Xml is blank!", "Info", MessageBoxButtons.OK);
     }
 }
示例#2
0
        private void LoadingProcessEx(object parent)
        {
            Form Cparent = parent as Form;

            loadingForm = new WaitForm(Cparent);
            loadingForm.ShowDialog();
        }
示例#3
0
 private void FibonacciButton_Click(object sender, EventArgs e)
 {
     if (fibonacciValid)
     {
         Form waitForm = new WaitForm(this);
         waitForm.Show(this);
         string      body           = @"<Fibonacci xmlns=""http://chanhduong.org/""><n>" + n + "</n></Fibonacci>";
         SoapService soapService    = new SoapService(ChanhDuongURL);
         string      textMessage    = "";
         string      captionMessage = "";
         try
         {
             soapService.SendRequest(body).Wait();
             FibonacciResponse result = (FibonacciResponse)SerializerSoapXml.Deserialize(typeof(FibonacciResponse), soapService.response);
             textMessage    = result.FibonacciResult;
             captionMessage = "Fibonacci of " + n;
         }
         catch (Exception ex)
         {
             textMessage    = ex.Message;
             captionMessage = "Error";
         }
         finally
         {
             waitForm.Close();
             MessageBox.Show(textMessage, captionMessage, MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("N is blank!", "Info", MessageBoxButtons.OK);
     }
 }
示例#4
0
 public new void Close()
 {
     if (loadingForm != null)
     {
         loadingForm.BeginInvoke(new ThreadStart(loadingForm.CloseLoadingForm));
         loadingForm = null;
         loadthread  = null;
     }
 }