ansoesil’s blog

“Learning is experience. Everything else is just information.” – Albert Einstein

Posts Tagged ‘Silverlight

InDepth: Column Layout – Part 1

with one comment

Hi,

In the previous posts i’ve discussed how to do data binding using Intersoft Presenter. One thing that is set by default is that the columns is automatically generated from the given item type. In most cases, we don’t want all the columns in the item type to be displayed so how can we manage this ?

Intersoft Presenter has the capability to determine the view definitions through several properties. First of all you can defines the columns that you want to display, controls its behavior (AllowFilter, AllowGrouping, AllowSort), its display (Caption, Width), its action (SortMemberField, FilterMemberField), including states such as SortOrder and so on. Furthermore you can also control the FilterOptions which contains collection of option that can be used to filter the data, and you can also determine which options are checked and which options aren’t. Last but not least you can also control the group columns.

In this post I’ll cover three basic approach to define the column layout:

  1. Declaratively in the xaml.
  2. Programmatically.
  3. Change layout at runtime.

Defining column layout declaratively in the xaml

InDepth-ColumnLayout1

First of all you need to turn of the AutoGenerateColumn property (set the value of this property to “No”). Then you’ll need to define the columns manually as in the picture above.

InDepth-ColumnLayout1b

To specify the initial order position you can do:

InDepth-ColumnLayout1c

The default value is “None” which mean no SortOrder is applied.

Further more you can also customize the filter options that will be listed in the action box by declaring:

InDepth-ColumnLayout1d

You’re free to create any set of Expression in each filter option, and then specify the meaningful name to its Filter Text. In this case i would like to filter the data base on certain range of value.

Furthermore you can also set which of the following options that will be applied initially and which aren’t by filling the SelectedFilterOptions property.

InDepth-ColumnLayout1e

The SelectedFilterOptions should be filled with FilterOption that will be applied / checked which linked through FilterText. As for this case, the 0 – 50 options will be checked while the 51 – 100 option will not.

InDepth-ColumnLayout2

And as you can see from the screen shot, the Units in order column is also sorted descending.

Lastly you can also specify the grouped columns from:

InDepth-ColumnLayout3

This approach give you more freedom to set the initial display of you Presenter. There are also others property that i didn’t cover up in this post but all of them can configurable the same way.

I”ll discuss how to specify column definitions programmatically and how to change it at run time and what are the things to considered when changing the column definitions in the next post.

Regards

Andry

Here’s are the link to the sample code.

Written by ansoesil

July 22, 2009 at 9:09 pm

In Depth: Data Binding with Intersoft Presenter for Silverlight – Part1

with one comment

Hi all,

Silverlight 3.0 RTM is released and there are lots of new exciting features including the Microsoft .NET RIA services which give us a new way to perform data binding to Silverlight application.  I’ll cover this area later in other posts, as we still exploring the Silverlight 3.0 so stay tune.

In this post i would like to focus on the current data binding approach that we implement in Intersoft Presenter for Silverlight. There are two ways to perform data binding in Intersoft Presenter for Silverlight:

  1. Bound to Intersoft Data Source control.
  2. Unbound to Intersoft Data Source control.

What does it mean with “Unbound to Intersoft Data Source control” ?

Unbound to Intersoft Data Source control means that your presenter is not attached to any data source control, which required the developer to provide the data through ItemSource property.

InDepth-DataBinding1

You can also use Intersoft Data Source control to populate the ItemsSource to get the data from Astoria Data Service / WCF Data Service / XML.

InDepth-DataBinding2

Since the process is asynchronous, you need to assign the ItemsSource at Selected event as described above.

Using this approach, the presenter will only get the data once and all build-in data operation (filtering / sorting / paging) will be processed using client side operation which mean no data transaction to server again as displayed below.

InDepth-DataBinding3

This approach can be useful, if you can grab all the data at once during the first request. However if you’re dealing with enterprise data where paging is required because the data is too large, its probably best using the “Bound to Intersoft Data Source control” mode so that only partial data is sent from server to client per request (note: using paging approach).

How Bound to Intersoft Data Source control differs with Unbound mode ?

Bound to Intersoft Data Source control means that all the data operation is delegated to Data Source control. The Presenter only need to specify two properties which are DataSourceID and DataMember to point which data service responsible for the Presenter.

By default the all data operation will be requested back from the server through DataSource control, this is design to support the enterprise scenario which most likely will use paging to suppress the data transaction as minimum as possible. However you can also turn the mode into client side operation if you prefer, which force the Presenter to request the data only once at the first call and later all the data operation will be using client side operation as in unbound mode.

