//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);
        }
        //Create vertical gridlines with labels
        private gridLine createVLine(int x, bool addtogroup=true)
        {
            gridLine vline = new gridLine(x, LineDirection.Vertical, window);
            if (addtogroup == true) verticals.Add(vline);
            return vline;

        }
 //Create horizontal gridlines with labels
 private gridLine createHLine(int y, bool addtogroup=true) {
     gridLine hline = new gridLine(y, LineDirection.Horizontal, window);
     if (addtogroup == true) horizontals.Add(hline);
     return hline;
 }