public void UpdateUrlMonitoringInstance(UrlAddressMonitoringInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            var urlToUpdate = _urlAddresses.FirstOrDefault(x => x.Address == instance.Address);

            //Check for duplicate class key
            if (urlToUpdate == null)
            {
                throw new Exception("Unable to update instance, Could not find existing instance with same key property");
            }

            _urlInstanceEditor.ExecuteDiscovery(ScomDiscoveryType.Update, new UrlAddressMonitoringInstance[] { instance });

            int index = _urlAddresses.IndexOf(urlToUpdate);

            if (index != -1)
            {
                _urlAddresses[index] = instance;
            }

            InstanceUpdated?.Invoke(this, new UrlAddressInstanceEventArgs(instance));
        }
        public void AddUrlMonitoringInstance(UrlAddressMonitoringInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            //Check for duplicate class key
            if (_urlAddresses.FirstOrDefault(x => x.Address == instance.Address) != null)
            {
                throw new Exception("Unable to add new instance, Existing instance found with same key property");
            }

            _urlInstanceEditor.ExecuteDiscovery(ScomDiscoveryType.Insert, new UrlAddressMonitoringInstance[] { instance });
            _urlAddresses.Add(instance);

            InstanceAdded?.Invoke(this, new UrlAddressInstanceEventArgs(instance));
        }
 public InstanceValidationResult ValidateInstance(UrlAddressMonitoringInstance instance)
 {
     return(instance.Validate(_seedClass, _actionPointClass));
 }
 public void ConfigureUrlMonitoringInstance(UrlAddressMonitoringInstance instance)
 {
     ConfigureInstance?.Invoke(this, new UrlAddressInstanceEventArgs(instance));
 }