InDepth-DataBinding4a

If you check using HTTP Watch or HTTP Fox (for Firefox), you’ll see that there are some data transaction whenever you perform filtering / paging / sorting.

InDepth-DataBinding5

As you can see from the screen shot, bytes sent are relatively small because the data sent is only 20 records per page. You might want to consider this approach if you’re developing enterprise application.

Although Intersoft Presenter has nice feature called Virtual Scroll to overcome scrolling large data issue, its always good idea to consider the data transaction between client and server. This is just one of many approach that you can choose to develop your application.

I’ll discuss more on how to customize the query for data selection, changing the data source with / without structure changed at runtime in part2.

If you want to see the sample code, you can download it from here.

Regards

Andry

Written by ansoesil

July 14, 2009 at 10:13 am

Intersoft WebUI Studio 2009 R1 for Silverlight Beta is available!

with 4 comments

Hi all, the long awaited beta version for WebUI Studio 2009 R1 for Silverlight is up. This package includes the latest version of Intersoft Presenter for Silverlight, Intersoft WebAqua for Silverlight  and Intersoft DataSource for Silverlight.

If you haven’t read the previous blog about the Intersoft Presenter and Intersoft Data Source, I suggest you do read it first, because it might help understanding the Intersoft Presenter’s concept better.

We also have the Live Demo up and running which you can explore at http://sirius2.intersoftpt.com/presenter.

Intersoft WebAqua

Intersoft WebCoverFlow as member of WebAqua family has been enhanced to natively support Intersoft Presenter’s concept and architecture so that it benefiting from the fundamental concepts of Intersoft Presenter such as:

  • Data Bound Capability
  • Extensibility through IDataPresenter
  • Centralized Data Distribution
  • Data Drilling Capability

Data Bound Capability allow Intersoft WebCoverFlow to be bind to Intersoft Data Source control declaratively. Which mean binding data source to WebCoverFlow is lots easier now, and you can connect to XML document, or WCF Data Service or ADO.NET Data Service (a.k.a Astoria Data Service)

coverflow-databinding

Extensibility through IDataPresenter allow Intersoft WebCoverFlow to be attached to Data Presenter Manager and can benefiting from the Centralized Data Distribution that perform by Data Presenter Manager, where you will see the same data through out the entire presentation (for example if the data is filtered and sorted)

coverflow-integrated

Data Drilling capability allow Intersoft WebCoverFlow perform two Data Drilling concept that Intersoft Presenter introduced. Synchronized Data Drilling and Hybrid Data Drilling

coverflow-sync-datadrilling

Synchronized Data Drilling in WebCoverFlow

coverflow-hybrid-datadrilling

Hybrid Data Drilling using WebCoverFlow

Intersoft Presenter™

In-line editing

Added in-line editing capability to Intersoft Presenter™ where you can perform CUD operation declaratively thanks to Intersoft Data Source™.

Follows are several options that you can play around with Intersoft Presenter™ in-line editing capability.

  • AllowAdd / AllowEdit / AllowDelete
    You can turn on / off the CUD capability from the above properties, and you can do it anytime by changing the value of the property.
  • Editing Mode
    You can modify how to enter the editing mode behavior for each presenter using EditingMode property. The default behavior is second click, which mean you need to select the item first (1st click) and then perform another click (2nd click) to enter the editing mode. The other behavior is single click which mean when-ever you select the item it will directly go to editing mode.
    Note: in Icon Presenter and List Presenter you need to click the text to enter the editing mode.
  • Lost Focus Action
    You can also modify the lost focus behavior from LostFocusAction property. By default if you accidentally lost focus from the current editing mode, it will reset the data back to its original state. You can change it to AlwaysUpdate so that when ever you accidentally lost focus it will perform data updating.
  • Exclusive Lock
    When in editing mode, the presenter will have exclusive lock to all UI interaction that might interupts the editing process. If the user accidentallyclick UI that might perform action that interupt the editing process, a warning indicator will be displayed (e.g. user click Refresh Button).
    presenter-exclusivelock
  • Input Validation
    You can perform your own validation before the data is committed to server using Input_Validation event handler.

    presenter-inputvalidation1

    Custom Validation

    presenter-inputvalidation2

    When entering the wrong input

  • Capture Error thrown by Data Service
    If there’s error when performing CUD operation, the error message from Data Service will be displayed in an error box.
    presenter-errorhandling
  • In Grid Presenter, you can enter edit on key stroke by changing the property EnableEditOnKeyStroke to true.
  • In Grid Presenter, you can change the “Enter” key behavior to Go to next Editable cell, or Exit Edit, or Update.
  • In Grid Presenter, you can determine which column can be edited and which column isn’t from
    <ISNet_Silverlight_Presenter:DataPresenterTextColumn Editable=”False” />

