1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.ServiceModel.Activities.Presentation
7 using System.Activities.Presentation;
8 using System.Activities.Presentation.Hosting;
9 using System.Activities.Presentation.Model;
10 using System.Activities.Presentation.View;
11 using System.Diagnostics.CodeAnalysis;
13 using System.Windows.Input;
15 partial class ReceiveContentDialog : WorkflowElementDialog
17 public static readonly DependencyProperty ViewModelProperty =
18 DependencyProperty.Register("ViewModel", typeof(ContentDialogViewModel<ReceiveMessageContent, ReceiveParametersContent>), typeof(ReceiveContentDialog));
20 ReceiveContentDialog()
22 InitializeComponent();
25 [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors",
26 Justification = "This values must be set before this constructor complete to ensure ShowOkCancel() can consume that immediately")]
27 ReceiveContentDialog(ModelItem activity, EditingContext context, DependencyObject owner)
30 this.ModelItem = activity;
31 this.Context = context;
32 this.HelpKeyword = HelpKeywords.MessageContentDialog;
34 this.ViewModel = new ContentDialogViewModel<ReceiveMessageContent, ReceiveParametersContent>(this.ModelItem);
35 if (!this.Context.Items.GetValue<ReadOnlyState>().IsReadOnly)
37 this.OnOk = this.ViewModel.OnOk;
41 public ContentDialogViewModel<ReceiveMessageContent, ReceiveParametersContent> ViewModel
43 get { return (ContentDialogViewModel<ReceiveMessageContent, ReceiveParametersContent>)GetValue(ViewModelProperty); }
44 set { SetValue(ViewModelProperty, value); }
47 public static bool ShowDialog(ModelItem activity, EditingContext context, DependencyObject owner)
49 return new ReceiveContentDialog(activity, context, owner).ShowOkCancel();
52 void OnDynamicArgumentDesignerLoaded(object sender, RoutedEventArgs args)
54 ((DynamicArgumentDesigner)sender).ParentDialog = this;
57 void OnExpressionTextBoxLoaded(object sender, RoutedEventArgs args)
59 ((ExpressionTextBox)sender).IsIndependentExpression = true;