//_________________________________________________________________________ private void OutputValues() { int i = 1; try { RBScan.Checked = !RBScan.Checked; Thread.Sleep(0); for (; i <= ВсегоПараметров; i++) { Control[] C = PParameters.Controls.Find(sPrefixCB + i.ToString(), false); if (C != null && C.Length > 0) { //if (i == 2) Global.LogWriteLine (""); if (C[0] is Label) //if (DRV.GetRequestType (i) == CONST.RequestType.Single) { DataMessage DM = DRV.GetValue(i); // List (i); //DM.value = new byte[] { 0x3b, 0xdf, 0x47, 0x40 }; if (CBShowInd.Checked) { OutToLabel(C[0], DM, i); } } else { if (!CBIndArchOff.Checked) { ComboBox CB = (ComboBox)C[0]; DeviceArchiveRecord[] Archs = DRV.GetNewArchiveData(i); if (Archs != null) { if (CBAccumArch.Checked == false) { CB.Items.Clear(); } bool bOutHeaders = true; string asHead = ""; foreach (DeviceArchiveRecord Row in Archs) { Thread.Sleep(0); string asRow = ""; if (Row.data != null) { foreach (DeviceArchiveParameter Par in Row.data) { if (bOutHeaders) { asHead += Par.name + " "; // Заголовки } asRow += Par.value + " "; // Значения архива построчно } } if (bOutHeaders) { bOutHeaders = false; CB.Items.Add(asHead); } CB.Items.Add(asRow); } if (CB.Items.Count > 0) { CB.SelectedIndex = 0; } } else if (CB.Items.Count < 2) //CB.Items.Add ("Нет данных архива за период."); { CB.Items.Add("Нет новых данных архива."); //CB.Text = "Нет данных архива за период."; CB.SelectedIndex = CB.Items.Count - 1; } } } } } } catch (Exception exc) { MessageBox.Show("OutputValues: " + i.ToString() + " " + exc.Message); // Global.LogWriteLine ("OutputValues: " + i.ToString() + " " + exc.Message); } bReadingValues = false; }
//_________________________________________________________________________ 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; } } } } } } } }