Keyboard Navigation

Added keyboard navigation feature to all presenter including WebCoverFlow. This feature is also incoporated with the Virtual Scroll mechanism, and Data Grouping mechanism.
Context Menu

Context Menu will be available if Enable Context Menu property is set to True, and the action that available in context menu is available.

presenter-contextmenu1

presenter-contextmenu2

Scroll to Last Selected Item

This feature can be enabled by changing the Property ScrollToLastSelectedItem to True in any Presenter. When this feature is enabled, anytime you perform sorting, paging, filtering, or any data operation that might put your selected item at invisible position that scrollable, it will scroll to that position.

This feature if you want to see the last selected item regardless the action that might hid it somewhere in the scroll position.

Customize Style

You can customize the style of all elements in Intersoft Presenter(tm) using Microsoft Expression Blend.

presenter-style-icon

presenter-style-list

presenter-style-grid

presenter-blend

That’s all for now, if you find some possible bugs, or you feel that there are scenario that you need which is not covered yet, feel free to drop it in this blog.

Regards

Andry

Written by ansoesil

April 29, 2009 at 10:06 am

Hybrid Data Drilling in Intersoft’s stand-alone Presenter

with one comment

Hi again,

In the previous post, i mentioned that we have two data drilling concepts which are:

In this post, i’ll discuss the second concept first which is Hybrid Data Drilling in Intersoft’s stand-alone Presenter which are Icon Presenter, List Presenter and Grid Presenter along with your custom view that implement IDataPresenter interface later on.

Hyrid Data Drilling

Pre-requisites:

Hybrid Data Drilling is a concept where you can drill down a hierarchical data into a different kind of data representation, you can have Icon Presenter for the root level, Grid Presenter for the first level, List Presenter for the second level and so on. Furthermore with the architecture provided by Intersoft Presenter™ you can make your Custom Presenter to be part in this Hybrid Data Drilling concept.

I’ll discuss more about the extending your Custom Presenter a little bit later since the feature has not been implemented yet in this CTP but we already managed to get it done and its in testing phase.

To enable the Hybrid Data Drilling is very simple as we enable Synchronized Data Drilling in Presenter Manager. What you need to do is specify the ChildPresenter property.

Lets make Icon Presenter {Customers} -> Grid Presenter {Orders} -> List Presenter {Order_Details}.

  • First of all you need to set up the Icon Presenter
Set up the Root Presenter

Set up the Root Presenter

  • Specify the Child Presenter for first level and second level.
Open the Root Presenter's Child Presenter collection

Open the Root Presenter's Child Presenter collection

Add a Grid Presenter as its Child Presenter

Add a Grid Presenter as its Child Presenter

Configure the Grid Presenter

Configure the Grid Presenter

Open Child Presenter collection for this Grid Presenter, and Add List Presenter as its Child Presenter.

Open Child Presenter collection for this Grid Presenter, and Add List Presenter as its Child Presenter.

Configure the List Presenter.

Configure the List Presenter.

  • You’ll get something like this in your XAML

hybriddatadrilling_childpresenter6

Basically this is just the thing you need to enable the hybrid data drilling. However you also need to set up the DataSource control so it can provide our Presenter with the data.

When you have ADO.NET Data Service up and running, you only need to specify the necessary information to Astoria Data Source as follows

Configuring Astoria Data Source

Configuring Astoria Data Source

Then you need to configure what are the data that you want to retrieve at each service level.

synchronizeddatadrilling_astoriaconfiguration2

Specify the detail at each Data Service level

After you got the Astoria Data Source control configured, what you need to do is just set the Data Member and Data Source ID.

Set DataSourceID and DataMember

Set DataSourceID and DataMember

After this you can have the Hybrid Data Drilling feature in Intersoft Presenter enabled already. Try running your project and see what happens when you double click an item. You can grab my sample project from this link.

To Drill Up, you can click the indicator at the top left.

hybriddatadrilling_childpresenter8

