コード例 #1
0
 private void Start()
 {
     _netMqListener = new NetMqListener(HandleMessage);
     _netMqListener.Start();
 }
コード例 #2
0
        public Form1()
        {
            InitializeComponent();
            serialPort1.Open();

            _netMqListener = new NetMqListener(HandleMessage);
            _netMqListener.Start();

            var mapper = Mappers.Xy <MeasureModel>()
                         .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X
                         .Y(model => model.Value);         //use the value property as Y

            //lets save the mapper globally.
            Charting.For <MeasureModel>(mapper);

            //the ChartValues property will store our values array
            ChartValues            = new ChartValues <MeasureModel>();
            ChartValues2           = new ChartValues <MeasureModel>();
            cartesianChart1.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values            = ChartValues,
                    PointGeometrySize = 18,
                    StrokeThickness   = 4
                }
            };
            cartesianChart2.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values            = ChartValues2,
                    PointGeometrySize = 18,
                    StrokeThickness   = 4
                }
            };
            cartesianChart1.AxisX.Add(new Axis
            {
                DisableAnimations = true,
                LabelFormatter    = value => new System.DateTime((long)value).ToString("mm:ss"),
                Separator         = new Separator
                {
                    Step = TimeSpan.FromSeconds(1).Ticks
                }
            });
            cartesianChart2.AxisX.Add(new Axis
            {
                DisableAnimations = true,
                LabelFormatter    = value => new System.DateTime((long)value).ToString("mm:ss"),
                Separator         = new Separator
                {
                    Step = TimeSpan.FromSeconds(1).Ticks
                }
            });

            SetAxisLimits(System.DateTime.Now);

            //The next code simulates data changes every 500 ms
            Timer = new Timer
            {
                Interval = 500
            };
            Timer.Tick += TimerOnTick;
            Timer.Start();
        }