public void DrawPlots(PointF[][] aPoints, SensorInfo[] aSensors) { AddCurvesToPanel(aSensors); if (aPoints == null) { MessageBox.Show(@"Нет точек для отображения"); return; } var pane = control.GraphPane; for (var i = 0; i < aPoints.Length; ++i) { if (aPoints[i] != null) { for (var j = 0; j < aPoints[i].Length; ++j) { pane.CurveList[i].AddPoint(aPoints[i][j].X / 1000, aPoints[i][j].Y); } } HidePlotLine(i); } if (aPoints.Length > 0) { ShowPlotLine(0); } control.AxisChange(); control.Invalidate(); }
private void button2_Click(object sender, EventArgs e) { if (client == null || !client.IsConnected) { MessageBox.Show(@"Не удалось выполнить операцию: нет подключения к сервису."); return; } for (var i = 0; i < dataGridView1.Rows.Count; ++i) { var row = dataGridView1.Rows[i]; var mask = Convert.ToInt32(row.Cells["Mask"].Value); if ((mask & (int)ModifiedMask.DELETED) != 0) { var sId = row.Cells["Id"].Value.ToString(); try { if (!string.IsNullOrEmpty(sId)) { var id = Convert.ToInt32(sId); client.RemoveSensorInfo(id); } } catch (Exception ex) { MessageBox.Show(@"Не удалось удалить датчик. Исключение: " + ex.Message); } } else if ((mask & (int)ModifiedMask.ADDED) != 0) { try { var sensorInfo = new SensorInfo(); sensorInfo.Name = row.Cells["Name"].Value.ToString(); sensorInfo.SensorType = ConvertStrToSensorType(row.Cells["Type"].Value.ToString()); sensorInfo.Side = ConvertStrToSensorSide(row.Cells["Side"].Value.ToString()); sensorInfo.Shift = Convert.ToDouble(row.Cells["Shift"].Value); sensorInfo.State = SensorState.INACTIVE; client.AddSensorInfo(sensorInfo); } catch (Exception ex) { MessageBox.Show(@"Не удалось добавить описание датчика. Исключение: " + ex.Message); } } else if ((mask & (int)ModifiedMask.CHANGED) != 0) { try { var sensorInfo = new SensorInfo(); sensorInfo.Id = Convert.ToInt32(row.Cells["Id"].Value); sensorInfo.Name = row.Cells["Name"].ToString(); sensorInfo.SensorType = ConvertStrToSensorType(row.Cells["Type"].Value.ToString()); sensorInfo.Side = ConvertStrToSensorSide(row.Cells["Side"].Value.ToString()); sensorInfo.Shift = Convert.ToDouble(row.Cells["Shift"].Value); client.EditSensorInfo(sensorInfo); } catch (Exception ex) { MessageBox.Show(@"Не удалось изменить описание датчика. Исключение: " + ex.Message); } } } this.Close(); }
public int AddSensorInfo(long aSessionId, SensorInfo aSensorInfo) { try { logger.Debug("Сессия: " + aSessionId + " " + "Запрос AddSensorInfo"); return gcsServer.AddSensorInfo(aSensorInfo); } catch (Exception ex) { logger.Error("Сессия: " + aSessionId + " Ошибка: " + ex.Message); return -1; } }
public void EditSensorInfo(long aSessionId, SensorInfo aSensorInfo) { try { logger.Debug("Сессия: " + aSessionId + " " + "Запрос EditSensorInfo(" + aSensorInfo.Id + ")"); gcsServer.EditSensorInfo(aSensorInfo); } catch (Exception ex) { logger.Error("Сессия: " + aSessionId + " Ошибка: " + ex.Message); } }
public int AddSensorInfo(SensorInfo aSensorInfo) { var sensorInfo = new SensorInfoImpl(sensorConfiguration.GetSensorInfoCount(), aSensorInfo.Name, (SensorType) aSensorInfo.SensorType, (SensorSide) aSensorInfo.Side, aSensorInfo.Shift); sensorConfiguration.CreateSensorInfo(sensorInfo); return sensorInfo.GetId(); }
public SensorInfo[] GetSensorInfos() { var sensorCount = sensorConfiguration.GetSensorInfoCount(); var results = new List<SensorInfo>(); for (var i = 0; i < sensorCount; ++i) { var sensor = sensorConfiguration.ReadSensorInfoByIndex(i); var sensorInfo = new SensorInfo(); sensorInfo.Id = sensor.GetId(); sensorInfo.Name = sensor.GetName(); sensorInfo.SensorType = (Alvasoft.SlabGeometryControl.SensorType) sensor.GetSensorType(); sensorInfo.Side = (Alvasoft.SlabGeometryControl.SensorSide) sensor.GetSensorSide(); sensorInfo.Shift = sensor.GetShift(); sensorInfo.State = dataProvider.IsSensorActive(sensor.GetId()) ? SensorState.ACTIVE : SensorState.INACTIVE; results.Add(sensorInfo); } return results.ToArray(); }
public void EditSensorInfo(SensorInfo aSensorInfo) { throw new NotImplementedException(); }
private void AddCurvesToPanel(SensorInfo[] aSensors) { if (aSensors == null) { return; } var pane = control.GraphPane; for (var i = 0; i < aSensors.Length; ++i) { var curve = pane.AddCurve( aSensors[i].Name, new PointPairList(), Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)), SymbolType.None); curve.Line.IsSmooth = true; curve.Line.SmoothTension = 0; curve.Line.IsAntiAlias = true; plotLines.Add(curve); } }