Ejemplo n.º 1
0
        public BrewingViewModel(Recipe recipe)
        {
            StartBrewingCommand   = new RelayCommand(StartExecute, StartCanExecute);
            PauseBrewingCommand   = new RelayCommand(PauseExecute, PauseCanExecute);
            AbortBrewingCommand   = new RelayCommand(AbortExecute, AbortCanExecute);
            StartNextPhaseCommand = new RelayCommand(StartNextExecute, StartNextCanExecute);

            MainTimer = new Timer(TimerCallback, null, 0, timerDueTime);

            Recipe = recipe;

            BrewingData = new BrewingData
            {
                HeaterStateOn = false,
                PumpStateOn   = false,
                Temperature   = 20
            };

            foreach (var phase in Recipe.Phases)
            {
                BrewingPhases.Add(new BrewingPhase(phase, arduinoConnection));
            }
        }
Ejemplo n.º 2
0
        public BrewingViewModel()
        {
            List <PumpInterval> pumpIntervals = new List <PumpInterval>();
            List <Ingredient>   ingredients   = new List <Ingredient>();
            List <Phase>        phases        = new List <Phase>();

            StartBrewingCommand   = new RelayCommand(StartExecute, StartCanExecute);
            PauseBrewingCommand   = new RelayCommand(PauseExecute, PauseCanExecute);
            AbortBrewingCommand   = new RelayCommand(AbortExecute, AbortCanExecute);
            StartNextPhaseCommand = new RelayCommand(StartNextExecute, StartNextCanExecute);

            MainTimer = new Timer(TimerCallback, null, 0, timerDueTime);


            pumpIntervals.Add(new PumpInterval {
                Name = "AUS", RestTimeInSeconds = 0, RunningTimeInSeconds = 0
            });
            pumpIntervals.Add(new PumpInterval {
                Name = "Langsam", RestTimeInSeconds = 60, RunningTimeInSeconds = 10
            });
            pumpIntervals.Add(new PumpInterval {
                Name = "Schnell", RestTimeInSeconds = 120, RunningTimeInSeconds = 20
            });

            ingredients.Add(new Ingredient {
                Name = "Gerste", Amount = 10, Typ = IngredientTyp.Kilogram
            });
            ingredients.Add(new Ingredient {
                Name = "Hopfen", Amount = 0.7, Typ = IngredientTyp.Kilogram
            });
            ingredients.Add(new Ingredient {
                Name = "Wasser", Amount = 86, Typ = IngredientTyp.Liter
            });

            phases.Add(new Phase {
                Position = 0, Name = "Aufwärmen", PeriodOfMinutes = 1, TargetTemperature = 50, Typ = PhaseTyp.HeatUp, PumpInterval = pumpIntervals[0]
            });
            phases.Add(new Phase {
                Position = 1, Name = "Halten", PeriodOfMinutes = 1, TargetTemperature = 50, Typ = PhaseTyp.KeepHeat, PumpInterval = pumpIntervals[2]
            });
            phases.Add(new Phase {
                Position = 2, Name = "Aufwärmen 2", PeriodOfMinutes = 1, TargetTemperature = 70, Typ = PhaseTyp.KeepHeat, PumpInterval = pumpIntervals[2]
            });
            phases.Add(new Phase {
                Position = 3, Name = "Rast 2", PeriodOfMinutes = 1, TargetTemperature = 70, Typ = PhaseTyp.KeepHeat, PumpInterval = pumpIntervals[2]
            });

            foreach (var phase in phases)
            {
                BrewingPhases.Add(new BrewingPhase(phase, arduinoConnection));
            }

            Recipe = new Recipe()
            {
                ID          = 0,
                Description = "Das ist ein seher seher leckeres Bier welches hier gebraut werden soll.",
                Name        = "Keller Pilz",
                Ingredients = ingredients,
                Phases      = phases,
                IsFavorite  = false
            };

            BrewingData = new BrewingData
            {
                HeaterStateOn = true,
                PumpStateOn   = true,
                Temperature   = 85
            };
        }