예제 #1
0
        /// <summary>
        /// 引发 DataChange 事件。
        /// </summary>
        /// <param name="e">事件参数。</param>
        protected virtual void OnDataChange(OpcGroupDataChangeEventArgs e)
        {
            EventHandler <OpcGroupDataChangeEventArgs> handler = this.DataChange;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #2
0
 void serviceCallback_DataChange(object sender, OpcGroupDataChangeEventArgs e)
 {
     this.OnDataChange(e);
 }
예제 #3
0
        void KEPServerExRelayServiceProxy_Instance_DataChange(object sender, OpcGroupDataChangeEventArgs e)
        {
            foreach (OpcGroupDataChangeEventArgsItem eItem in e.Items)
            {
                try
                {
                    //所有点位都是 bool 型
                    if (!string.IsNullOrEmpty(eItem.ValueText))
                    {
                        bool value = bool.Parse(eItem.ValueText);

                        if (value)
                        {
                            if (eItem.OpcItemID == this.opcItemChannel1RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[1].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel1ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[1].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel2RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[2].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel2ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[2].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel3RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[3].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel3ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[3].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel4RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[4].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel4ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[4].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel5RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[5].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel5ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[5].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel6RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[6].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel6ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[6].PerformReverseRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel7RotationStartName)
                            {
                                this.channelRotationOpcByChannelId[7].PerformRotationStart();
                            }
                            else if (eItem.OpcItemID == this.opcItemChannel7ReverseRotationStartName)
                            {
                                this.channelRotationOpcByChannelId[7].PerformReverseRotationStart();
                            }
                        }
                    }
                }
                catch { }
            }
        }