// Constructor public Pump2ViewModel() { // Initializing model instances brewery = new Brewery(); // Registering to incoming messages Messenger.Default.Register<Brewery>(this, "Pump2Update", Pump2Update_MessageReceived); }
public DebugToolViewModel() { // Model Instances brewery = new Brewery(); // Timer Instances UpdateTimer = new DispatcherTimer(); UpdateTimer.Tick += UpdateTimer_Tick; UpdateTimer.Interval = TimeSpan.FromMilliseconds(100); UpdateTimer.Start(); }
public BreweryCommands() { arduino = new ArduinoCommands(device = new LSPProtocol(new SimplePacketProtocolPacketEncoder())); hardwareSettings = new HardwareSettings(); brewery = new Brewery(); ProcessSettings = new Process.settings(); Messenger.Default.Register<AnalogReturn>(this, "VolumeUpdate", VolumeUpdate_MessageReceived); Messenger.Default.Register<DigitalReturn>(this, DigitalReturn_MessageReceived); Messenger.Default.Register<HardwareSettings>(this, "HardwareSettingsUpdate", UpdateHardwareSettings); Messenger.Default.Register<Probes>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived); Messenger.Default.Register <bool>(this, "DesignMode", DesignMode_MessageReceived); }
private void MLTVolumeUpdate_MessageReceived(Brewery _brewery) { // Update the Volume brewery.MLT.Volume.Value = _brewery.MLT.Volume.Value; // Raise the volume related properties changed event RaisePropertyChanged(MLT_VolumePropertyName); RaisePropertyChanged(WaterHeightPropertyName); }
private void DesignModeTempUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value; brewery.MLT.Temp.Value = _brewery.MLT.Temp.Value; brewery.BK.Temp.Value = _brewery.BK.Temp.Value; }
private void HLTTempSetPointUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Temp.SetPoint = _brewery.HLT.Temp.SetPoint; RaisePropertyChanged(Thermo_Height_SetPointPropertyName); RaisePropertyChanged(Thermo_SetPointPropertyName); }
private void HLTVolumeSetPointUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Volume.SetPoint = _brewery.HLT.Volume.SetPoint; RaisePropertyChanged(HLT_Volume_SetPointPropertyName); RaisePropertyChanged(WaterHeightSetPointPropertyName); }
private void VolumeUpdate_MessageReceived(Brewery _brewery) { // Update the Volume if(_brewery.HLT.Volume.Value == 500) { return; } brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value; // Raise the volume related properties changed event RaisePropertyChanged(HLT_VolumePropertyName); RaisePropertyChanged(WaterHeightPropertyName); }
// BK Set Point Update private void BKTempSetPointUpdate_MessageReceived(Brewery _brewery) { brewery.BK.Temp.SetPoint = _brewery.BK.Temp.SetPoint; }
// MLT Set Point Update private void MLTTempSetPointUpdate_MessageReceived(Brewery _brewery) { brewery.MLT.Temp.SetPoint = _brewery.MLT.Temp.SetPoint; }
// Pump 2 Update private void Pump2Update_MessageReceived(Brewery _brewery) { brewery.Pump2.IsOn = _brewery.Pump2.IsOn; }
// BK Burner Update private void BKBurnerUpdate_MessageReceived(Brewery _brewery) { brewery.BK.Burner.IsOn = _brewery.BK.Burner.IsOn; }
// MLT Burner Update private void MLTBurnerUpdate_MessageReceived(Brewery _brewery) { brewery.MLT.Burner.IsOn = _brewery.MLT.Burner.IsOn; }
private void DesignModeVolumeUpdate_MessageReceived(Brewery _brewery) { if (_brewery.HLT.Volume.Value != 500) { brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value; } if (_brewery.BK.Volume.Value != 500) { brewery.BK.Volume.Value = _brewery.BK.Volume.Value; } }
public HLTViewModel() { // Create new instances of model classes brewery = new Brewery(); // Register to sensor update messages Messenger.Default.Register<Brewery>(this, "VolumeUpdate", VolumeUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTBurnerUpdate", HLTBurnerUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTVolumeSetPointUpdate", HLTVolumeSetPointUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTVolumeSetPointReachedUpdate", HLTVolumeSetPointReachedUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTTempSetPointUpdate", HLTTempSetPointUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTTempSetPointReachedUpdate", HLTTempSetPointReachedUpdate_MessageReceived); }
private void TemperatureUpdate_MessageReceived(Brewery _brewery) { // Update the Tempperature brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value; // Raise the temp related properties changed event RaisePropertyChanged(HLT_TempPropertyName); RaisePropertyChanged(Thermo_HeightPropertyName); }
// BK Set Point Reached Update private void BKTempSetPointReachedUpdate_MessageReceived(Brewery _brewery) { brewery.BK.Temp.SetPointReached = _brewery.BK.Temp.SetPointReached; }
// HLT Burner Update private void HLTBurnerUpdate_MessageReceived(Brewery _brewery) { // Update the HLT burner state brewery.HLT.Burner.IsOn = _brewery.HLT.Burner.IsOn; // Raise the flames visibility changed event RaisePropertyChanged(Flames_VisibilityPropertyName); }
// MainViewModel Class Constructor public MainViewModel() { // Creating new instance of model breweryCommand = new BreweryCommands(); hardwareSettings = new HardwareSettings(); brewery = new Brewery(); process = new Process(); probes = new Probes(); userAlarm = new UserAlarm(); // Initializing RelayCommand Instances ConnectionSetupClickCommand = new RelayCommand(connectionSetupClickCommand); HardwareSetupClickCommand = new RelayCommand(hardwareSetupClickCommand); StartBrewSessionClickCommand = new RelayCommand(startBrewSessionClickCommand); MainClosingCommand = new RelayCommand(mainClosing); LoadRecipeClickCommand = new RelayCommand(loadRecipeClickCommand); DebugDesignSessionClickCommand = new RelayCommand(debugDesignClickCommand); // Initializing Timers UpdateTempSensorTimer = new DispatcherTimer(); UpdateVolSensorTimer = new DispatcherTimer(); AlarmTimer = new DispatcherTimer(); PrimingTimer = new DispatcherTimer(); MashStepTimer = new DispatcherTimer(); BoilTimer = new DispatcherTimer(); // Initializing Sound Player Player = new MediaPlayer(); // Initializing Machine State Variables MashStepComplete = false; FirstMashStep = true; FirstSparge = true; SpargeModeOn = false; BoilOverSent = false; BoilComplete = false; StepStartTime = new TimeSpan(); RemainingTime = new TimeSpan(); StepEndTime = new TimeSpan(); // Initializing the brewery State breweryState = BreweryState.StandBy; RaisePropertyChanged(BreweryStateDisplayPropertyName); // Initializing Messenger Registers Messenger.Default.Register<NotificationMessage>(this, "BreweryCommand", BreweryCommand_MessageReceived); Messenger.Default.Register<Brewery>(this, "ConnectionUpdate" , ConnectionUpdate_MessageReceived); Messenger.Default.Register<HardwareSettings>(this, "HardwareSettingsUpdate", HardwareSettings_MessageReceived); Messenger.Default.Register<Brewery>(this, "TemperatureUpdate", TemperatureUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "VolumeUpdate", VolumeUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTBurnerUpdate", HLTBurnerUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "MLTBurnerUpdate", MLTBurnerUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "BKBurnerUpdate", BKBurnerUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "Pump1Update", Pump1Update_MessageReceived); Messenger.Default.Register<Brewery>(this, "Pump2Update", Pump2Update_MessageReceived); Messenger.Default.Register<string>(this, "SelectedcomPort", SelectedcomPort_MessageReceived); Messenger.Default.Register<Process>(this, Process_MessageReceived); Messenger.Default.Register<Probes>(this, "GetConnectedProbes", GetConnectedProbes_MessageReceived); Messenger.Default.Register<UserAlarm>(this, "UserAlarmReturn", UserAlarmReturn_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTTempSetPointUpdate", HLTTempSetPointUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "MLTTempSetPointUpdate", MLTTempSetPointUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "BKTempSetPointUpdate", BKTempSetPointUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "HLTTempSetPointReachedUpdate", HLTTempSetPointReachedUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "MLTTempSetPointReachedUpdate", MLTTempSetPointReachedUpdate_MessageReceived); Messenger.Default.Register<Brewery>(this, "BKTempSetPointReachedUpdate", BKTempSetPointReachedUpdate_MessageReceived); }
private void HLTVolumeSetPointReachedUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Volume.SetPointReached = _brewery.HLT.Volume.SetPointReached; RaisePropertyChanged(HLT_SetPoint_Label_VisibilityPropertyName); }
// Temperature Update private void TemperatureUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Temp.Value = _brewery.HLT.Temp.Value; brewery.MLT.Temp.Value = _brewery.MLT.Temp.Value; brewery.BK.Temp.Value = _brewery.BK.Temp.Value; RunAutoStateMachine(); }
private void HLTTempSetPointReachedUpdate_MessageReceived(Brewery _brewery) { brewery.HLT.Temp.SetPointReached = _brewery.HLT.Temp.SetPointReached; RaisePropertyChanged(Thermo_SetPoint_VisibilityPropertyName); }
// Volume Update private void VolumeUpdate_MessageReceived(Brewery _brewery) { if (_brewery.HLT.Volume.Value != 500) { brewery.HLT.Volume.Value = _brewery.HLT.Volume.Value; } if (_brewery.BK.Volume.Value != 500) { brewery.BK.Volume.Value = _brewery.BK.Volume.Value; } RunAutoStateMachine(); }
// Message Received handling private void Pump2Update_MessageReceived(Brewery _brewery) { brewery.Pump2.IsOn = _brewery.Pump2.IsOn; RaisePropertyChanged(PumpIsOnColorPropertyName); }
// Connection State private void ConnectionUpdate_MessageReceived(Brewery _brewery) { if(_brewery.IsConnected != brewery.IsConnected) { brewery.IsConnected = _brewery.IsConnected; Messenger.Default.Send<bool>(brewery.IsConnected, "ConnectButtonContent"); RaisePropertyChanged(ConnectionStatusPropertyName); if (process.Session.StartRequested) { startBrewSessionClickCommand(); } if(brewery.IsConnected) { Messenger.Default.Send<NotificationMessageAction>(new NotificationMessageAction("CloseConnectionSetup",ConnectionSetupCloseCallback), "WindowOperation"); } } }