public PCRControllerVM() { Schedule = new PCRSchedule(); Serializer = new ScheduleSerializer(); Serializer.OnNewScheduleLoaded += Serializer_OnNewScheduleLoaded; _savePcrSchedule = new RelayCommand(param => Serializer.SaveSchedule(Schedule)); _savePcrScheduleAs = new RelayCommand(param => Serializer.SaveScheduleAs(Schedule)); _loadPcrSchedule = new RelayCommand(param => Serializer.LoadSchedule()); _startStopExperiment = new RelayCommand(param => Device.StartStopExperiment(Experiment.ExperimentRunning)); _connectToComPort = new RelayCommand(param => Device.ConnectToDevice()); Device = new PCRDevice(); Device.OnDeviceConnected += Device_OnDeviceConnected; Device.OnDeviceDisconnected += Device_OnDeviceDisconnected; Device.OnExperimentStarted += Device_OnExperimentStarted; Device.OnExperimentTerminated += Device_OnExperimentTerminated; Experiment = new ExperimentStatus(); ComPortDevices = SerialPort.GetPortNames().ToList <String>(); ComPortSelected = false; ConnectButtonText = "Connect"; ConnectionStatus = Device.ConnectionMessage; }
private void Serializer_OnNewScheduleLoaded(object sender, EventArgs e) { if (sender is ScheduleSerializer) { Serializer = (ScheduleSerializer)sender; PCRSchedule schedule = Serializer.LoadedSchedule; InitializationTemp = schedule.Initialization.Temperature; InitializationDuration = schedule.Initialization.Duration; DenaturationTemp = schedule.Denaturation.Temperature; DenaturationDuration = schedule.Denaturation.Duration; AnnealingTemp = schedule.Annealing.Temperature; AnnealingDuration = schedule.Annealing.Duration; ElongationTemp = schedule.Elongation.Temperature; ElongationDuration = schedule.Elongation.Duration; FinalHoldTemp = schedule.FinalHold.Temperature; FinalHoldDuration = schedule.FinalHold.Duration; PcrIterations = schedule.NumberOfIterations; } else { throw new Exception(); } }