Welcome Guest, you are in: Login

FDOT Wiki

RSS RSS

GisFramework



Search the wiki
»
The toolset needed to develop new components is Visual Studio 2010. Components need to be developed as Silverlight 4.0 Applications. New components that are developed for the framework need to meet the following guideline to work properly. All components will need to implement IComponentBase and be exportable through MEF. Components are then configured to run on a virtual application.

ComponentBase

See Main Article ComponentBase

All components that are used in the framework must implement the interface IComponentBase. A abstract class ComponentBase has been created to ease the implementation if inheriting from other classes is unnecessary. All components are required to provide a BitmapImage for an icon as well as a HelpView. There are two methods in the interface: Initialize and Execute. Initialize is called only one time when the application is initally loading. Execute is called anytime the component is clicked in the toolbar or it's hotkey has been entered.

MEF Exporting

Components in the framework are dynamically loaded through MEF(Managed Extensibility Framework). This framework also allows the basis for the plugin features of the framework. To allow a component to be exported to the framework the component class needs to have attributes added to it.

Required Attributes

  1. System.ComponentModel.Composition.Export - This attribute needs to be added at the class level with the export type of IComponentBase.
  2. System.ComponentModel.Composition.PartCreationPolicyAttribute - This attribute is added at the class level to tell how the exported part will be created. There are three options.
    1. Any - Specifies that the most appropriate Creation policy will be used for the part based on the current context.
    2. NonShared - Specifies that a new non-shared instance of the associated part will be created for every requestor.
    3. Shared - Specifies that a single shared instance of the associated part will be created and shared by all requestors.

Example


[Export(typeof(IComponentBase))]
 [PartCreationPolicy(CreationPolicy.Shared)]
    public class SampleComponent:IComponentBase
    {
    }

Using a LayoutManager Generated UI

Following the MVVM pattern, the framework provides support for creating a basic view based on a viewmodel. This can be a convenient way of providing a UI for a custom component without having to create the XAML markup for a view or manage property and method bindings between the view and viewmodel. The following example calls the LayoutManager in order to show a dialog when the component is executed.

Example - using the LayoutManager to build a dialog


private GenericDialogViewModel _dialogViewModel;
protected override void OnExecute()
{
    // Show the dialog for this component using the LayoutManager
    _dialogViewModel = LayoutManager.Instance.ShowViewModel(this, 
                                    new DialogServiceArgs
                                    {
                                        Id="MyComponent",
                                        Title = this.ComponentConfiguration.Name,
                                        HelpId = "tools;" + GetType().FullName,
                                        Icon = Icon
                                    });

    _dialogViewModel.Closed += OnClose;
}

private void OnClose(object sender, EventArgs e)
{   _dialogViewModel = null;   }

When building a view, the LayoutManager relies on GeneratedViewAttributes to determine what properties and methods to display on the dialog, which to ignore, and what text and tooltips to show along with the rendered controls.



Silverlight Gis Framework Api

See Main Article Silverlight Gis Framework Api

The silverlight application contains an extensive api to allow the interaction with the map, displaying results, and window management.

Server Side/Database Interaction

See Main Article Server Side/Database Interaction

All components are running on the client so direct database interaction is not possble directly from silverlight. Instead database calls should be called from the serverside by using WCF (Windows Communication Foundation) service calls.

Component Deployment

Once the component is complete then the silverlight application is built to create a xap file. For the Gis Framework to recognize the new component, the xap file for the component is dropped in the clientbin folder of the website.

One important note is for the references to FDOT.GIS.Client or FDOT.GIS.Client.Components must be set to copy local or errors in loading the framework will occur.

The following assembly references should also be set to copy local if used because they are already included in the FDOT.GIS.Client xap. Setting copy local to false will greatly reduce the size of the xap file containing the component.

  • Blacklight.Controls
  • Caliburn.Micro.Silverlight
  • FDOT.GIS.Constants
  • FDOT.GIS.DataContracts
  • FDOT.GIS.GeometryUtilities
  • FiftyNine.Ag.OpenXml.Common
  • FiftyNine.Ag.OpenXml.Word
  • ImageTools
  • ImageTools.IO.Png
  • ImageTools.Utils
  • Microsoft.Expression.Drawing
  • Microsoft.Expression.Effects
  • Microsoft.Expression.Interactions
  • Microsoft.Expression.Prototyping.Interactivity
  • mscorlib
  • Newtonsoft.Json.Silverlight
  • OpenXML.Silverlight.Spreadsheet
  • Polenter.SharpSerializer.Silverlight
  • ScrewTurnWiki.Core
  • SharpZipLib.Silverlight4
  • system
  • System.ComponentModel.Composition
  • System.ComponentModel.Composition.Initialization
  • System.ComponentModel.DataAnnotations
  • System.Core
  • System.Net
  • System.Runtime.Serialization
  • System.ServiceModel
  • System.ServiceModel.DomainServices.Client
  • System.ServiceModel.DomainServices.Client.Web
  • System.ServiceModel.Web
  • System.ServiceModel.Web.Extensions
  • System.Windows
  • System.Windows.Browser
  • System.Windows.Controls
  • System.Windows.Controls.Data
  • System.Windows.Controls.Data.DataForm.Toolkit
  • System.Windows.Controls.Data.Input
  • System.Windows.Controls.DataVisualization.Toolkit
  • System.Windows.Controls.DomainServices
  • System.Windows.Controls.Input
  • System.Windows.Controls.Input.Toolkit
  • System.Windows.Controls.Layout.Toolkit
  • System.Windows.Controls.Navigation
  • System.Windows.Controls.Toolkit
  • System.Windows.Controls.Toolkit.Internals
  • System.Windows.Data
  • System.Windows.Interactivity
  • System.Xml
  • System.Xml.Linq
  • WriteableBitmapEx
    ==Complete Examples==

See Also

Any Questions or Comments? Email
Some of the icons created by FamFamFam.