public void ShowBytes(IList <byte> bytes)
        {
            _debugBytes = bytes;
            // TODO: rework for big endian and little endian archs

            var value1 = _addPoints1AsSigned
                ? ConvertHelp.ToInt16(_debugBytes[0], _debugBytes[1]) * 1.0
                : ConvertHelp.ToUInt16(_debugBytes[0], _debugBytes[1]) * 1.0;
            var value2 = _addPoints2AsSigned
                ? ConvertHelp.ToInt16(_debugBytes[2], _debugBytes[3]) * 1.0
                : ConvertHelp.ToUInt16(_debugBytes[2], _debugBytes[3]) * 1.0;
            var value3 = _addPoints3AsSigned
                ? ConvertHelp.ToInt16(_debugBytes[4], _debugBytes[5]) * 1.0
                : ConvertHelp.ToUInt16(_debugBytes[4], _debugBytes[5]) * 1.0;
            var value4 = _addPoints4AsSigned
                ? ConvertHelp.ToInt16(_debugBytes[6], _debugBytes[7]) * 1.0
                : ConvertHelp.ToUInt16(_debugBytes[6], _debugBytes[7]) * 1.0;

            _points1.Points.Add(DateTimeAxis.CreateDataPoint(DateTime.Now, value1));
            _points2.Points.Add(DateTimeAxis.CreateDataPoint(DateTime.Now, value2));
            _points3.Points.Add(DateTimeAxis.CreateDataPoint(DateTime.Now, value3));
            _points4.Points.Add(DateTimeAxis.CreateDataPoint(DateTime.Now, value4));

            PlotVm.InvalidatePlot(true);
        }
        public void ClearTrendData(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            switch (name)
            {
            case "Параметр 1":
                _points1.Points.Clear();
                PlotVm.InvalidatePlot(true);
                break;

            case "Параметр 2":
                _points2.Points.Clear();
                PlotVm.InvalidatePlot(true);
                break;

            case "Параметр 3":
                _points3.Points.Clear();
                PlotVm.InvalidatePlot(true);
                break;

            case "Параметр 4":
                _points4.Points.Clear();
                PlotVm.InvalidatePlot(true);
                break;

            default:
                throw new Exception("Неизвестное название параметра: " + name);
            }
        }
Esempio n. 3
0
 public static Plot MapFromVm(PlotVm plotVm)
 {
     return(new Plot
     {
         IdPlot = plotVm.Id
     });
 }
 public IActionResult AddPlot(PlotVm plot)
 {
     _service.AddPlot(plot);
     return(Ok(ResponseManager.GenerateResponse(null, (int)MessageType.Ok, plot)));
 }
Esempio n. 5
0
        public void AddPlot(PlotVm plotVm)
        {
            var plot = PlotMapper.MapFromVm(plotVm);

            _repo.AddPlot(plot);
        }