예제 #1
0
 public void OnValueChanged(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         if (!arg.User)
         {
             UpdateCaptureObjects();
         }
         DataTable dt = ProfileGenericView.DataSource as DataTable;
         if (dt != null)
         {
             dt.Rows.Clear();
             UpdateData(dt);
         }
         ProfileGenericView.Refresh();
     }
     if (arg.Index == 3)
     {
         GXDLMSProfileGeneric target = Target as GXDLMSProfileGeneric;
         CaptureObjectsLv.Items.Clear();
         foreach (var it in target.CaptureObjects)
         {
             ListViewItem li = CaptureObjectsLv.Items.Add(it.Key.ObjectType.ToString());
             li.SubItems.Add(it.Key.LogicalName);
             li.SubItems.Add(it.Value.AttributeIndex.ToString());
             li.Tag = it;
         }
     }
 }
예제 #2
0
 public void OnValueChanged(int index, object value, bool user)
 {
     if (index == 2)
     {
         DataTable dt = ProfileGenericView.DataSource as DataTable;
         if (target.Buffer.Count < dt.Rows.Count)
         {
             dt.Rows.Clear();
         }
         UpdateData(dt);
         for (int pos = dt.Rows.Count; pos < target.Buffer.Count; ++pos)
         {
             object[] row = target.Buffer[pos];
             dt.LoadDataRow(row, true);
         }
         ProfileGenericView.Refresh();
     }
 }
        public void OnValueChanged(int index, object value, bool user, bool connected)
        {
            GXDLMSCompactData target = Target as GXDLMSCompactData;

            if (index == 2)
            {
                if (!user)
                {
                    UpdateCaptureObjects();
                }
                BufferTb.Text = GXDLMSTranslator.ToHex(target.Buffer);
                DataTable dt = ProfileGenericView.DataSource as DataTable;
                if (dt != null)
                {
                    dt.Rows.Clear();
                    UpdateData(dt);
                }
                ProfileGenericView.Refresh();
            }
            else if (index == 3)
            {
                CaptureObjectsLv.Items.Clear();
                foreach (var it in target.CaptureObjects)
                {
                    ListViewItem li = CaptureObjectsLv.Items.Add(it.Key.ObjectType.ToString());
                    li.SubItems.Add(it.Key.LogicalName);
                    li.SubItems.Add(it.Value.AttributeIndex.ToString());
                    li.Tag = it;
                }
            }
            else if (index == 5)
            {
                List <object> types = GXDLMSCompactData.GetDataTypes(target.TemplateDescription);
                StringBuilder sb    = new StringBuilder();
                AppendDataType(sb, types);
                TemplateDescriptionTb.Text = sb.ToString();
            }
            else
            {
                throw new IndexOutOfRangeException("index");
            }
        }