Important Notes

  • When we request a data drilling (drill down) to ADO.NET Data Service, what its actually do is load parent with the specified ID then expand its child. E.g.    http://&#8230;./NorthwindDataService.svc/Customers(‘ALFKI’)$expand=Orders
  • When you drill down all the previous structure history will be kept (Grouping, Column Reordering, Sorting)
    So let say you drill down to Orders from Customers (ALFKI), perform grouping, column re-ordering and sorting. Then drill up, select another customer then drill down , all the grouping, column positioning and sorting states will be kept. But of course its showing the new data.

That’s all for now.
To experience the real application i suggest you to go to http://sirius2.intersoftpt.com/presenter and explore the samples there.

Regards

Andry

Sample Link

Written by ansoesil

March 10, 2009 at 9:40 pm

Data Drilling in Intersoft Presenter™ Manager

with 7 comments

Hi all,

In the March 2009 CTP we introduce a declarative data drilling concept to Intersoft Presenter™. Data Drilling is one of the most wanted feature for a LOB application, so we thrive to make it easy to implement in our Intersoft Presenter™.

We have two main concepts for Data Drilling:

The Synchronized Data Drilling concept is implemented for Intersoft Presenter Manager, and the Hybrid Data Drillign concept is implemented for the Intersoft Presenters (Icon Presenter, List Presenter and Grid Presenter) along with other classes that implements IDataPresenter (which includes WebCoverFlow later on).

In this post, i’ll discuss the first concept first which is Synchronized Data Drilling in Intersoft Presenter Manager.

Synchronized Data Drilling

Pre-requisites:

In Presenter Manager, when you drill down  a data or drill up to its parent, you’ll see the data visualized in the same presenter. So whenever you switch the visualiation in any level, if you go down or up , you’ll see the drill down / drill up data in the same visualiation (synchronized).

To enable the Data Drilling in Presenter Manager, you need to specify child presenter manager in a property called ChildPresenterManager

Open Child Presenter Manager collection

Open Child Presenter Manager collection

synchronizeddatadrilling_childpresentermanager2

Fill detail for 1st Level Child

Fill detail for 2nd Level Child

Fill detail for 2nd Level Child

In the XAML you’ll see something like this:

synchronizeddatadrilling_childpresentermanager4

Basically this is just the thing you need to enable data drilling. However you also need to set up the DataSource control so it can provide our Presenter with the data, and also you need to set up the appearance for each presenter that attached to Presenter Manager. Let start with configuring Astoria Data Source.

When you have ADO.NET Data Service up and running, you only need to specify the necessary information to Astoria Data Source as follows

Configuring Astoria Data Source

Configuring Astoria Data Source

Then you need to configure what are the data that you want to retrieve at each service level.

synchronizeddatadrilling_astoriaconfiguration2

Specify the detail at each Data Service level

After you got the Astoria Data Source control configured, what you need to do is just set the Data Member and Data Source ID.

Set DataSourceID and DataMember

Set DataSourceID and DataMember

Lastly what you need to configure is the Presenter’s appearance. But i won’t go detail on this to make the topic more focus, so I’m just gonna give the binding field to Icon Presenter and List Presenter so you can see the data binding works.

synchronizeddatadrilling_childpresentermanager6

Ok we almost finished. Just one more thing, the Presenters (Grid Presenter, List Presenter, IconPresenter) are going to be reused in each level, therefore we need to update the binding information when necessary so that it still display the correct data.

For example:

BindingTextField, in Customers level we might want to set it to ContactName, however in Orders level or OrderDetails we want to set it to another field. To do this we provide a feature called property setters.

Open property setters for Root Level

Open property setters for Root Level

Fill in the Details, in this case we want to change BindingTextField property's value to Contact Name for IconPresenter1 and ListPresenter1

Fill in the Details, in this case we want to change BindingTextField property's value to Contact Name for IconPresenter1 and ListPresenter1

Do the same things for all its children

Do the same things for all its children

In the XAML you’ll see something like:

synchronizeddatadrilling_propertysetters4

After this you can have the Data Drilling feature in Presenter Manager enabled already. Try running your project and see what happens when you double click an item. You can grab my sample project from this link.

To Drill Up, you can click the indicator at the top left.

synchronizeddatadrilling_sample

Important Notes

  • When we request a data drilling (drill down) to ADO.NET Data Service, what its actually do is load parent with the specified ID then expand its child. E.g.    http://&#8230;./NorthwindDataService.svc/Customers(‘ALFKI’)$expand=Orders
  • When you drill down all the previous structure history will be kept (Grouping, Column Reordering, Sorting)
    So let say you drill down to Orders from Customers (ALFKI), perform grouping, column re-ordering and sorting. Then drill up, select another customer then drill down , all the grouping, column positioning and sorting states will be kept. But of course its showing the new data.

