Welcome Guest, you are in: Login

FDOT Wiki

RSS RSS

GisFramework



Search the wiki
»

LayoutRendering

RSS
Modified on Monday, 18 July 2011 10:45 AM by 156.75.200.132 Categorized as Uncategorized
Components that have a visual presentation have a number of options on how to display the view. There are two main options: showing xaml user controls, or UI generation based on view models. Showing xaml user controls is more appropriate for advanced UI's, where the autogenerated is more useful for simpler data input UI's or for developer with less silverlight skill. Components can also show messages and errors to the user. The is responsible for all of the layout rendering is FDOT.GIS.Client.Domain.LayoutManager. All views are displayed in a floatable window.

Table of Contents [Hide/Show]


DialogServiceArgs
         Example
GenericViewDialog
         Properties
         Methods
         Events
ShowViewModel
ShowPanel
         Xaml Example
         ShowPanel Example
ShowMessage
      ShowMessage(string message)
         Example
      ShowMessage(string message,Timespan expireTimespan)
         Example
      ShowMessage(MessageViewModel message, TimeSpan timeSpan)
         Example
      MessageViewModel
         Properties
See Also


DialogServiceArgs

The location of the buttons is titlebar of the floatablewindow

The location of the buttons is titlebar of the floatablewindow

Many of the methods to show a view contain a parameter for FDOT.GIS.Client.Domain.DialogServiceArgs. These options control how the floatable window will be displayed

NameTypeDescription
BackContentFrameworkElementAllows the components to display a second view on the back side of the view.
CanResizeboolSets if the floatable window can be resized.
HasCloseButtonboolSets if the floatable window has a close button.
HasMinimizeButtonboolSets if the floatable window has a minimize button.
HasSettingsButtonboolSets if the floatable window has a settings button
Heightdouble?Sets the height of the floatable window.
HelpIdstring
IconBitmapImageThe icon that is used in the upper left corner of the floatable window.
IdstringThe identifier used to reference the window
IsModalboolSets if the floatable is Modal.
SettingsViewModelobjectSets the view model that will be used to generator a settings panel.
ShowSettingsOnBackbool
TitlestringThe title that is shown in the floatable window.
Widthdouble?The width of the floatable window.

Example


var dialog args=new DialogServiceArgs
{
  Id = "Sample",
  Title = "Sample Component Title",
  HelpId = "tools;" + GetType().FullName,
  Icon = Icon,
  ShowSettingsOnBack = true,
  SettingsViewModel = SettingsViewModel,
  HasCloseButton = true,
  HasMinimize = false	
}

GenericViewDialog

Both ShowPanel and ShowViewModel both return a FDOT.GIS.Client.ViewModel.GenericDialogViewModel for manipulation of the window. The GenericViewDialogViewModel allows the developer to programmatically close a window and has events to subscribe to for when dialog is closed.

Properties

NameTypeIsSettableDescription
ArgsDialogServiceArgstrue
BackContentFrameworkElementtrueThe view that is presented on the back of the view.
ContentFrameworkElementtrueThis is the view used on the front of the floatable window.
DisableFlipOnPanelClickboolfalseReturns if the flip for back content is disabled.
HasBackContentboolfalseReturns if the floatable window has back content.
HelpIdstringtrue
ShowHelpCommandICommandfalse
ShowHelpLinkboolfalseReturns if the help link is visible.
ShowSettingsButtonboolfalseReturns if the setting button is visible.
ShowSettingsCommandICommandfalse
VisibleContentFrameworkElementtrueReturns the currently visible content.

Methods

NameReturn TypeDescription
AttachView(object view,object context)void
Close()voidCloses the floatable window.
ShowSettingsDialog()voidShows the settings viewModel.
ToggleVisibleContent()voidToggles between the content and backcontent.

Events

NameDescription
ClosedAllows the component handle certain cleanup actions when the dialog closes

ShowViewModel

LayoutManager.ShowViewModel generates a view based on the viewModel. This allows components to be built very quickly without having to design xaml user controls. There are 7 overloads for the ShowViewModel method.


GenericDialogViewModel ShowViewModel(IComponentBase parentViewModel, object childViewModel, Action<ErrorEventArgs> errorHandler)

GenericDialogViewModel ShowViewModel(object viewModel, string id)

