Mono exception to SocketException
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Core.Presentation / System / ServiceModel / Activities / Presentation / SendContentDialog.xaml.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.ServiceModel.Activities.Presentation
6 {
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;
12     using System.Windows;
13     using System.Windows.Input;
14
15     partial class SendContentDialog : WorkflowElementDialog
16     {
17         public static readonly DependencyProperty ViewModelProperty =
18             DependencyProperty.Register("ViewModel", typeof(ContentDialogViewModel<SendMessageContent, SendParametersContent>), typeof(SendContentDialog));
19
20         SendContentDialog()
21         {
22             InitializeComponent();
23         }
24
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         SendContentDialog(ModelItem activity, EditingContext context, DependencyObject owner)
28             : this()
29         {
30             this.ModelItem = activity;
31             this.Context = context;
32             this.HelpKeyword = HelpKeywords.MessageContentDialog;
33             this.Owner = owner;
34             this.ViewModel = new ContentDialogViewModel<SendMessageContent, SendParametersContent>(this.ModelItem);
35             if (!this.Context.Items.GetValue<ReadOnlyState>().IsReadOnly)
36             {
37                 this.OnOk = this.ViewModel.OnOk;
38             }
39         }
40
41         public ContentDialogViewModel<SendMessageContent, SendParametersContent> ViewModel
42         {
43             get { return (ContentDialogViewModel<SendMessageContent, SendParametersContent>)GetValue(ViewModelProperty); }
44             set { SetValue(ViewModelProperty, value); }
45         }
46
47         public static bool ShowDialog(ModelItem activity, EditingContext context, DependencyObject owner)
48         {
49             return new SendContentDialog(activity, context, owner).ShowOkCancel();
50         }
51
52         void OnDynamicArgumentDesignerLoaded(object sender, RoutedEventArgs args)
53         {
54             ((DynamicArgumentDesigner)sender).ParentDialog = this;
55         }
56
57         void OnExpressionTextBoxLoaded(object sender, RoutedEventArgs args)
58         {
59             ((ExpressionTextBox)sender).IsIndependentExpression = true;
60         }
61     }
62 }