That’s all for now.
I’ll dicuss the other Data Drilling concept in the next post.
To experience the real application i suggest you to go to http://sirius2.intersoftpt.com/presenter and explore the samples there.

Regards

Andry

Sample Link

Btw you can also incorporate your custom view to perform data drilling later on, by implementing our interfaces. Like what just we do to our CoverFlow. Here’s are some snapshot coverflow in action.

synchronizeddatadrilling_coverflow

Written by ansoesil

March 10, 2009 at 11:55 am

Get Started: Intersoft March 2009 CTP for Silverlight

with one comment

Hello,

Just wanna inform to you all that the Intersoft March 2009 CTP for Silverlight is up now. You can sign up and get the CTP from this website. It will then send you an email notification where to download the CTP directly.

Here are some key points and steps to get started with Intersoft CTP for Silverlight:

  1. You must have the following prerequisites installed. They are Silverlight Tools for Visual Studio 2008 SP1 and Silverlight 2.0 Client. You can grab them from here.
  2. Extract the downloaded file into any folder.
    2009130_gettingstarted1
  3. The Intersoft Presenter™ assembly and Intersoft DataSource™ assembly are in Assemblies Folder.
  4. Run the ISNet_Silverlight_Samples.sln
  5. In the solutions explorer, you’ll see two projects. One is the Web Application that host the Silverlight Application which also has the Astoria Data Service connection along with the Wcf Data Service connection. And the other one is the Silverlight Application project that contains all the samples.
    gettingstarted
  6. To starts the demo just Run the project.
    Note that the Visual Studio Development Server port is set to 15088. So if you have other project that currently running on this server you need to terminate it first.

gettingstarted2

Regards
Andry

Written by ansoesil

March 5, 2009 at 9:08 pm

Presenting Intersoft March 2009 CTP

with 2 comments

