Esempio n. 1
0
        private async void Calcul_Click(object sender, EventArgs e)
        {
            Resultat_TextBox.ResetText();
            int    n      = 0;
            string result = "";

            if (!Int32.TryParse(FiboNumber.Text, out n))
            {
                MessageBox.Show("Erreur : Veuillez renseigner une valeur numérique");
                return;
            }
            BusyForm frm = new BusyForm();

            ServiceFiboXml.ServiceSoapClient client = new ServiceFiboXml.ServiceSoapClient();

            await Task.Run(new Action(() =>
            {
                this.BeginInvoke(new Action(() =>
                {
                    frm.ShowDialog();
                }));

                result = client.Fibonacci(n).ToString();
            }
                                      )).ContinueWith(new Action <Task>(task =>
            {
                frm.Close();
            }), TaskScheduler.FromCurrentSynchronizationContext());

            Resultat_TextBox.Text = result;
            MessageBox.Show(result);
        }
Esempio n. 2
0
        private async void Convert_Button_Click(object sender, EventArgs e)
        {
            string   result = "";
            BusyForm frm    = new BusyForm();

            ServiceFiboXml.ServiceSoapClient client = new ServiceFiboXml.ServiceSoapClient();

            await Task.Run(new Action(() =>
            {
                this.BeginInvoke(new Action(() =>
                {
                    frm.ShowDialog();
                }));

                result = client.XmlToJson(Xml_TextBox.Text);
            }
                                      )).ContinueWith(new Action <Task>(task =>
            {
                frm.Close();
            }), TaskScheduler.FromCurrentSynchronizationContext());

            Json_TextBox.Text = result;
            MessageBox.Show(result);
        }