//Constructor
        public SignalCollection(MainWindow uiWindow)
        {
            brushes = new List<SolidColorBrush>();
            brushes.Add(Brushes.MediumVioletRed);
            brushes.Add(Brushes.LightBlue);
            brushes.Add(Brushes.BurlyWood);
            brushes.Add(Brushes.LightPink);
            brushes.Add(Brushes.Yellow);
            brushes.Add(Brushes.LightGreen);
            brushes.Add(Brushes.Gold);
            window = uiWindow;
            dataDispatcher = window.Dispatcher;
            signals = new List<Signal>(0);
            this.view = uiWindow.view; //set initial view params
            //view.XMAX = 2000;
            view.YMIN = 0;
            view.YMAX = 1024;
            view.XMIN = 0;
            view.LINESCALE = 1;
            horizontals = new List<gridLine>(10);
            verticals = new List<gridLine>(10);
            plotlineH = createHLine(0,false);
            plotlineH.hideLabel();
            plotlineV = createVLine(0,false);
            plotlineV.hideLabel();
            preparePlot();

            drawWorkerDelegate w = drawWorker;
            w.BeginInvoke(null, null);

            //addSignal(true);
        }
示例#2
0
        //gridLine constructor
        public gridLine(int value, string dir, MainWindow window)
        {
            // Create a path to draw a geometry with.
            line = new Path();
            line.Stroke = Brushes.WhiteSmoke;
            line.StrokeThickness = 0.5;
            line.SnapsToDevicePixels = true;

            //this.line = new Line();
            this.canvas = window.plot;
            this.view = window.view;
            this.direction = dir;
            this.window = window;

            creategeometry(value);

            if (dir == LineDirection.Horizontal)
            {
                TextLabel(5, value, value.ToString());
            }
            else
            {
                TextLabel(value + 1, 30, value.ToString());
            }


            canvas.Children.Add(line);
        }
 public helpDialogBox(MainWindow originalWindow)
 { 
     port = originalWindow.arduinoPort;
     InitializeComponent();
     helpText.Text = ArduinoMonitor.Resources.moreHelp;
     if (originalWindow.isConnected == true)
     {
         baudRateBox.IsEnabled = false;
     }
     
 }
示例#4
0
        public Signal(MainWindow main, bool fake=false)
        {
            this.view = main.view; //Refer to the view parameters
            values = new List<double>(0);
            window = main;
            line = new Path(); //Path, to be filled with streamgeometry
            line.Stroke = Brushes.Red;
            line.SnapsToDevicePixels = true;
            line.Visibility = Visibility.Visible;
            line.RenderTransform = new ScaleTransform(1.0, view.LINESCALE);
            createGeometry();
            window.plot.Children.Add(line);

            //Create pointer
            pointer = new Ellipse();
            pointer.Fill = line.Stroke;
            pointer.Width = 5;
            pointer.Height = 5;
            pointer.Name = "signalPointer";
            window.plot.Children.Add(pointer);
            setThickness(1 / (main.plot.Height / view.YMAX));
            Canvas.SetLeft(pointer, -10);
            Canvas.SetTop(pointer, -10);


            if (fake) { //Create dummy graph
                Random random = new Random();
                //Fill the signal with 200 random data points
                for (int i = 0; i < 2000; i++)
                {
                    int randomNumber = (int) Math.Floor(500 * Math.Sin(i * (Math.PI / 180))) + 500;
                    addValue(randomNumber);
                }
            }

        }