public MainWindow() { InitializeComponent(); _bufferLength = _maxSamples; _nChannels = 8; _graphModels = new GraphModel[_nChannels]; _graphs = new Graph[_nChannels]; for (int i = 0; i < _nChannels; i++) { _graphs[i] = new Graph(); _graphModels[i] = new GraphModel(_graphs[i]); _graphs[i].xMin = 0; _graphs[i].xMax = _maxSamples-1; _graphs[i].yMin = -1500; _graphs[i].yMax = 1500; _graphs[i].topEdge = 5; _graphs[i].bottomEdge = 5; _graphs[i].rightEdge = 5; _graphs[i].leftEdge = 5; _graphs[i].plotColor = Color.FromArgb(200,0,0,255); //Because writable bitmaps use premultiplied alpha! graphsGrid.Children.Add(_graphs[i]); } //Initialising plot data PrepareData(); //Setting and starting timer; _timer = new FastTimer(3, 100, InsertPoints); _timer.Start(); }
/// <summary> /// It configures the viewModel with its default values. /// </summary> public void Configure() { reaViewModel.PropertyChanged += reaViewModel_PropertyChanged; this.acqModel.allowedComplexMovements = Properties.Settings.Default.AcqAllowedMovements; this.acqModel.numSingleMovements = Properties.Settings.Default.AcqMovementsList.Count; simultMovements = Properties.Settings.Default.AcqSimultMovements; detectThresholds = Properties.Settings.Default.AcqDetectThresholds; if (devices.Contains(Properties.Settings.Default.SelectedDevice)) selectedDevice = Properties.Settings.Default.SelectedDevice; else selectedDevice = devices[0]; plotModels = new GraphModel[Properties.Settings.Default.AcqDeviceNChannels]; concurrentPointLists = new BlockingCollection<System.Windows.Point>[Properties.Settings.Default.AcqDeviceNChannels]; for (int i = 0; i < Properties.Settings.Default.AcqDeviceNChannels; i++) { plotModels[i] = new GraphModel(); plotModels[i].PropertyChanged += GraphModel_PropertyChanged; concurrentPointLists[i] = plotModels[i].pointQueue; } this.acqModel.PropertyChanged += ReconfigureGraphsOnEvent; LoadRecordingConfig(Properties.Settings.Default, acqModel.recordingConfig); //All the configuration parameters are in place. We can now build the initial recording schedule acqModel.ComposeSchedule(); //And initialize the model acqModel.Init(); //Now we can initialize the model for the RecordingPlan display widget as well recordingPlanModel = new RecordingPlanViewModel(acqModel.recordingConfig, Properties.Settings.Default.AcqMovementsList); recordingPlanModel.PropertyChanged += recordingPlanModel_PropertyChanged; recordingPlanModel.SetImages(PrepareImages(Properties.Settings.Default.AcqMovementsList.Count + Properties.Settings.Default.AcqAllowedMovements.Count)); }
public void Configure() { if (devices.Contains(Properties.Settings.Default.SelectedDevice)) selectedDevice = Properties.Settings.Default.SelectedDevice; else selectedDevice = devices[0]; plotGraphs = true; plotModels = new GraphModel[Properties.Settings.Default.AcqDeviceNChannels]; concurrentPointLists = new BlockingCollection<System.Windows.Point>[Properties.Settings.Default.AcqDeviceNChannels]; for (int i = 0; i < Properties.Settings.Default.AcqDeviceNChannels; i++) { plotModels[i] = new GraphModel(); concurrentPointLists[i] = plotModels[i].pointQueue; } reaModel.nMovements = Properties.Settings.Default.AcqMovementsList.Count + Properties.Settings.Default.AcqAllowedMovements.Count; reaModel.numSingleMovements = Properties.Settings.Default.AcqMovementsList.Count; reaModel.allowedComplexMovements = Properties.Settings.Default.AcqAllowedMovements; reaModel.Init(); }