Exemplo n.º 1
0
        void GraphTimer(object state)
        {
            double[] x    = GraphData.Xdata;
            double[] y    = GraphData.Ydata;
            double   a    = GraphData.Amplitude;
            var      task = this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                var m          = plotView.Model;
                m              = PlotModelDefine.AccToTime(x, y, a);
                plotView.Model = m;
                plotView.InvalidatePlot();
            });

            var OutputAcc = new Task(() =>
            {
                foreach (double acc in y)
                {
                    Debug.WriteLine(acc);
                }
                Debug.WriteLine("--------------End Patch---------------");
            });

            n++;
            if (n % 50 == 0)
            {
                OutputAcc.Start();
            }
        }
Exemplo n.º 2
0
        public GraphDrawer()
        {
            InitializeComponent();

            LS            = new OxyPlot.Series.LineSeries();
            Grapher.Model = PlotModelDefine.ZeroCrossing();
        }
        //Retrieve data from server and fill all fields
        public async Task ReceiveData()
        {
            NotReceiving = false;

            try
            {
                //Firstly trying to receive data. Errors will be thrown further
                var data = await DataReceiver.CollectTestingData(Name, Position);

                if (string.IsNullOrEmpty(data.Data))
                {
                    Comment = "No data received";
                    return;
                }

                //Trying to draw a graph for plot from data numbers
                PlotModel = PlotModelDefine.GridLinesHorizontal(data.Data);

                Lambda     = data.Lambda.ToString();
                Frequency  = data.Frequency.ToString();
                SignalType = data.SignalType.ToString();
                Comment    = data.Comment;
            }
            catch (Exception ex)
            {
                if (ex.Data.Contains("UserMessage"))
                {
                    Comment = ex.Data["UserMessage"].ToString();
                }
                else
                {
                    Comment = ex.Message;
                }
            }
            finally
            {
                NotReceiving = true;
            }
        }