IT tutorials
 
Windows
 

Using the Windows Azure Service Bus with SharePoint (part 5) - Create a Test Windows Forms Application

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
11/21/2012 9:36:48 AM

Create a Test Windows Forms Application

  1. Return to the Visual Studio solution, right-click the solution, and select Add | New Project.

  2. Select Windows Forms Application from the Windows templates, provide a name (such as SalesTestApp), and click OK.

  3. Create a simple UI that includes two buttons and a datagrid, as shown in the following graphic. Name the buttons btnGetSales (set this button’s Text property to Get Sales) and btnExit (set this button’s Text property to Exit). Change the Name property of the datagrid to datagrdSales.

    image with no caption
  4. Double-click both buttons to create events in the code-behind file.

  5. Right-click Add Service Reference, and paste in the WCF service URI you deployed to Windows Azure. Click Go to retrieve the service definition, and then provide a name for the service namespace (such as AzureDeployedService). Next, edit the code-behind in the Windows application to match the bold code here:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using SalesTestApp.AzureDeployedService;
    
    namespace SalesTestApp
    {
        public partial class Form1 : Form
        {
            SharePointCallingServiceClient proxy = new SharePointCallingServiceClient();
            public Form1()
    
            {
                InitializeComponent();
            }
            private void btnGetSales_Click(object sender, EventArgs e)
            {
                var items = proxy.GetSales();
                datagrdSales.DataSource = items;
            }
    
            private void btnExit_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
        }
    }
  6. To begin the test, launch the on-premises service by right-clicking it and selecting Debug, | Start New Instance. This starts the listener service (that is, the on-premises service).

  7. Next, right-click the Windows Forms application, and then select Debug | Start New Instance.

You should now have two applications running in debug mode: the on-premises service and your Windows test application. If you click the Get Sales button in your test application, you’ll see a status message appear in the console application as shown in Figure 9. (In the figure, I’ve clicked the Get Sales button twice.) The service writes this message to the console each time the WCF service deployed to Windows Azure calls it.

The listener service running and showing that the GetSalesData method has been called.

Figure 9. The listener service running and showing that the GetSalesData method has been called.

When the service receives the call, it should successfully execute the SharePoint code that pulls the data from the Sales list and populates the datagrid with the returned data. 

The Windows Forms application loading returned data from SharePoint.

Figure 10. The Windows Forms application loading returned data from SharePoint.

Testing with a Windows Forms application is one thing—you’re on-premises and probably coding against the same server where SharePoint is deployed. So you might not necessarily be impressed just yet. However, next you’ll take it one level further and build a remote application that leverages the Windows Azure WCF service to call into the SharePoint site. In this next exercise, you’ll build a Windows Phone 7 application that uses the service bus to get the on-premises data from the SharePoint list and expose it on the phone emulator.

Because much of the Windows Phone 7 development is done on a client machine, you might need to work on a separate Windows 7 machine. Setting up your development environment for Windows Phone 7 development is amazingly easy; just download the tools and free Express version of Visual Studio from http://www.microsoft.com/express/phone/, and you’re up and running.

 
Others
 
- Using the Windows Azure Service Bus with SharePoint (part 4) - Create a WCF Service to Call the On-Premises Service
- Using the Windows Azure Service Bus with SharePoint (part 3) - Create an On-Premises Service
- Using the Windows Azure Service Bus with SharePoint (part 2) - Create the Listener Service
- Using the Windows Azure Service Bus with SharePoint (part 1) - Create a Service Bus Namespace
- Windows 8 : Working with User Accounts (part 3) - Switching Users
- Windows 8 : Working with User Accounts (part 2) - Changing User Account Settings
- Windows 8 : Working with User Accounts (part 1) - Add a User
- Mac OS X Hints
- Securing Your Windows 8 Computer : Maintaining Your Privacy
- Securing Your Windows 8 Computer : Switching to a Local Account
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us