/// <summary> /// Creates a PrinterViewModel with one X Axis ViewModel, one Y Axis ViewModel, one Z Axis ViewModel, and one PrintheadViewModel. /// </summary> /// <param name="PrinterModel"></param> public PrinterViewModel(PrinterModel PrinterModel, SerialCommunicationCommandSetsModel SerialCommunicationCommandSetsModel) { _printerModel = PrinterModel; _serialCommunicationCommandSetsModel = SerialCommunicationCommandSetsModel; _gPIOPinListsViewModel = new GPIOPinListsViewModel(); _microcontrollerViewModel = new MicrocontrollerViewModel(_printerModel.MicroControllerModel, _gPIOPinListsViewModel); //Populates the Axis ViewModel lists with their Axis Model counterparts. foreach (AxisModel axisModel in _printerModel.AxisModelList) { AxisViewModel newAxisViewModel = new AxisViewModel(axisModel, _gPIOPinListsViewModel); _axisViewModelList.Add(newAxisViewModel); if (newAxisViewModel.Name.Contains('Z')) { _zAxisViewModelList.Add(newAxisViewModel); } } //Populates the Printhead ViewModel lists with their Printhead Model counterparts. foreach (PrintheadModel printheadModel in _printerModel.PrintheadModelList) { _printheadViewModelList.Add(new PrintheadViewModel(printheadModel, _gPIOPinListsViewModel)); } //Populates the empty PrintheadViewModel list with an empty Printhead. _emptyPrintheadViewModelList.Add(new PrintheadViewModel(new PrintheadModel(""), _gPIOPinListsViewModel)); //Subscribe to events. SerialCommunicationCommandSetsModel.RealTimeStatusDataModel.RecordLimitExecuted += new RecordLimitExecutedEventHandler(UpdateMinMaxPositions); SerialCommunicationCommandSetsModel.CommandSetMinMaxPositionChanged += new CommandSetMinMaxPositionChangedEventHandler(UpdateMinMaxPositions); }
public RealTimeStatusDataViewModel(RealTimeStatusDataModel RealTimeStatusDataModel, PrinterViewModel PrinterViewModel, SerialCommunicationCommandSetsModel SerialCommunicationCommandSetsModel, ErrorListViewModel ErrorListViewModel) { _realTimeStatusDataModel = RealTimeStatusDataModel; _printerViewModel = PrinterViewModel; _serialCommunicationCommandSetsModel = SerialCommunicationCommandSetsModel; _errorListViewModel = ErrorListViewModel; Initialize(); //Subscribe to events. _realTimeStatusDataModel.RecordSetAxisExecuted += new RecordSetAxisExecutedEventHandler(UpdateRecordSetAxis); _realTimeStatusDataModel.RecordSetMotorizedPrintheadExecuted += new RecordSetMotorizedPrintheadExecutedEventHandler(UpdateSetPrinthead); _realTimeStatusDataModel.RecordSetValvePrintheadExecuted += new RecordSetValvePrintheadExecutedEventHandler(UpdateSetPrinthead); _realTimeStatusDataModel.RecordMoveAxesExecuted += new RecordMoveAxesExecutedEventHandler(UpdateRecordMoveAxes); _realTimeStatusDataModel.RecordMotorizedPrintWithMovementExecuted += new RecordMotorizedPrintWithMovementExecutedEventHandler(UpdateRecordMotorizedPrintWithMovement); _realTimeStatusDataModel.RecordValvePrintWithMovementExecuted += new RecordValvePrintWithMovementExecutedEventHandler(UpdateRecordValvePrintWithMovement); _realTimeStatusDataModel.RecordMotorizedPrintWithoutMovementExecuted += new RecordMotorizedPrintWithoutMovementExecutedEventHandler(UpdateRecordMotorizedPrintWithoutMovement); _realTimeStatusDataModel.RecordValvePrintWithoutMovementExecuted += new RecordValvePrintWithoutMovementExecutedEventHandler(UpdateRecordValvePrintWithoutMovement); _realTimeStatusDataModel.RecordValveCloseExecuted += new RecordValveCloseExecutedEventHandler(UpdateRecordValveClose); _realTimeStatusDataModel.TaskQueuedMessagesUpdated += new TaskQueuedMessagesUpdatedEventHandler(UpdateTaskQueuedMessages); _realTimeStatusDataModel.ErrorMessagesUpdated += new ErrorMessagesUpdatedEventHandler(UpdateErrorMessages); _realTimeStatusDataModel.RecordLimitExecuted += new RecordLimitExecutedEventHandler(UpdatePositions); _realTimeStatusDataModel.RealTimeStatusDataAborted += new RealTimeStatusDataAbortedEventHandler(Abort); _serialCommunicationCommandSetsModel.CommandSetPositionChanged += new CommandSetPositionChangedEventHandler(UpdatePositions); }