Headline

Web programming in C# with Silverlight

Motivation

The implementation illustrates the development of a client-side user interface accessible via web browser. We used Technology:Silverlight in combination with the Technology:Navigation framework navigation to create an MVC based implementation. The web application is tied to a web service, which is implemented in Contribution:wcf. An advantage of Silverlight is the out-of-the-box back button support.

Illustration

There have to be proxy DTOs enabling the client to receive the serialized data from the web service. These proxies are generated from a Language:WSDL file. The namespace for the generated classes is

Invalid Language supplied
. These proxies are Language:CSharp classes located in References/CompanyServiceReference/Reference.cs:

namespace silverlight.CompanyServiceReference {
	using System.Runtime.Serialization;    

	// The class "CompanyDto" is the proxy DTO for serialized company data.
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
	[System.Runtime.Serialization.DataContractAttribute(Name="CompanyDto", Namespace="http://schemas.datacontract.org/2004/07/wcf.Dto")]
	public partial class CompanyDto : object, System.ComponentModel.INotifyPropertyChanged {

		...

	}

	...

	// The connection point to the company service provided by the wcf implementation.
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
	public partial class CompanyServiceClient : System.ServiceModel.ClientBase<silverlight.CompanyServiceReference.ICompanyService>, silverlight.CompanyServiceReference.ICompanyService {

		...

	}

	...

}

GUI

The proxy in combination with the

Invalid Language supplied
allows us to create an asynchronous communication asynchronous request.

Invalid Language supplied

The illustrated code creates a service client and waits, until the company data are completely delivered to the client. The result is a DTO, which is stored in the

Invalid Language supplied
:

Invalid Language supplied

We are now able to fill the GUI with the help of the

Invalid Language supplied
. Each field of the DTO is automatically binded to the GUI defined by the Language:XAML files by using binding properties. For example, the this!!silverlight/Home.xaml contains a field
txtCompanyName
binded to the field Name of the DTO.

<TextBlock Height="23" HorizontalAlignment="Left" Margin="59,46,0,0" Name="txtCompanyName" Text="{Binding Name}"

Architecture

The project is represented as two Visual Studio projects:

  • silverlight.Web contains the generated bootstrap code for launching the silverlight application.
  • silverlight contains the actual implementation. The Language:WSDL file and the generated DTO proxies are located in the folder silverlight/ServiceReferences/CompanyServiceReference. The GUI is provided by Language:XAML files located in the base folder of the project.

Usage

This contribution has been tested under C# and .NET Version 4.0.


Kevin edited this article at Wed, 08 Aug 2018 14:12:04 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.