GenericDialogViewModel ShowViewModel(object viewModel, DialogServiceArgs args)GenericDialogViewModel ShowViewModel(object viewModel, DialogServiceArgs args, Action<ErrorEventArgs> errorHandler)

GenericDialogViewModel ShowViewModel(IComponentBase viewModel)

GenericDialogViewModel ShowViewModel(IComponentBase viewModel, DialogServiceArgs args)

GenericDialogViewModel ShowViewModel(IComponentBase viewModel, DialogServiceArgs args, Action<ErrorEventArgs> errorHandler)

There are a number of the attributes that can be set on the on properties to specify how the view should be generated. For more about how these attributes see Generated View Attributes.



ShowPanel

The ShowPanel allows custom user controls to be displayed to the users. This is can be used to display complicated layouts that can not be autogenerated from the ShowViewModel method.

Xaml Example


<UserControl x:Class="FDOT.GIS.Client.Components.Views.DrawToolView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ed="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
    xmlns:sdk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    mc:Ignorable="d" 
    xmlns:Converters="clr-namespace:FDOT.GIS.Client.Converters;assembly=FDOT.GIS.Client" 
    xmlns:controls="clr-namespace:FDOT.GIS.Client.Controls;assembly=FDOT.GIS.Client"
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <sdk:Label Grid.Row="0" Grid.Column="0" Content="Draw Color" VerticalAlignment="Center" />
        <StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" MinWidth="260" MinHeight="20" Margin="0,0,0,5">
            <controls:ColorSlider cal:Message.Attach="[Event ColorChanged]=[Action DrawColorChanged($eventArgs)];" HexColor="{Binding CurrentDrawColor, Mode=TwoWay}" />
        </StackPanel>
        
        <sdk:Label Grid.Row="1" Grid.Column="0" Content="Draw Type" VerticalAlignment="Center" />
        <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
            <controls:ShapeSelector cal:Message.Attach="[Event ShapeSelected]=[Action Draw($eventArgs)];" />
        </StackPanel>

        <sdk:Label Grid.Row="2" Grid.Column="0" Content="Show Labels" VerticalAlignment="Center" />
        <controls:SwitchButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding ShowLabels, Mode=TwoWay}" />

        <Button Grid.Row="3" Grid.Column="1" Margin="5" Content="Clear" cal:Message.Attach="[Event Click]=[Action Clear()];" />
    </Grid>
</UserControl>

ShowPanel Example


_dialogViewModel = LayoutManager.Instance.ShowPanel(drawView,
      new DialogServiceArgs
      {
          Title = this.ComponentConfiguration.Name,
          HelpId = "tools;" + GetType().FullName,
          Icon = Icon
      }); 

ShowMessage

Message Example

Message Example

The ShowMessage method allows messages to be displayed to the user. Messages can be shown with a variety of options and return a MessageViewModel to allow the updates of progress. There are three ShowMessage overloads.

ShowMessage(string message)

Allows the user to show a message without an expiration timeout. Returns a MessageViewModel.

Example

 var messageViewModel = LayoutManager.Instance.ShowMessage("Example");

ShowMessage(string message,Timespan expireTimespan)

Allows the user to show a message without an expiration timeout. Returns a MessageViewModel.

Example

 var messageViewModel=LayoutManager.Instance.ShowMessage("Example", new TimeSpan(0, 0, 10));

ShowMessage(MessageViewModel message, TimeSpan timeSpan)

Example


var message = new MessageViewModel { ShowProgress = true, Message = "Executing Identify" };
LayoutManager.Instance.ShowMessage(message, TimeSpan.Zero);

MessageViewModel

Example of Message with Progressbar

Example of Message with Progressbar

The messageViewModel object can be used to customize the message shown more with progess bars. It is also passed into the LayoutManager.RemoveMessage method to remove an existing message.

Properties

NameTypeDescription
IsProgressIndeterminateboolSets if the progress bar is indeterminate
MessagestringThe message shown in the message box.
Progressint?An int of 0-100 to show the current progress
ShowProgressboolDetermines if the progress bar is shown.

See Also

  Name Size
- FloatableWindowTitleBar.png 30.37 KB
- Message.PNG 3.48 KB
- ProgressBarMessage.PNG 1.57 KB
Any Questions or Comments? Email
Some of the icons created by FamFamFam.