Today, in this article let's learn another new and interesting concept related to Windows Phone 7, whereby communicating with WCF Service to perform some operation.
The Telerik Rad Controls for Windows Phone 7 can be downloaded from http://www.telerik.com/products/windows-phone.aspx.
Question: What is RadWindow?
In simple terms "It provides flexibility for the user to access the information or perform some operation using smooth and slicker UI window".
Let's get this implemented practically for a better idea of this!!!
Step 1: The complete code of the IService1.cs looks like this:
using System; namespace WCF_Rad_Window [OperationContract] [OperationContract] [OperationContract] |
Step 2: The complete code of the Service1.svc.cs looks like this:
using System; namespace WCF_Rad_Window public double sub(double a, double b) public double mul(double a, double b) public double div(double a, double b) |
Step 3: The complete code of the Web.Config looks like this:
<?xml version="1.0"?> <configuration> <system.web> </configuration> |
Step 4: The complete code of the MainPage.xaml looks like this:
|
<phone:PhoneApplicationPage <!--LayoutRoot is the root grid where all page content is placed--> <Grid.RowDefinitions> <!--TitlePanel contains the name of the application and page title--> <!--ContentPanel - place additional content here--> <TextBlock Height="30" <TextBox Height="72" <TextBox Height="72" <TextBlock FontFamily="Verdana" <Button Content="Addition" <Button Content="Subtraction" <Button Content="Multiplication" <Button Content="Division" <telerik:RadWindow x:Name="radWindow1" <Border BorderThickness="4" BorderBrush="Black"> <TextBlock x:Name="txtBlockResult" <Button x:Name="btnClose" </Grid> |
Step 5: The complete code of the MainPage.xaml.cs looks like this:
|
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using RadWindow_Application_WP7.ServiceReference1; namespace RadWindow_Application_WP7 private void btnClose_Click(object sender, RoutedEventArgs e) private void add_Call(object sender, addCompletedEventArgs e) private void button1_Click(object sender, RoutedEventArgs e) } private void sub_Call(object sender, subCompletedEventArgs e) private void button2_Click(object sender, RoutedEventArgs e) } private void mul_Call(object sender, mulCompletedEventArgs e) private void button3_Click(object sender, RoutedEventArgs e) objClient.mulCompleted += new EventHandler<mulCompletedEventArgs>(mul_Call); } private void div_Call(object sender, divCompletedEventArgs e) private void button4_Click(object sender, RoutedEventArgs e) objClient.divCompleted += new EventHandler<divCompletedEventArgs>(div_Call); } #region |
Step 6: The output of the application looks like this:

Step 7: The output of the Nothing Entered Application looks like this:

Step 8: The output of the Addition Operation Application looks like this:


Step 9: The output of the Multiplication Operation Application looks like this:


I hope this article is useful for you.

Arjun PanwarPosted Mar 14, 2012, 11:57 PM
Really such a very nice explanation, good work.