Time for action creating the Entity Framework

We will take advantage of the Entity Framework for our Silverlight customer service application and also utilize WCF RIA Services to create domain services and auto-generate client data classes. We will create our Entity Framework classes from the SQL database that we created in the previous section. 1. Start Visual Studio and open the CakeORamaApp solution we created in the previous chapter. 2. Right-click on the CakeORamaApp.Web project and choose Add New Item. 3. In the Add New Item dialog...

ADONET Entity Framework and WCF RIA Services

A common practic when developing data driven business applications is to create a set of classes that reflect the data stored in the database. Most often, developers will create classes that map to each table within a database to keep things as transparent as possible when dealing with large amounts of data. Microsoft released a lightweight mapping framework called LINQ to SQL, which is basically a one-to-one mapping of .NET classes with database tables. The framework provides mappings to the...

[PACKTl Tix

Document Object Model DOM 59 DrawRoute method 369 e.Result.Result object 370 easing, key frame 60 embedding files versus referencing files 83-87 event handlers adding 56 coding 57, 58 executive dashboard creating 300-309 extending 312-320 Expression Blend 15, 16 about 3 7 art board 39-41 crash course 37 styles, modifying 41-43 Visual Studio 38 Expression Design 18, 19 Expression Encoder 19, 20 Expression Media Encoder about 99, 100 other templates 105 video, encoding 101-105 eXtensible...

[PACKTl Bgi

private void client_GeocodeCompleted object sender, e PlatformServices.GeocodeResponse response e.Result if response.Results.Count gt 0 PlatformServices.GeocodeResult result response.Results. First if result.Locations.Count gt 0 Location location new Location result.Locations. First .Latitude, pushpin.Location location map.Children.Add pushpin map.SetView result.BestView DeliveryLocation dl new DeliveryLocation Address this.txbAddress.Text, Location location 11. Now let's add the event handlers...

Time for action creating a business object

We'll create a business object that can be used by both Silverlight and our ASP.NET application. To accomplish this, we'll create the business object in our ASP.NET application, define it as a data contract, and expose it to Silverlight via our WCF service. Start Visual Studio and open the CakeORamaData solution. When we created the solution, we originally created a Silverlight application and an ASP.NET web project. 1. In the web project, add a reference to the System.Runtime . Serialization...

Adding event handlers

That's right, code, good old fashioned code. We are more than halfway through this chapter and we have not written one single line of procedural code. Sure, we've created plenty of XAML, but not one single line of C or Visual Basic.NET code. How is this possible Sharp-eyed readers may have already noticed that our MainPage. xaml file has a code behind it named MainPage . xaml. cs MainPage . xaml .vb, if you're using Visual Basic. NET . Curious readers may have already taken a peek at the code...

Future of Silverlight

As Rich Internet Applications mature, expect to see more and more desktop-like features being added we can already see this happening with the addition of printing support in Silverlight, out-of-browser support for disconnected applications, and extended local storage access for trusted applications. With the addition of COM support in Silverlight 4 the step is even closer in a Windows development environment. The rise of cloud computing and cloud-based services will change the landscape of...

Beyond Silverlight

As fully featured and robust as Silverlight is, it still has its limitations. Remember that Silverlight is web-centric and cross-platform. That means that all your code will run in a sandboxed environment with limited privileges. Even in elevated trust, Silverlight still does NOT have full access to a user's file system, which may be required of an intranet business application. Silverlight out of browser applications that run with elevated trust can only access the MY folders of a user's...

[PACKl Svp

8. You'll notice now that there is a new folder named Themes in your project along with a file called Generic . xaml 9. If you open up the Generic. xaml file, you'll see that it is a resource dictionary and that the template had already filled a Style with a TargetType of local SignatureControl. 10. If you look in the SignatureControl. cs file, you'll see the following line of code inside the constructor method. It loads a default style for the control type. this.DefaultStyleKey typeof...

Time for action creating the data model

We will create a data model that can support customers who may or may not order cakes for multiple events. We will also setup support for maintaining records of cakes that were ordered and the details of the cakes ordered, including images of the finished cakes. 1. Start SQL Server Management Studio or SQL Server Management Studio Express and connect to your local computer or development database server. If SQL Server is installed, the local computer is your computer name or local if using SQL...

WCF Rich Internet Application RIA Services

The Silverlight framework is termed a Rich Internet Application or RIA for short. Microsoft has provided a pattern that can be used in connection with ASP.NET to provide a common middle tier. Complex business applications typically make use of data and business layers along with service layers to pass data across tiers. These layers or tiers can become complex over time, and WCF RIA Services provides a pattern for utilizing best practices in web and service development to provide maintainable...

Handling Data

Business applications are all about data input received from clients, metrics regarding performance or sales, inventory, assets, and so on. Silverlight provides a robust and easy way to handle, bind, and validate this data. In addition to data handling capabilities, Silverlight can also communicate via Windows Communication Foundation WCF services, providing an extensible means of communication with backend servers and data stores. Create a WCF service and business object for receiving data...

Info Cic

8. Close the browser window to stop debugging the application. We just created a simple network connectivity tester by clubbing the GetIsNetworkAvailable method and the NetworkAddressChanged event. The NetworkChange_NetworkAddressChanged event handler changes the fill color of the ellipse named ellipseIndicator whenever the network address changes as it does when it loses connectivity. Based on the value returned by the GetIsNetworkAvailable, we turn the ellipse red or green. So why was the...

What just happened Nrv

We created a complex form containing several listbox controls with custom ItemTemplate definitions that made use of Expander controls to present the information to the user in a way that allowed them to view segments of the information at a time, reducing screen clutter. We used TwoWay data binding to ensure that information that was changed on screen would persist to our entity classes. We created a custom IValueConverter class to convert the Status integer value of the Order class to a list...

[PACKTl Wnk

Play Trip With Many Waypoints

this._locations.ToList .ForEach x gt routeRequest.Waypoints. Add GeocodeResultToWaypoint x Make the CalculateRoute asnychronous request. private void long timeInSeconds e.Result.Result.Summary. TimeInSeconds TimeSpan t new TimeSpan 0, 0, int.Parse timeInSeconds. ToString this.txbTotalTime.Text string.Format Driving Time 0 , t.ToString private RouteService.Waypoint RouteService.Waypoint waypoint new RouteService.Waypoint waypoint.Description deliveryLocation.Address waypoint.Location new...

[PACKl Kyh

17. Change the Foreground of the SubmissionList to FFFFFFFF. 18. Because we will be viewing the information that was submitted by customers and it includes an ink sketch, we need to add an inkPresenter control to the right column. Click on the Assets button and type ink into the search field. Select the InkPresenter control and then double-click on the InkPresenter in the toolbar to add a new instance to our page. Name the InkPresenter SketchInk, change the Background to FFFFFFFF and position...

Adding video to a Silverlight project

The process of adding video to a Silverlight project is very similar to that of adding sound to a page. In the previous section where we added sound to a project, we didn't care that much about where we placed the MediaElement control or what it looked like. The sound we played didn't have a visual element. Therefore, the placement and appearance simply didn't matter. However, adding video requires us to have a visual element. We're going to add a short video clip to the animated logo project....

Coding videos with Expression Media Encoder

If you would like to use your own media content and need to convert it into a format that Silverlight supports, then Expression Media Encoder will do the job. When you first launch Expression Media Encoder, you may think for a moment that you are back in Blend. Its resemblance to Blend is not a coincidence. Media Encoder is in the same product family as Blend, and all products in the Expression line have a similar look and feel. The Expression Media Encoder user interface can be broken down...

Using video as a brush

Cakeorama Logo Download

What if we wanted the video to fill every letter in the logo Or what if we wanted to have the video fill any kind of shape, text, or control How would we go about that The answer lies in making a VideoBrush, or a brush that renders a video stream. To create a VideoBrush in XAML, all you need to do is declare it and get its content from a MediaElement control. The code to declare a VideoBrush is as easy as this lt VideoBrush x Key brushName To use the VideoBrush, we simply reference it from...

Customer Service Application

Organizations that sell products and deal with the public most often have some type of customer service department. Whether it is the owner fielding calls, or a full blown department having an application to easily view and edit customer information, it can save a lot of time and money for the business. In the previous chapters we collected information from potential customers and started building an internal application for viewing the customer submissions. We will take this a step further by...

Enriching an application with audio cues

So far we've seen how to add sounds and videos to our Silverlight project, that are passive. They don't really interact with the user. Consider our navigation buttons application from Chapter 2. Wouldn't it be nice to have a sound play, when the user moves the mouse over each button It would make the navigation buttons feel a little more tangible. Time for action - adding interactive sounds Let's add subtle audio cues to our site navigation project to provide a slightly more engaging experience...

Creating a signature capture control

Book Capture Control

Cake-O-Rama would like to go paperless. This includes delivery sign off sheets, where the customer signs off on receipt of the cake. The inspiration for this idea comes from the electronic signature devices at many retails stores. You have most certainly seen them. They have an area that accepts a signature and buttons to clear the signature field and to accept the signature. If you play with them enough, you'll notice that the accept button doesn't work if there is no signature. We're going to...

Executive Dashboard Application

Executives and other business decision makers rely on collected data to drive their business forward. In Silverlight, we can provide visualizations of data to make the decision makers jobs a bit easier. After all, looking at data on a graph can provide a better understanding of the information than just plain spreadsheets or grid data. By providing data in an intuitive way, we can better serve the needs of the business. And by providing an application to allow executives to visualize collected...

PSKMfcaina

You just created your first animation in Silverlight. First you created a Storyboard and then added a couple of Key frames. You changed the properties of the canvas on one key frame and Silverlight automatically interpolated them in between points to create a nice smooth animation. If your animation didn't show up on the initial page load but did when you reloaded the page, then you've just experienced how seriously the Silverlight animation engine respects time. Since our animation length is...

Windows Communication Foundation WCF

Windows Communication Foundation WCF provides a simplified development experience for connected applications using the service oriented programming model. WCF builds upon and improves the web service model by providing flexible channels in which to connect and communicate with a web service. By utilizing these channels developers can expose their services to a wide variety of client applications such as Silverlight, Windows Presentation Foundation and Windows Forms. Service oriented...

Platformservices.geocodeserviceclient

Text Deliveries TextWrapping Wrap Grid.Column 1 gt lt Li stBox x Name lbxDestinations Margin 5,20,8,7 Grid.Column 1 Grid.RowSpan 1 gt lt ListBox.ItemTemplate gt lt DataTemplate gt lt StackPanel gt lt TextBlock Text Binding Address lt StackPanel Orientation Horizontal gt lt Button Content Up Tag Binding Click UpButton_Click gt lt Button Content Down Tag Binding Click DownButton_Click gt lt Button Content Remove Tag Binding Click RemoveButton_Click gt lt StackPanel gt lt StackPanel gt lt...

Silverlight Multiscaleimage Add Pushpin

Architecture Silverlight Bing Map

Preview in View Vtew Leam Browser Image Folder Project Folder More 20. Click on Preview in Browser, to see that we've actually created a Silverlight project with Deep Zoom content. You should see the web page load up with the following content 21. Click around to explore the montage. Use the mouse wheel to zoom in and out. If you do not have a mouse wheel, click to zoom in on an image and Shift click to zoom out. 22. Close your browser window and go back to Deep Zoom Composer. 23. The previous...

[PACKl

Transparent Eraser Net

We need to tell the map control how to align the PushPin control. We want the bottom center to line up with the Location and that's exactly what this attribute does As an added touch, the custom template also adds a TextBlock, which displays the name of the town in which a given store is located. Looking closely at the code, you'll notice that the Text property of the TextBlock is set to TemplateBinding Content . This markup extension binds the value of the Pushpin's Content property to the...

Time for action hosting a Silverlight application in SharePoint

We will setup a Silverlight application that we can host from within SharePoint. 1. Firstly, download and install the Visual Studio 2008 extensions for Windows SharePoint Services 3.0 from http www. microsoft. com downloads details.aspx FamilyID FB9D4B8 5-DA2A-4 3 2E-91FB-D5 0 519 9C4 9F6 amp disp laylang en. VSeWSS 1 3 Mar 2009 CTP Release Notes.rtf VSeWSSvl 3_AM O 64_Bu i I d -4-33.exe We need to install this on a machine that has Windows SharePoint Services 3.0 installed. An evaluation...

Adding media to a Silverlight project

Silverlight provides built-in support for playing a variety of media formats, both movie and sound files. The process for adding media to Silverlight projects is relatively easy to do you may find yourself dreaming up all kinds of ways to enhance all your projects with rich media. You could add background music to create ambience or add sounds to provide feedback that a button has been clicked or a process completed, the options are endless. Just because you can add media to your Silverlight...

Time for action creating a RIA Services application

We are going to create a WCF RIA Services application to read the customer information and sketch details we setup in the last chapter. 1. We need to download the free WCF RIA Services package in order to get started. The official Silverlight website will always contain the latest downloads for all Silverlight related tools. Visit http silverlight. net riaservices and click on the Download WCF RIA Services link. Microsoft WCF RIA Services simplifies the traditional n-tier application pattern by...

Time for action creating a customer lookup form

We saved customer information in the previous section through the submissions interface. However, for our customer service representatives to lookup customer information, we will need to provide a lookup feature and the ability to make changes to existing orders for the current customer. We will make use of a variety of controls from DatePicker to ListBox to Expander, and perform TwoWay data binding of our Customer entity. Because of the relationship between Customer and Event entities and the...

Time for action creating a Silverlightenabled WCF service

Silverlight Wcf Service

Now that we have our business object, we need to define a WCF service that can accept the business object and save the data to an XML file. 1. With the CakeORamaData solution open, right-click on the web project and choose to add a new folder, rename it to Services. 2. Right-click on the web project again and choose to add a new item. Add a new WCF Service named CakeService. svc to the Services folder. This will create an interface and implementation files for our WCF service. Avoid adding the...

Animation in Silverlight

Timeline Makeup

Silverlight sports a rich animation system that is surprisingly easy to use. The animation model in Silverlight is time based, meaning that movements occur based on a set timeline. At the heart of every animation is a StoryBoard, which contains all the animation data and independent timeline. Silverlight controls can contain any number of Storyboards. StoryBoards contain one or more Key frame elements, which are responsible for making objects on screen change position, color, or any number of...

Preface

Welcome to the world of Rich Internet Applications RIA and Silverlight. A world in which the user experience is paramount, and easy to use yet powerful applications are what we strive to create. Silverlight brings .NET developers into the RIA space in a big way, providing the controls we know with web and Windows development and allowing us to define a custom experience to best benefit the users of our applications. The days of plain HTML web applications are coming to end, making way for more...

[pack 1

The Washington Monument Aerial View

2. In order to use the Bing Silverlight Maps control, we ll need to add references to appropriate DLLs, just as we did in chapter 4. To do this, right click on the references folder in the DeliveryApplication project and choose Add Reference... Add Reference,.. Add Service Reference,.. _i l- l 11 . i . iu 1.1 l-1 i. Properties j References pp.jiaml ainPage.xaml MainPage.xarnl 3. In the Add Reference dialog box, click on the Browse tab and browse to the directory where you installed the Bing...

Time for action creating a data object

We are going to create a data object that we will bind to our input form to provide validation. Silverlight can bind to any properties of an object, but for validation we need to do two way binding, for which we need both a get and a set accessor for each of our properties. In order to use two way binding, we will need to implement the INotifyPropertyChanged interface that defines a PropertyChanged event that Silverlight will use to update the binding when a property changes. 1. Firstly, we...