示例#1
0
 private void GetCounters()
 {
     using (localhost.CountersServiceClient proxy = new CountersClient.localhost.CountersServiceClient())
     {
         this.bindingSource1.DataSource = proxy.GetCounters();
     }
 }
示例#2
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                using (localhost.CountersServiceClient proxy = new CountersClient.localhost.CountersServiceClient())
                {
                    proxy.ResetCounters();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            GetCounters();
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (localhost.CountersServiceClient proxy = new CountersClient.localhost.CountersServiceClient())
                    {
                        proxy.SetCounter1(int.Parse(this.txtCounter.Text));
                        proxy.SetCounter2(int.Parse(this.txtCounter.Text));
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            GetCounters();
        }