/// <summary> /// Validates the configured url and adds or updates the monitoring instance /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _view_ConfiguredUrl(object sender, UrlAddressInstanceEventArgs e) { var instance = new UrlAddressMonitoringInstance { Address = _view.Address, Description = _view.Description, DisplayName = _view.DisplayName, DnsServers = _view.CustomDnsServers, DnsServersTimeout = _view.DnsTimeout, ProxyAddress = _view.Proxy, ActingAgent = _view.ActionPoint?.DisplayName, ActionPoint = _view.ActionPoint }; try { var valid = _model.ValidateInstance(instance); if (!valid.IsValid) { _view.SetErrors(valid.Errors); return; } //Update or create instance if (string.IsNullOrEmpty(_view.Instance.Address)) { _model.AddUrlMonitoringInstance(instance); } else { _model.UpdateUrlMonitoringInstance(instance); } _view.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid instance", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public UrlAddressInstanceEventArgs(UrlAddressMonitoringInstance instance = null) { Instances = new UrlAddressMonitoringInstance[] { instance }; }