public MonitoringEditViewModel(MonitoringInstance instance) { DisplayName = "EDIT MONITORING INSTANCE"; SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); InstanceName = instance.Name; Description = instance.Description; var userAccount = UserAccount.ParseAccountName(instance.ServiceAccount); UseSystemAccount = userAccount.IsLocalSystem(); UseServiceAccount = userAccount.IsLocalService(); UseProvidedAccount = !(UseServiceAccount || UseSystemAccount); if (UseProvidedAccount) { ServiceAccount = instance.ServiceAccount; } HostName = instance.HostName; PortNumber = instance.Port.ToString(); LogPath = instance.LogPath; ErrorQueueName = instance.ErrorQueue; SelectedTransport = instance.TransportPackage; ConnectionString = instance.ConnectionString; MonitoringInstance = instance; }
public MonitoringAddViewModel() { DisplayName = "ADD MONITORING INSTANCE"; SelectDestinationPath = new SelectPathCommand(p => DestinationPath = p, isFolderPicker: true, defaultPath: DestinationPath); SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); var monitoringInstances = InstanceFinder.MonitoringInstances(); if (!monitoringInstances.Any()) { InstanceName = "Particular.Monitoring"; PortNumber = "33633"; } else { var i = 0; while (true) { InstanceName = $"Particular.Monitoring.{++i}"; if (!monitoringInstances.Any(p => p.Name.Equals(InstanceName, StringComparison.OrdinalIgnoreCase))) { break; } } } Description = "A Monitoring Instance"; HostName = "localhost"; ErrorQueueName = "error"; UseSystemAccount = true; }
public ServiceControlEditViewModel(ServiceControlInstance instance) { DisplayName = "EDIT SERVICECONTROL INSTANCE"; SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); InstanceName = instance.Name; Description = instance.Description; var userAccount = UserAccount.ParseAccountName(instance.ServiceAccount); UseSystemAccount = userAccount.IsLocalSystem(); UseServiceAccount = userAccount.IsLocalService(); UseProvidedAccount = !(UseServiceAccount || UseSystemAccount); if (UseProvidedAccount) { ServiceAccount = instance.ServiceAccount; } HostName = instance.HostName; PortNumber = instance.Port.ToString(); DatabaseMaintenancePortNumber = instance.DatabaseMaintenancePort.ToString(); DatabaseMaintenancePortNumberRequired = instance.Version.Major >= 2; LogPath = instance.LogPath; AuditForwardingQueueName = instance.AuditLogQueue; AuditQueueName = instance.AuditQueue; AuditForwarding = AuditForwardingOptions.FirstOrDefault(p => p.Value == instance.ForwardAuditMessages); ErrorForwarding = ErrorForwardingOptions.FirstOrDefault(p => p.Value == instance.ForwardErrorMessages); UpdateErrorRetention(instance.ErrorRetentionPeriod); UpdateAuditRetention(instance.AuditRetentionPeriod); ErrorQueueName = instance.ErrorQueue; ErrorForwardingQueueName = instance.ErrorLogQueue; SelectedTransport = Transports.First(t => StringComparer.InvariantCultureIgnoreCase.Equals(t.Name, instance.TransportPackage)); ConnectionString = instance.ConnectionString; ServiceControlInstance = instance; ErrorForwardingVisible = instance.Version >= SettingsList.ForwardErrorMessages.SupportedFrom; //Both Audit and Error Retention Property was introduced in same version RetentionPeriodsVisible = instance.Version >= SettingsList.ErrorRetentionPeriod.SupportedFrom; }
public ServiceControlAddViewModel() { DisplayName = "ADD SERVICECONTROL INSTANCE"; SelectDestinationPath = new SelectPathCommand(p => DestinationPath = p, isFolderPicker: true, defaultPath: DestinationPath); SelectDatabasePath = new SelectPathCommand(p => DatabasePath = p, isFolderPicker: true, defaultPath: DatabasePath); SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); var serviceControlInstances = InstanceFinder.ServiceControlInstances(); if (!serviceControlInstances.Any()) { InstanceName = "Particular.ServiceControl"; PortNumber = "33333"; DatabaseMaintenancePortNumber = "33334"; } else { var i = 0; while (true) { InstanceName = $"Particular.ServiceControl.{++i}"; if (!serviceControlInstances.Any(p => p.Name.Equals(InstanceName, StringComparison.OrdinalIgnoreCase))) { break; } } } AuditRetention = SettingConstants.AuditRetentionPeriodDefaultInHoursForUI; ErrorRetention = SettingConstants.ErrorRetentionPeriodDefaultInDaysForUI; Description = "A ServiceControl Instance"; HostName = "localhost"; AuditQueueName = "audit"; AuditForwardingQueueName = "audit.log"; AuditForwarding = AuditForwardingOptions.First(p => !p.Value); //Default to Off. ErrorQueueName = "error"; ErrorForwardingQueueName = "error.log"; ErrorForwarding = ErrorForwardingOptions.First(p => !p.Value); //Default to Off. UseSystemAccount = true; }
protected SharedServiceControlEditorViewModel() { SelectDestinationPath = new SelectPathCommand(p => DestinationPath = p, isFolderPicker: true, defaultPath: DestinationPath); SelectDatabasePath = new SelectPathCommand(p => DatabasePath = p, isFolderPicker: true, defaultPath: DatabasePath); SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); }
private void RaiseCanExecuteChanged() { SelectPathCommand.RaiseCanExecuteChanged(); ExecuteCommand.RaiseCanExecuteChanged(); CancelCommand.RaiseCanExecuteChanged(); }