コード例 #1
0
        private void btnAgeCalculate_Click(object sender, RoutedEventArgs e)
        {
            if (txtday != null && txtMonth != null && txtYear != null && txtday.Text.Length > 0 && txtMonth.Text.Length > 0 && txtYear.Text.Length > 0)
            {
                int day, Month, Year, TotalDays;
                HelloService.HelloServiceClient helloServiceClient = new HelloService.HelloServiceClient("NetTcpBinding_IHelloService");//creating the object of WCF service client

                day   = int.Parse(txtday.Text);
                Month = int.Parse(txtMonth.Text);
                Year  = int.Parse(txtYear.Text);

                TotalDays = helloServiceClient.calculateDays(day, Month, Year); //assigning the output value from service Response

                MessageBox.Show("You are Currently " + Convert.ToString(TotalDays) + " days old", "Response From the Server", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("PLease Enter all the Fields", "Alerts..", MessageBoxButton.OK, MessageBoxImage.Warning);
                //FieldsFocus();
            }
        }
コード例 #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     HelloService.HelloServiceClient helloServiceClient = new HelloService.HelloServiceClient("NetTcpBinding_IHelloService");
     //lblname.Content = helloServiceClient.GetMessage(txtName.Text);
     MessageBox.Show(helloServiceClient.GetMessage(txtName.Text), "Message From Server", MessageBoxButton.OK, MessageBoxImage.Information);
 }