Welcome to TechNet Blogs Sign in | Join | Help

A sample solution kit to demonstrate WPF & SQL Server Data Services Technologies-Part 2

The WCFServicesAgent Project has 2 functionalities:

1.Act as  proxy client for Workshop Service which has exposed below two  methods:-

-------------------------------------------------------------- 

[OperationContract]
      List<Entity> QuEntityList(string kind);       

[OperationContract]
    CompositeType  GetBlob(string entityid, string accepttype);

-----------------------------------------------------------------

2.  Xmlhelper.cs class : this is  to fetch workshop data from SSDS and cache in client local file folder c:\workshopdata, it has implemented below 2 methods:-

public static bool CreatXml_WSList(string _savePath){}
public static bool CreatXml_WSData(string _path, string _key)

So, by default, DPEMS Project will access the workshop data from local file cache instead of SSDS for most efficiency. To refresh the local cache, you can open Main.Xaml.cs of DPEMS Project and uncomment below code line in  Function MainGrid_Loaded() :

------------------------------------------------------------------------------------

 private void MainGrid_Loaded(object sender, RoutedEventArgs e)
        {
            //Enable here to refresh workshop data from SSDS
            //WCFServicesAgent.Xmlhelper.CreatXml_WSList("c:\\");
           // WCFServicesAgent.Xmlhelper.CreatXml_WSData( "c:\\WorkShopData\\", "Pic");
           // WCFServicesAgent.Xmlhelper.CreatXml_WSData("c:\\WorkShopData\\", "Doc");
           // WCFServicesAgent.Xmlhelper.CreatXml_WSData("c:\\WorkShopData\\", "Video");
        }


 

The Client Project DPEMS is architected via Composite Application for WPF Patterns ,

Figure1. Composite Application for WPF 

It mainly exposed two patterns:-

1. The Model-View-Presenter Pattern: Each Module has MVP implemented. Take a look at WorkshopModule Project ,each view file has a corresponding presenter file. e.g. WorkShopMain.xaml contains XAML UI Interface while  WorkShopMainPresenter.cs handles XAML user event & business logic to process model.  Also, all domain entity classes are in Model folder.

Solution Structure

Figure 2. Project structure

2.The Modularity Pattern:  Each WPF Modules such as WorkshopModule,ISVExplorerModule is a separate WPF Project , and the main client project DPEMS contains a Shell XAML file - the Main.xaml file which will assemble all WPF modules. It's mainly done via  Prism Regions concept. The related XAML snippet is as below:-

----------------------------------

 <ItemsControl cal:RegionManager.RegionName="WorkShopRegion" Panel.ZIndex="0"   Width="auto" />

<ItemsControl cal:RegionManager.RegionName="ISVExplorRegion" x:Name="ISVExplorRegion"   Width="auto"   Visibility="Hidden" >

-----------------------------

In each Module Project, there will be a Class file inheriting Microsoft.Practices.Composite.ModularityIModule interface to add the Module XAML view to Shell when module is initialized. e.g.WorkShopModule.cs is like below:-

---------------------

 public class WorkShopModule:IModule
    {
      
         public IRegionManager RegionManager { get; private set; }
  
         public WorkShopModule(IRegionManager regionManager)
        {
            this.RegionManager = regionManager;
        }
         public void Initialize()
         {
          
             IRegion mainRegion = this.RegionManager.Regions["WorkShopRegion"];
             WorkShopMain view = new WorkShopMain();
             mainRegion.Add(view);
             mainRegion.Activate(view);
         }
    }

-------------------------------------

Note that we also have 3 separate projects for reusable WPF controls, they are

crfly.PhotoBookControl project- the WPF control to animate paging-up-down effect of Albums.

Kiosk.Controls.VolumeChart project-WPF Chart control

WpfVirtualEarthControl Project - WPF Virtual Earth control

AlbumChart

Figure 3:Album Animation                                           Figure4: Main Dashboard for Workshop Module including Chart  WPF control

Virtual Earth

Figure 5: Main Dashboard for ISVExplorer module including VirtualEarth WPF Control

Now, we've finished all introduction of this solution kit, you can download source code of this solution from here.

 

Published Wednesday, September 10, 2008 3:18 AM by yanwang

Comments

No Comments

Anonymous comments are disabled
 
Page view tracker