public void ShutdownMashine() { container.Save(); // disconnect from database // network shutdown Mashine = MashineState.ShuttingDown; }
public ATMLogic() { Mashine = MashineState.StartingUp; maximumTries = 3; remainingTries = maximumTries; // connect to network // connect to database container = new(); container.Load(); Thread.Sleep(1000); Mashine = MashineState.Running; }
internal void ShutDown() { MashineSettings ms = new MashineSettings { Ingredients = ingredients, containerCoffee = containerCoffee, containerWater = containerWater, containerWasteCoffee = containerWasteCoffee, containerWasteWater = containerWasteWater, containerMilk = containerMilk }; var formatter = new XmlSerializer(typeof(MashineSettings)); using (var writer = new FileStream("MashineSettings.xml", FileMode.Create, FileAccess.Write)) { formatter.Serialize(writer, ms); } // save settings GetState = MashineState.Stopping; }
public CoffeeMashine() { GetState = MashineState.Starting; MashineSettings ms; var formatter = new XmlSerializer(typeof(MashineSettings)); using (var reader = new FileStream("MashineSettings.xml", FileMode.Open, FileAccess.Read)) { ms = (MashineSettings)formatter.Deserialize(reader); } ingredients = ms.Ingredients; containerCoffee = ms.containerCoffee; containerWater = ms.containerWater; containerWasteCoffee = ms.containerWasteCoffee; containerWasteWater = ms.containerWasteWater; containerMilk = ms.containerMilk; /* * Ingredient newIngredient; * newIngredient.RecipeName = Recipe.Coffee; * newIngredient.ContainerCoffee = 3; * newIngredient.ContainerWasteCoffee = 3; * newIngredient.ContainerWater = 10; * newIngredient.ContainerWasteWater = 1; * newIngredient.ContainerMilk = 0; * ingredients.Add(newIngredient); * * newIngredient.RecipeName = Recipe.Capuchino; * newIngredient.ContainerCoffee = 3; * newIngredient.ContainerWasteCoffee = 3; * newIngredient.ContainerWater = 3; * newIngredient.ContainerWasteWater = 1; * newIngredient.ContainerMilk = 7; * ingredients.Add(newIngredient); * * newIngredient.RecipeName = Recipe.CoffeeMilk; * newIngredient.ContainerCoffee = 3; * newIngredient.ContainerWasteCoffee = 3; * newIngredient.ContainerWater = 8; * newIngredient.ContainerWasteWater = 1; * newIngredient.ContainerMilk = 2; * ingredients.Add(newIngredient); * * newIngredient.RecipeName = Recipe.HotMilk; * newIngredient.ContainerCoffee = 0; * newIngredient.ContainerWasteCoffee = 0; * newIngredient.ContainerWater = 0; * newIngredient.ContainerWasteWater = 1; * newIngredient.ContainerMilk = 10; * ingredients.Add(newIngredient); * * newIngredient.RecipeName = Recipe.HotWater; * newIngredient.ContainerCoffee = 0; * newIngredient.ContainerWasteCoffee = 0; * newIngredient.ContainerWater = 10; * newIngredient.ContainerWasteWater = 1; * newIngredient.ContainerMilk = 0; * ingredients.Add(newIngredient); * */ //Maintenance(); GetState = MashineState.Running; }