Пример #1
0
        //_________________________________________________________________________
        void OutToCB(object Control, DataMessage DM, int i)
        {
            ComboBox CB = (ComboBox)Control;

            CB.Items.Clear();
            if (DM != null)
            {
                CB.Items.Add(string.Format("{0:D2}. [{1}] {2}; {3}", DM.id, DM.time.TimeOfDay.ToString(),
                                           DM.quality, ConvertVal(DM.value, DRV.GetTypeVal(i))));
                CB.SelectedIndex = 0;
            }
        }
Пример #2
0
 //_________________________________________________________________________
 private void TScanParam_Tick(object sender, EventArgs e)
 {
     RBScan.Checked = !RBScan.Checked;
     for (int i = 1; i <= ВсегоПараметров; i++)
     {
         Control[] C = PParameters.Controls.Find(sPrefixCB + i.ToString(), false);
         if (C != null)
         {
             if (C.Length > 0)
             {
                 ComboBox L = (ComboBox)C[0];
                 if (L != null)
                 {
                     L.Items.Clear();
                     if (DRV.GetTypeArch(i) == TArchive.NAMES.Single)
                     {
                         DeviceInterfaces.DataMessage DM = DRV.GetValue(i);                                              // List (i); //DM.value = new byte[] { 0x3b, 0xdf, 0x47, 0x40 };
                         if (DM != null)
                         {
                             L.Items.Add(string.Format("{0:D2}. [{1}] {2}; {3}", DM.id, DM.time, DM.quality, ConvertVal(DM.value, DRV.GetTypeVal(i))));
                             L.SelectedIndex = 0;
                         }
                     }
                     else
                     {
                         if (i == 2)
                         {
                             continue;                                                           // TODO: EDIT / DELETE
                         }
                         DeviceArchiveRecord[] Archs = DRV.GetNewArchiveData(i);
                         if (Archs != null)
                         {
                             bool   bOutHeaders = true;
                             string asHead      = "";
                             foreach (DeviceArchiveRecord Row in Archs)
                             {
                                 //Application.DoEvents ();
                                 Thread.Sleep(0);
                                 string asRow = "";
                                 foreach (DeviceArchiveParameter Par in Row.data)
                                 {
                                     if (bOutHeaders)
                                     {
                                         asHead += Par.name + " ";                                                                               // Заголовки
                                     }
                                     asRow += Par.value + " ";                                                                                   // Значения архива построчно
                                 }
                                 if (bOutHeaders)
                                 {
                                     bOutHeaders = false;
                                     L.Items.Add(asHead);
                                 }
                                 L.Items.Add(asRow);
                             }
                             if (L.Items.Count > 0)
                             {
                                 L.SelectedIndex = 0;
                             }
                         }
                     }
                 }
             }
         }
     }
 }