Hi all, we’ve just release the Intersoft March 2009 CTP for Intersoft Presenter and Intersoft Data Source [http://www.intersoftpt.com/Corporate/Default.aspx?page=News&EventId=175]

There are lots of things in this CTP, so I’m going to give you some pointers about the new features / concept that available in this CTP. If you haven’t seen the February 2009 CTP release, i suggest you read my introduction along with others info in this blog starting from here.

You can sign up to download the CTP from here and here the getting started link to start exploring our CTP release.

Alternatively you can start exploring the live demo at http://sirius2.intersoftpt.com/presenter.

Intersoft Presenter™

What’s new in March 2009 CTP?

Revamped Action Box:

In February 2009 CTP, we have a Filter Box that contains the filter option that allows you to filter in / out particular condition. Now in March 2009 CTP we revamped it to an “Action Box” where you can also perform data grouping related actions in it as well.
We also preparing the architecture so that in the future release you’re able to insert your custom action to this action box.

actionbox0

Data Grouping Capability:

The grouping functionality can be accessed via the “Action Box” located on the right of every column header, by clicking the “Group” button it will group the presenter based on their own unique grouping mechanism.

actionbox1

You can also re-order the group column by dragging it to another location or you can remove the group by clicking the “Ungroup” button at the top of the Action Box, or simply click the (X) red button at each of the group column. Furthermore since each group column represents the actual column, you directly perform sorting to respective column by clicking the group column.

actionbox2

Grouping behaviors for each Presenter:

group_gridpresenter

Grouping in Grid Presenter

Grouping in Icon Presenter

Grouping in Icon Presenter

Grouping in List Presenter

Grouping in List Presenter

Paging:

We implement two model of paging they are Client Side Paging and Server Side Paging.

paging1

Client side paging means that it will page the data that the Presenter currently holds. So this feature is more applicable if you have relatively small amounts of data or unbound considering the data that are sent from server at first load.

Server side paging means that it will request the particular page data from the server by providing paging information such as Skip and Take along with other information such as Sorting, Filtering, and so on.

This feature is more applicable if you have large amount of data and you want the presenter shows the particular page data as fast as possible.

Client Side Filtering & Sorting:

With the same consideration with paging, we also offers client side filtering and sorting, besides the default behavior where every filtering / sorting request will look up to respective data source control.

Again the reason is to cover scenario where it’s more desired to load all the data at first load then since you have all the data it’s not necessary to request it back and forth to the server anymore, this is where Client Side Filtering & Sorting feature will come handy.

Data Drilling:

This CTP also include Data Drilling feature that you can enable declaratively (no code needed) to all Intersoft Presenter.

datadrilling

Declarative Data Drilling in Data Presenter Manager

Declarative Data Drilling in Grid Presenter

Declarative Data Drilling in Grid Presenter

As shown in the pictures above, since the child presenter is a new presenter object, you can freely configure new settings for each child presenter that can be different from its parent to give different look and feel.

In this CTP to perform drill down, you need to double click the item, and to perform drill up you can use the “bread crumb” indicator at the top of the presenter.

The “bread crumb” indicator at the top of the presenter

The “bread crumb” indicator at the top of the presenter

Hybrid Data Drilling:

Hybrid Data Drilling is the unique concept that we include in our Intersoft Presenter. All the stand-alone presenters (Grid Presenter, Icon Presenter and List Presenter) can have child presenter from any of the stand-alone presenters.

Meaning that you can have Grid Presenter for your root presenter, and then you can have Icon Presenter for its child or List Presenter for the other child. Basically you can mix-around the child presenter with any type of stand-alone presenters.

Grid Presenter {Root}

Grid Presenter {Root}

hybrid_datadrilling2

Icon Presenter {Level 1}

List Presenter {Level 2}

List Presenter {Level 2}

This will provide you more freedom to design your user experience.

Virtual Scroll™ Mechanism Updated:

The Virtual Scroll™ mechanism is updated to support Grouping feature so it still provide smooth scrolling experience.

Everything Synchronized™ Mechanism Updated:

The Everything Synchronized™ mechanism is also updated to support Grouping feature. Now the grouping states (expanded / collapsed) are also kept when you switch between views.

New Loading Indicator:

loadingbar

Breaking Changes in March CTP 2009?

Grid Presenter

Grid Presenter Table is striped out from Grid Presenter, now all the settings need to be configured through Grid Presenter.
This change needed to support the Data Drilling and Hybrid Data Drilling Features

Generic.xaml

Most of the Presenter and supporting controls has their Generic.xaml updated, so for those who edit the template of any presenter needs to check and perform the changes accordingly.

Intersoft DataSource™

What’s new in March 2009 CTP?

Enable Caching

You can enable caching to any of Data Source control, when you do this the data source will save the data retrieved to cache and the next time you request the data, it will load from the cache.

You can save the cache per xaml page, or globally by defining the its behavior through CacheScope property.

Data Drilling Support

The select arguments now provide additional information to perform data drilling. Those information are

  • Expand {the child data member}
  • ParentKey {the key value of its parent}

XML Data Source load external XML File

The XML Data Source now has the ability to load external xml file asynchronously. You need to set the LoadingMode to LoadingMode.ExternalResource then specify the location of the file in its DataFile property. Note that you need to take care the security access so that the Silverlight Application can access the file located in DataFile property.

Written by ansoesil

March 5, 2009 at 9:07 pm

Behind The Scene: Astoria Data Source Control

with 22 comments

Hi

Probably some of you are confused with the declarative configuration that you need to set up when you want to use Astoria Data Source control from Intersoft DataSource™. In this post I’ll try to elaborate the things one by one so hopefully its easier to understand how the Astoria Data Source control works.

First of all let me show you one way to select data from Astoria Data Service manually. I assumed you already know how to establish Astoria Data Service, or you can always learn it from my earlier post, or from MSDN references.

astoriadatasource11

As you can see we need to do lots of things, creating the service proxy / object, create the query, call the asynchronous call. Then attached the asynchronous call back where we can grab the data then apply it to our UI control. Furthermore we’re going to need similar process for Create, Update and Delete operation which might take some time to manage it properly.

Here where Astoria Data Source tries to help, it tries to simply the CRUD operation to ADO.NET Data Service. Please see the note i put in the picture above. Those are the information we need for Astoria Data Source declarative configuration.

The Reference Namespace was defined when you set the service reference in your silverlight project.

astoriadatasource2

The Service TypeName is your ADO.NET Data Service’s Object Context where you define in your MyNorthwind.svc.cs file.

astoriadatasource31

The Service Host is basically the host that contains the ADO.NET Data Service file, while the Service Target is the actual ADO.NET Data Service file. Later when you deploy the project, you need to adjust the Service Host accordingly to where you host your application.

The Data Object TypeName is object type that available in your ADO.NET Data Service, in this case i used Northwind Database therefore I’ll have Customers, Products, Employees, etc as my Data Object TypeName.

Here is what its how the declarative configuration looks like:

astoriadatasource4

Given this info, its enough for us to help you perform CRUD operation in more elegant way. One thing you should note that you can also specified the configuration individually per AstoriaDataService, something like:

astoriadatasource5

In this configuration, the AstoriaDataService[Customers] will look to http://localhost:52026/MyNorthwind1.svc instead of http://localhost:52025/MyNorthwind.svc. So if you have multiple services you don’t need to create additional data source control and configure other integrated features, you just need to set this individual settings to each data service and you’re set.

To do Data Binding with this Astoria Data Source: Data Binding to Silverlight Data Bound Control using Intersoft Data Source(tm)

To do CRUD operation using Astoria Data Source: Performing CRUD to Silverlight Data Grid using Intersoft Data Source ™

To do Child Data Retrieval using Astoria Data Source: Performing Child Data Retrieval using Intersoft DataSource™

Next I want to show you event handlers that Astoria Data Source has, and what you can do at each event.

  • Object Creating Event
    This is called when Service Object is going to be created.

–> at this point
proxy = new MySilverlightApplication.MyServiceReference.NorthwindEntities(new Uri(“http://localhost:52025/MyNorthwind.svc&#8221;));

  • Object Created Event
    This event is called when Service Object has been created.

proxy = new MySilverlightApplication.MyServiceReference.NorthwindEntities(new Uri(“http://localhost:52025/MyNorthwind.svc&#8221;));
–> at this point

You can grab the Service Object from the event argument, and probably change some property inside it if necessary.

astoriadatasource6

  • Object Disposing Event
    This event is called when the Service Object is going to be disposed.
    Again we passed the Service Object here, just in case you need to do additional clear up before the Service Object is disposed.
  • Selecting Event
    This event is called before we perform asynchronous call to perform data selection. You can add / change additional select argument or supply your own query like what i did in Performing Child Data Retrieval using Intersoft DataSource™ .

–> at this point
serviceQuery.BeginExecute(new AsyncCallback(GetCustomersCompleted), serviceQuery);

  • Selected Event
    This event is called when the asynchronous call is finished, and the data has been retrieved.private void

GetCustomersCompleted(IAsyncResult result)
{–> at this point

In this event you can grab the data using args.ReturnValue, and probably perform additional sub query as necessary before returning it to the UI. You can also check for Exception if the ADO.NET Data Service returns an exception from args.Exception.

  • Inserting Event
    This event is called before the inserting process is executed, you can grab the actual object that going to be inserted at e.NewObjectInstance where you might want to change things if necessary.
  • Inserted Event
    This event is called after the inserting process is executed, you can grab the Exception as usual if the ADO.NET Data Service returns an exception from args.Exception. You can also grab the return object from ADO.NET Data Service using args.ReturnValue.
  • Updating Event
    This event is called before the updating process is executed, you can grab the actual object that going to be updated at e.NewObjectInstance where you might want to change things if necessary. If you supply the original object (for Concurrency checking purpose) you can grab the object using e.OldObjectInstance.
  • Updated Event
    This event is called after the updating process is executed, you can grab the Exception as usual if the ADO.NET Data Service returns an exception from args.Exception. You can also grab the return object from ADO.NET Data Service using args.ReturnValue.
  • Deleting Event
    This event is called before the deleting process is executed, you can grab the actual object that going to be deleted at e.OldObjectInstancewhere you might want to change things if necessary.
  • Deleted Event
    This event is called after the deleting process is executed, you can grab the Exception as usual if the ADO.NET Data Service returns an exception from args.Exception. You can also grab the return object from ADO.NET Data Service using args.ReturnValue.

In all of this event you have e.ServiceName to distinguish operation between AstoriaDataService, so you can target the action accordingly per service.

Thats all for now.
Hope this clear things about how Astoria Data Source control works.

Regards
Andry

Written by ansoesil

February 11, 2009 at 4:52 pm

Virtual Scroll™ implementation in Intersoft Presenter™

with 3 comments

Hi,

In the past week I’ve been posting about several concept that we have around February 2009 CTP which includes Intersoft Presenter™ and Intersoft DataSource™. Today I want to highlight one of the features that we focus on in our early development.

When creating a control that shows data we must think of scalability and performance. Lets say a user want to show 10.000 records or more, if we render all of these records as Silverlight element, you can imagine how many resources it will take from our CPU, then what if we scroll them all together?

Considering this kind of condition, we try several ways to improve it and we come out with this Virtual Scroll™ concept. We’re adapting the concept we used in Intersoft CoverFlow’s Virtual Flow™ to this Virtual Scroll™ and enhance the necessary things accordingly.

Now you might wonder what’s the benefit of this Virtual Scroll™ concept.

  1. Better scalability and better performance.
  2. Better memory consumption
  3. Better user experience

To show the power of Virtual Scroll™, i’ve created a comparison sample that you can test it directly.

The sample contains a Wrap Panel from Silverlight Toolkit that was put inside a Scroll Viewer so we can scroll the content, and also Icon Presenter from Intersoft Presenter™.

virtualscroll1

Then we’re going to give both of control with 10.000 records of data.

virtualscroll2

virtualscroll3

You can see the video of this demo here.

Regards

Andry

Sample Link

Written by ansoesil

February 9, 2009 at 12:17 pm

Performing Child Data Retrieval using Intersoft DataSource™

with 13 comments

Hello,

I promised several of our respondents to have a sample that demonstrate capability to retrieve child collection from parent object using Intersoft Data Source™. So I’ll try to elaborate it in this post in detail with step by step approach.

  • Sign up and download the Intersoft Data Source™ CTP release from here.
  • Follow the steps to create Astoria (ADO.NET Data Service) connection and set the service reference to your Silverlight Application Project. (Here is the link)
  • Don’t forget to add reference to ISNet.Silverlight, ISNet.SIlverlight.DataSource and System.Windows.Controls.Data.
  • Lets start by creating the UI first.

In this sample I’m going to use three data grids to show Customers – Orders – Orders Details relationship. So the first Grid will show the list of Customers, the second Grid will show the Orders from selected customer in the Customers Data Grid, and the third Grid will show the Order Details from selected order in Orders Data Grid.

parentchildren1

  • Insert the Astoria Data Source and configure its settings.

parentchildren2

  • Since I want my grid to retrieve the child data when ever i select a row in the grid, I’m going to hook the SelectionChanged event in Customers Grid and Orders Grid

parentchildren3

  • Next we need to attached Selecting and Selected Event Handler in Astoria Data Source, so that we can control the data retrieval process later on.

parentchildren4

  • Everything is set, and now lets go to the code behind.
  • First of all we want the Application to load the data directly when application is loaded, therefore we need to call AstoriaDataSource1.Select(“Customers”) when the application is ready.

parentchildren5

  • Remember that we attached SelectionChanged event for Customers Grid and Orders Grid? Lets put some action into it.
    So we will retrieve Orders when an item in Customers Grid is selected, and we will retrieve Orders Details when an item in Orders Grid is selected.

parentchildren6

  • Now is the important part. When we call AstoriaDataSource1.Select(“Orders”) in CustomersGrid_SelectionChanged, we want it only to retrieve the Orders from selected item (Customer with specific CustomerID). So how can we handle this?
    Currently you need to handle it at Astoria Data Source’s Selecting Event Handler as follows.

parentchildren7

When you call AstoriaDataSource1.Select(“Orders”), it will asked the AstoriaDataSource to perform data retrieval process. You can interupt the process at two points which are at the beginning (Selecting) and at the ending (Selected). Since we want the AstoriaDataSource to select only Orders of current selected Customer, we need to provide advance query during Selecting event.

Customers customer = CustomersGrid.SelectedItem as Customers;

var query = from c in context.CreateQuery<Customers>(“Customers”).Expand(“Orders”)
where c.CustomerID == customer.CustomerID
select c;

DataServiceQuery<Customers> serviceQuery = query as DataServiceQuery<Customers>;
e.DataServiceQuery = serviceQuery;

By providing e.DataServiceQuery with an advanced query like this, the Astoria Data Source will compile it and send it to Astoria Data Service.

  • Lastly what you need to do is to handle the action when the data is retrieved at the Selected Event.

parentchildren8

Since Astoria sends the data back as collection of EntityDescriptor, we need to do additional Linq query to get the object collection correctly.

In the query i also put additional checking c.Entity.GetType() == typeof(Orders) is to filter out parent data when we’re doing child data retrieval.

parentchildren9

parentchildren101

  • And we’re done. Run your application and you’ll get something like this.

parentchildren11

parentchildren12

Regards
Andry

Sample Link

Written by ansoesil

February 6, 2009 at 6:14 am