/// <summary> /// Initializes the node manager. /// </summary> public ComAeClientNodeManager(IServerInternal server, string namespaceUri, ComAeClientConfiguration configuration, bool ownsTypeModel) : base(server, namespaceUri, ownsTypeModel) { SystemContext.SystemHandle = m_system = new ComAeClientManager(); SystemContext.NodeIdFactory = this; // save the configuration for the node manager. m_configuration = configuration; // set the alias root. AliasRoot = m_configuration.ServerName; if (String.IsNullOrEmpty(AliasRoot)) { AliasRoot = "AE"; } m_subscriptions = new Dictionary <SubscriptionIndex, ComAeSubscriptionClient>(); m_monitoredItems = new Dictionary <uint, ComAeSubscriptionClient>(); }
/// <summary> /// Initializes the node manager. /// </summary> public ComAeClientNodeManager(IServerInternal server, string namespaceUri, ComAeClientConfiguration configuration, bool ownsTypeModel) : base(server, namespaceUri, ownsTypeModel) { SystemContext.SystemHandle = m_system = new ComAeClientManager(); SystemContext.NodeIdFactory = this; // save the configuration for the node manager. m_configuration = configuration; // set the alias root. AliasRoot = m_configuration.ServerName; if (String.IsNullOrEmpty(AliasRoot)) { AliasRoot = "AE"; } m_subscriptions = new Dictionary<SubscriptionIndex,ComAeSubscriptionClient>(); m_monitoredItems = new Dictionary<uint,ComAeSubscriptionClient>(); }
/// <summary> /// Initializes a new instance of the <see cref="ComAeSubscriptionClient"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="configuration">The configuration.</param> /// <param name="cache">The cache for known types.</param> /// <param name="namespaceIndex">The namespace index for the event types.</param> /// <param name="manager">The manager.</param> /// <param name="monitoredItem">The monitored item.</param> public ComAeSubscriptionClient( ServerSystemContext context, ComAeClientConfiguration configuration, AeTypeCache cache, ushort namespaceIndex, ComAeClientManager manager, MonitoredItem monitoredItem) { m_defaultContext = context; m_separators = configuration.SeperatorChars; m_cache = cache; m_namespaceIndex = namespaceIndex; m_manager = manager; m_refreshComplete = new ManualResetEvent(false); m_monitoredItems = new List <MonitoredItem>(); m_monitoredItems.Add(monitoredItem); m_qualifiedName = null; m_isSource = false; NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle; AeAreaState area = handle.Node as AeAreaState; if (area != null) { m_qualifiedName = area.QualifiedName; m_isSource = false; } else { AeSourceState source = handle.Node as AeSourceState; if (source != null) { m_qualifiedName = source.QualifiedName; m_isSource = true; } } }
/// <summary> /// Initializes a new instance of the <see cref="ComAeSubscriptionClient"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="configuration">The configuration.</param> /// <param name="cache">The cache for known types.</param> /// <param name="namespaceIndex">The namespace index for the event types.</param> /// <param name="manager">The manager.</param> /// <param name="monitoredItem">The monitored item.</param> public ComAeSubscriptionClient( ServerSystemContext context, ComAeClientConfiguration configuration, AeTypeCache cache, ushort namespaceIndex, ComAeClientManager manager, MonitoredItem monitoredItem) { m_defaultContext = context; m_separators = configuration.SeperatorChars; m_cache = cache; m_namespaceIndex = namespaceIndex; m_manager = manager; m_refreshComplete = new ManualResetEvent(false); m_monitoredItems = new List<MonitoredItem>(); m_monitoredItems.Add(monitoredItem); m_qualifiedName = null; m_isSource = false; NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle; AeAreaState area = handle.Node as AeAreaState; if (area != null) { m_qualifiedName = area.QualifiedName; m_isSource = false; } else { AeSourceState source = handle.Node as AeSourceState; if (source != null) { m_qualifiedName = source.QualifiedName; m_isSource = true; } } }
/// <summary> /// Initializes a new instance of the <see cref="ComAeClient"/> class. /// </summary> /// <param name="configuration"></param> public ComAeClient(ComAeClientConfiguration configuration) : base(configuration) { m_configuration = configuration; }
/// <summary> /// Handles the Click event of the OkBTN control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void OkBTN_Click(object sender, EventArgs e) { try { if (ServersLV.SelectedItems.Count != 1) { return; } // extract the wrapper configuration from the application configuration. ComWrapperServerConfiguration wrapperConfig = m_configuration.ParseExtension<ComWrapperServerConfiguration>(); if (wrapperConfig == null) { wrapperConfig = new ComWrapperServerConfiguration(); } if (wrapperConfig.WrappedServers == null) { wrapperConfig.WrappedServers = new ComClientConfigurationCollection(); } // get the selected server. Item item = (Item)ServersLV.SelectedItems[0].Tag; // create a new new COM client entry for the selected server. ComClientConfiguration clientConfig = null; if (item.Specification == Specification.Da20 || item.Specification == Specification.Da30) { clientConfig = new ComDaClientConfiguration(); } else if (item.Specification == Specification.Ae10) { clientConfig = new ComAeClientConfiguration(); } else if (item.Specification == Specification.Hda10) { clientConfig = new ComHdaClientConfiguration(); } clientConfig.ServerUrl = item.Server.Url; clientConfig.ServerName = item.Server.VersionIndependentProgId; clientConfig.MaxReconnectWait = 100000; wrapperConfig.WrappedServers.Add(clientConfig); // update the configuration. m_configuration.UpdateExtension<ComWrapperServerConfiguration>(null, wrapperConfig); // close the dialog. DialogResult = DialogResult.OK; } catch (Exception exception) { MessageBox.Show(exception.Message); } }