15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Workflows ❘ 1333<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

code download 08_DesignerRehosting<br />

It is a fairly simple layout with a main menu <strong>and</strong> then a grid that defines placeholders for the toolbox,<br />

designer, <strong>and</strong> property grid. You’ll notice that everything is bound, including the comm<strong>and</strong>s.<br />

The ViewModel we’ve created consists of properties for each of the main UI elements — those being the<br />

Toolbox, Designer, <strong>and</strong> Property Grid. In addition to these properties there are also properties for each<br />

comm<strong>and</strong>, such as New, Save, <strong>and</strong> Exit.<br />

public class ViewModel : BaseViewModel<br />

{<br />

public ViewModel()<br />

{<br />

// Ensure all designers are registered for inbuilt activities<br />

new DesignerMetadata().Register();<br />

}<br />

public void InitializeViewModel(Activity root)<br />

{<br />

_designer = new WorkflowDesigner();<br />

_designer.Load(root);<br />

}<br />

this.OnPropertyChanged("DesignerView");<br />

this.OnPropertyChanged("PropertyInspectorView");<br />

public UIElement DesignerView<br />

{<br />

get { return _designer.View; }<br />

}<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!