Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Building a 3-Tier App with Silverlight 3, .NET RIA Services, and Azure Table Storage

, 11 Jul 2009 CDDL
This article presents the techniques and caveats of building a 3-tire Azure hosted application using Silverlight 3 (presentation tier), .NET RIA services (business logic and data access), and Windows Azure Table (data storage).
Azurelight_SourceCode.zip
Azurelight
Azure
DomainServices
Linq
Properties
StorageClient
Azurelight
Azurelight
Azurelight.ccproj
Azurelight_WebRole
ServiceConfiguration.cscfg
ServiceDefinition.csdef
Azurelight_WebRole
App_Data
Azurelight.mdf
Azurelight_log.ldf
App_GlobalResources
System.Web.Silverlight.dll
ClientBin
Global.asax
Model
Properties
Service
AzurelightNav
Command
Control
Generated_Code
Model
Properties
Resources
SilverlightCairngorm
Business
Command
Control
Model
Properties
Views
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hanray.Azurelight.Model;
using Hanray.Azurelight.Views;
using Hanray.Azurelight.Service;
using System.Windows.Ria.Data;

namespace Hanray.Azurelight.Command
{
	public abstract class FeedbackCmdBase : SilverlightCairngorm.Command.ICommand
	{
		protected AzurelightModel model = AzurelightModel.Instance;
		protected SurveyContext riaSvc = AzurelightModel.Instance.RIASvc;

		protected ProgressDialog _progressDialog;

		private EventHandler CompletedEventHandler;
		private SubmitOperation submitOp;

		public FeedbackCmdBase()
		{
			CompletedEventHandler = new EventHandler(this.onCompleted);
			submitOp = null;
		}
		#region ICommand Members

		public virtual void execute(SilverlightCairngorm.Control.CairngormEvent cairngormEvent)
		{
		}

		protected virtual void onSubmitStart()
		{
			_progressDialog = new ProgressDialog("Saving...");
			_progressDialog.Show();
		}

		protected virtual void SubmitChanges()
		{
			onSubmitStart();
			submitOp = riaSvc.SubmitChanges();
			submitOp.Completed += CompletedEventHandler;
		}

		private void onCompleted(object sender, EventArgs e)
		{
			submitOp.Completed -= CompletedEventHandler;

			_progressDialog.Close();

			errorHandler(submitOp.Error);
		}

		protected virtual bool errorHandler(Exception Error)
		{
			if (null == Error)
				return true; //no error

			ChildWindow w = new ChildWindow() { Title = "Communication to Server Failed" };
			w.Content = new TextBlock() { Text = "Error:" + Error.Message };
			w.Show();

			return false; //has error
		}
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)

Share

About the Author

Modesty Zhang
Technical Lead
United States United States
Tech Lead of large scale consumer facing software offerings, specializing in Web and Mobile application architecting and development.
 
Specialties:
Web App/ iOS / Cocoa Touch / HTML5 / CSS3 / Ajax / jQuery / jQuery Mobile / jQuery UI / Node.js / Rich JavaScript Application / RESTful Web Services / Java EE 6 / Java 7 / PHP / Ruby on Rails / and Windows / .NET / RIA / Flex / Flash / Silverlight / Software Architecting / Front End Design and Development

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 12 Jul 2009
Article Copyright 2009 by Modesty Zhang
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid