示例#1
0
        private void oscTimer_Action(object arg)
        {
            if (!oscTimerLock)
            {
                oscTimerLock = true;

                oscDispatcher.Invoke(
                    new Action(() =>
                {
                    try
                    {
                        if (adcDataValid)
                        {
                            oscDataCanvas.Children.Clear();
                            int xNmb     = AdcData.GetLength(1);
                            double xStep = contentWidth / (xNmb - 1);
                            for (int i = 0; i < xNmb - 1; i++)
                            {
                                Line l            = new Line();
                                l.X1              = i * (xStep);
                                l.X2              = (i + 1) * xStep;
                                l.Y1              = (0.5 - (AdcData[2, i] / (double)0x8000)) * contentHeight;
                                l.Y2              = (0.5 - (AdcData[2, i + 1] / (double)0x8000)) * contentHeight;
                                l.StrokeThickness = 2.0;
                                l.Stroke          = Brushes.Green;
                                oscDataCanvas.Children.Add(l);
                            }
                            adcDataValid = false;
                        }
                    }
                    catch { };
                }));
            }
            oscTimerLock = false;
        }