コード例 #1
0
        public bool CreateDAGroupAsync(GroupProperties properties, Action<WorkerThread.Task, RunWorkerCompletedEventArgs> completed)
        {
            return DoAsync((task, args) =>
            {
                args.Result = server.AddGroup(
                    Interlocked.Increment(ref daGroupClientId),
                    properties.Name,
                    properties.Active,
                    properties.UpdateRate,
                    properties.PercentDeadband);
            },
            (task, args) =>
            {
                Children.Add(new DAGroupNode(this, (Group)args.Result));

                completed(task, args);
            });
        }
コード例 #2
0
        /// <summary>
        /// Sets new OPC DA group properties.
        /// </summary>
        /// <param name="properties">New OPC DA group properties.</param>
		public void SetProperties(GroupProperties properties)
		{
			if(@group == null)
				throw new ObjectDisposedException("Group");

			int revisedUpdateRate;
			groupManagement.SetState(
				properties.UpdateRate, 
				out revisedUpdateRate, 
				properties.Active ? 1 : 0, 
				properties.TimeBias, 
				properties.PercentDeadband, 
				properties.Locale.LCID, 
				properties.ClientId);

			ClientId = properties.ClientId;
			UpdateRate = revisedUpdateRate;

			if(!string.Equals(properties.Name, Name))
				groupManagement.SetName(properties.Name);
			Name = properties.Name;
		}