-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathServiceControlEditViewModel.cs
More file actions
204 lines (169 loc) · 6.79 KB
/
ServiceControlEditViewModel.cs
File metadata and controls
204 lines (169 loc) · 6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
namespace ServiceControl.Config.UI.InstanceEdit
{
using System;
using System.Collections.Generic;
using System.Windows.Input;
using InstanceAdd;
using PropertyChanged;
using Extensions;
using ServiceControlInstaller.Engine.Instances;
using Validar;
using Xaml.Controls;
[InjectValidation]
public class ServiceControlEditViewModel : ServiceControlEditorViewModel
{
public ServiceControlEditViewModel(ServiceControlInstance instance)
{
DisplayName = "EDIT SERVICECONTROL INSTANCE";
ServiceControlInstance = instance;
ServiceControl.UpdateFromInstance(instance);
SelectedTransport = instance.TransportPackage;
ConnectionString = instance.ConnectionString;
}
//This is used for unit testing
internal ServiceControlEditViewModel()
{
}
public ServiceControlInstance ServiceControlInstance { get; set; }
public void UpdateInstanceFromViewModel(ServiceControlInstance instance)
{
instance.HostName = ServiceControl.HostName;
instance.Port = Convert.ToInt32(ServiceControl.PortNumber);
instance.LogPath = ServiceControl.LogPath;
instance.ErrorQueue = ServiceControl.ErrorQueueName;
instance.ErrorLogQueue = ServiceControl.ErrorForwardingQueueName;
instance.ErrorRetentionPeriod = ServiceControl.ErrorRetentionPeriod;
instance.ForwardErrorMessages = ServiceControl.ErrorForwarding.Value;
instance.ConnectionString = ConnectionString;
instance.DatabaseMaintenancePort = Convert.ToInt32(ServiceControl.DatabaseMaintenancePortNumber);
instance.EnableFullTextSearchOnBodies = ServiceControl.EnableFullTextSearchOnBodies.Value;
instance.EnableIntegratedServicePulse = ServiceControl.EnableIntegratedServicePulse.Value;
}
public string InstanceName => ServiceControl.InstanceName;
[AlsoNotifyFor(nameof(HostNameWarning))]
public string HostName
{
get => ServiceControl.HostName;
set => ServiceControl.HostName = value;
}
public string HostNameWarning
{
get => ServiceControl.HostNameWarning;
set => ServiceControl.HostNameWarning = value;
}
[AlsoNotifyFor(
nameof(PasswordEnabled),
nameof(ServiceAccount),
nameof(Password))]
public bool UseSystemAccount
{
get => ServiceControl.UseSystemAccount;
set => ServiceControl.UseSystemAccount = value;
}
[AlsoNotifyFor(
nameof(PasswordEnabled),
nameof(ServiceAccount),
nameof(Password))]
public bool UseServiceAccount
{
get => ServiceControl.UseServiceAccount;
set => ServiceControl.UseServiceAccount = value;
}
[AlsoNotifyFor(nameof(PasswordEnabled),
nameof(ServiceAccount),
nameof(Password))]
public bool UseProvidedAccount
{
get => ServiceControl.UseProvidedAccount;
set => ServiceControl.UseProvidedAccount = value;
}
public string ServiceAccount
{
get => ServiceControl.ServiceAccount;
set => ServiceControl.ServiceAccount = value;
}
public string Password
{
get => ServiceControl.Password;
set => ServiceControl.Password = value;
}
public bool PasswordEnabled
{
get
{
if (!UseProvidedAccount)
{
return false;
}
if (ServiceAccount != null && ServiceAccount.EndsWith("$"))
{
return false;
}
return true;
}
}
public bool ManagedAccount => ServiceControl.ManagedAccount;
public string PortNumber
{
get => ServiceControl.PortNumber;
set => ServiceControl.PortNumber = value;
}
public string DatabaseMaintenancePortNumber
{
get => ServiceControl.DatabaseMaintenancePortNumber;
set => ServiceControl.DatabaseMaintenancePortNumber = value;
}
public string LogPath
{
get => ServiceControl.LogPath;
set => ServiceControl.LogPath = value.SanitizeFilePath();
}
public ICommand SelectLogPath
{
get => ServiceControl.SelectLogPath;
set => ServiceControl.SelectLogPath = value;
}
public int MinimumErrorRetentionPeriod => ServiceControl.MinimumErrorRetentionPeriod;
public int MaximumErrorRetentionPeriod => ServiceControl.MaximumErrorRetentionPeriod;
public TimeSpanUnits ErrorRetentionUnits => ServiceControl.ErrorRetentionUnits;
public double ErrorRetention
{
get => ServiceControl.ErrorRetention;
set => ServiceControl.ErrorRetention = value;
}
public bool ShowErrorForwardingQueue => ErrorForwarding?.Value ?? false;
public string ErrorQueueName
{
get => ServiceControl.ErrorQueueName;
set => ServiceControl.ErrorQueueName = value;
}
public IEnumerable<ForwardingOption> ErrorForwardingOptions => ServiceControl.ErrorForwardingOptions;
[AlsoNotifyFor(nameof(ErrorForwardingWarning), nameof(ErrorForwardingQueueName))]
public ForwardingOption ErrorForwarding
{
get => ServiceControl.ErrorForwarding;
set => ServiceControl.ErrorForwarding = value;
}
public string ErrorForwardingWarning => ServiceControl.ErrorForwardingWarning;
public string ErrorForwardingQueueName
{
get => ServiceControl.ErrorForwardingQueueName;
set => ServiceControl.ErrorForwardingQueueName = value;
}
public IEnumerable<EnableFullTextSearchOnBodiesOption> EnableFullTextSearchOnBodiesOptions =>
ServiceControl.EnableFullTextSearchOnBodiesOptions;
public EnableFullTextSearchOnBodiesOption EnableFullTextSearchOnBodies
{
get => ServiceControl.EnableFullTextSearchOnBodies;
set => ServiceControl.EnableFullTextSearchOnBodies = value;
}
public IEnumerable<EnableIntegratedServicePulseOption> EnableIntegratedServicePulseOptions =>
ServiceControl.EnableIntegratedServicePulseOptions;
public EnableIntegratedServicePulseOption EnableIntegratedServicePulse
{
get => ServiceControl.EnableIntegratedServicePulse;
set => ServiceControl.EnableIntegratedServicePulse = value;
}
public bool SubmitAttempted { get; set; }
}
}