Esempio n. 1
0
 private void GetConditionStateButtonOnClick(object sender, System.EventArgs e)
 {
     if (conditionlistView.SelectedItems.Count != 0)
     {
         AeCondition      condition      = ((AeCondition)conditionlistView.SelectedItems[0].Tag);
         AeConditionState conditionState = null;
         this.conditionStateRichTextBox.Text = null;
         int res = m_session.GetAeConditionState(condition.SourcePath, condition.ConditionName, null, out conditionState, m_executionOptions);
         if (ResultCode.SUCCEEDED(res) && (m_executionOptions.ExecutionType == EnumExecutionType.SYNCHRONOUS))
         {
             this.conditionStateRichTextBox.Text += " Source Path: " + condition.SourcePath + "\n";
             this.conditionStateRichTextBox.Text += " Condition Name: " + condition.ConditionName + "\n";
             this.conditionStateRichTextBox.Text += " State: " + GetState(conditionState.State) + "\n";
             this.conditionStateRichTextBox.Text += " Quality: " + conditionState.Quality + "\n";
             this.conditionStateRichTextBox.Text += " Active Time: " + conditionState.ConditionActiveTime + "\n";
             this.conditionStateRichTextBox.Text += " Inactive Time: " + conditionState.ConditionInactiveTime + "\n";
             this.conditionStateRichTextBox.Text += " AcknowledgeTime: " + conditionState.ConditionAckTime + "\n";
             this.conditionStateRichTextBox.Text += " AcknowledgerComment: " + conditionState.AcknowledgerComment + "\n";
             this.conditionStateRichTextBox.Text += " AcknowledgerID: " + conditionState.AcknowledgerId + "\n";
             this.conditionStateRichTextBox.Text += " Active subcondition time: " + conditionState.SubConditionActiveTime + "\n";
             this.conditionStateRichTextBox.Text += " Active subcondition name: " + conditionState.ActiveSubConditionName + "\n";
             this.conditionStateRichTextBox.Text += " Active subcondition definition: " + conditionState.ActiveSubConditionDefinition + "\n";
             this.conditionStateRichTextBox.Text += " Active subcondition description: " + conditionState.ActiveSubConditionDescription + "\n";
             this.conditionStateRichTextBox.Text += " Active subcondition severity: " + conditionState.ActiveSubConditionSeverity + "\n";
             this.conditionStateRichTextBox.Text += " Number of subconditions: " + conditionState.SubConditionsNames.Length + "\n";
             for (int i = 0; i < conditionState.SubConditionsNames.Length; i++)
             {
                 this.conditionStateRichTextBox.Text += "	Subcondition name: "+ conditionState.SubConditionsNames[i] + "\n";
                 this.conditionStateRichTextBox.Text += "	Subcondition definition: "+ conditionState.SubConditionsDefinitions[i] + "\n";
                 this.conditionStateRichTextBox.Text += "	Subcondition description: "+ conditionState.SubConditionsDescriptions[i] + "\n";
                 this.conditionStateRichTextBox.Text += "	Subcondition severity: "+ conditionState.SubConditionsSeverities[i] + "\n";
             }            //end for
         }                //end if
     }
     else
     {
         MessageBox.Show(" Select a condition in the condition list ! ", "Select condition");
     }             //ens if ... else
 }
Esempio n. 2
0
        }           //	end Terminate

        public string GetConditionState()
        {
            if (m_aeSession == null)
            {
                return("");
            }               //	end if

            string message = String.Empty;

            try
            {
                string           conditionStateToString = String.Empty;
                AeConditionState conditionState         = null;

                int result = m_aeSession.GetAeConditionState(
                    "computer.clock.time slot 1",
                    "between",
                    null,
                    out conditionState,
                    null);

                if (ResultCode.SUCCEEDED(result))
                {
                    message  = "The condition state is: \n";
                    message += " Source Path: computer.clock.time slot 1 \n";
                    message += " Condition Name: between \n";
                    message += " State: " + GetStateToString(conditionState.State) + "\n";
                    message += " Quality: " + conditionState.Quality + "\n";
                    message += " Active Time: " + conditionState.ConditionActiveTime + "\n";
                    message += " Inactive Time: " + conditionState.ConditionInactiveTime + "\n";
                    message += " AcknowledgeTime: " + conditionState.ConditionAckTime + "\n";
                    message += " AcknowledgerComment: " + conditionState.AcknowledgerComment + "\n";
                    message += " AcknowledgerID: " + conditionState.AcknowledgerId + "\n";
                    message += " Active subcondition time: " + conditionState.SubConditionActiveTime + "\n";
                    message += " Active subcondition name: " + conditionState.ActiveSubConditionName + "\n";
                    message += " Active subcondition definition: " + conditionState.ActiveSubConditionDefinition + "\n";
                    message += " Active subcondition description: " + conditionState.ActiveSubConditionDescription + "\n";
                    message += " Active subcondition severity: " + conditionState.ActiveSubConditionSeverity + "\n";
                    message += " Number of subconditions: " + conditionState.SubConditionsNames.Length + "\n";
                    for (int i = 0; i < conditionState.SubConditionsNames.Length; i++)
                    {
                        message += "	Subcondition name: "+ conditionState.SubConditionsNames[i] + "\n";
                        message += "	Subcondition definition: "+ conditionState.SubConditionsDefinitions[i] + "\n";
                        message += "	Subcondition description: "+ conditionState.SubConditionsDescriptions[i] + "\n";
                        message += "	Subcondition severity: "+ conditionState.SubConditionsSeverities[i] + "\n";
                    }                    //end for
                }
                else
                {
                    message = "Get condition state failed!\n";
                }                   //	end if...else
            }
            catch (Exception exc)
            {
                GetApplication().Trace(
                    EnumTraceLevel.ERR,
                    EnumTraceGroup.USER,
                    "OpcClient::GetConditionState",
                    exc.ToString());
            }    //	end try...catch
            return(message);
        }        //end GetConditionState