void ItemChanged(Oven item) { PreviousMonkey = CurrentMonkey; CurrentMonkey = item; OnPropertyChanged("PreviousMonkey"); OnPropertyChanged("CurrentMonkey"); }
void Attack() { if (Physics.Raycast(bulletLocation.transform.position, bulletLocation.transform.forward, out hit, normalBulletRange)) { if (hit.collider.gameObject.CompareTag("Enemy")) { EnemyHealth enemyHealth = hit.collider.GetComponent <EnemyHealth>(); enemyHealth.currentEnemyHealth -= normalBulletDamage; enemyHealth.healthBar.fillAmount = enemyHealth.currentEnemyHealth / enemyHealth.initialEnemyHealth; } else if (hit.collider.name == "Pause_Button") { Screen screenScript = hit.collider.transform.parent.GetComponent <Screen>(); screenScript.PauseGame(); } else if (hit.collider.name == "Oven_Operator" && pUs.hasGoldCoin == true) { Oven ovenScript = hit.collider.transform.parent.GetComponent <Oven>(); ovenScript.UseOven(); pUs.GoldCoin(false); } else if (hit.collider.name == "Trap" && pUs.hasGoldCoin == true) { Trap trapScript = hit.collider.transform.parent.GetComponent <Trap>(); trapScript.useTrap(); pUs.GoldCoin(false); } else if (hit.collider.name == "Lock" && pUs.hasGoldCoin == true) { Map_Extention mEs = hit.collider.transform.parent.GetComponent <Map_Extention>(); mEs.OpenArea(); pUs.GoldCoin(false); } } }
private void rowUp(object sender, RoutedEventArgs e) { Button upButton = sender as Button; if (upButton == null) { return; } DataGridRow dgrow = FindItem.FindParentItem <DataGridRow>(upButton); if (dgrow == null) { return; } Oven oven = (Oven)dgrow.Item; if (oven == null) { return; } if (!oven.up()) { MessageBox.Show("При выполнении запроса произошли ошибки!\nПодробнее см. в логе ошибок."); } }
public override bool UseItem(Item otherItem) { if (otherItem is Key) { locked = !locked; } else if (otherItem is Oven) { Oven oven = otherItem as Oven; Item itemRemoved = oven.RemoveItem(this); if (itemRemoved != null) { for (int j = 0, length = itemsInside.Length; j < length; j++) { Item item = itemsInside[j]; if (item != null && item is Key) { oven.AddItem(item); } } } } return(true); }
/// <summary> /// Use the custom Oven and Bread Windows Runtime components. /// </summary> /// <param name="sender">Contains information about the button that fired the event.</param> /// <param name="e">Contains state information and event data associated with a routed event.</param> private void OvenClientRun(object sender, RoutedEventArgs e) { Dimensions dimensions; dimensions.Width = 2; dimensions.Height = 2; dimensions.Depth = 2; // Component Creation Oven myOven = new Oven(dimensions); // Getters and setters are accessed using property syntax OvenClientOutput.Text += "Oven volume is: " + myOven.Volume.ToString() + "\n"; // Register even listeners myOven.BreadBaked += new TypedEventHandler <Oven, Bread>(BreadCompletedHandler1); myOven.BreadBaked += new TypedEventHandler <Oven, Bread>(BreadCompletedHandler2); myOven.BreadBaked += new TypedEventHandler <Oven, Bread>(BreadCompletedHandler3); // Unregister from an event using the -= syntax and a delegate instance myOven.BreadBaked -= new TypedEventHandler <Oven, Bread>(BreadCompletedHandler3); // Bake a loaf of bread. This will trigger the BreadBaked event. myOven.BakeBread("Sourdough"); // Trigger the event again with a different preheat time myOven.ConfigurePreheatTemperature(OvenTemperature.High); myOven.BakeBread("Wheat"); }
public void BrokenNativeCallback() { var oven = new Oven(); // Cook is a Java opcode that executes an external C function that will crash the app. oven.Cook(); }
static void Main(string[] args) { Oven oven; //Static factory oven = Oven.GetOven(DishType.Burger); oven.Prepare(); oven = Oven.GetOven(DishType.Pizza); oven.Prepare(); //Delegate factory oven = Oven.GetOven(() => new BurgerOven()); oven.Prepare(); oven = Oven.GetOven(() => new PizzaOven()); oven.Prepare(); //True factory oven = new BurgerCreator().GetOven(); oven.Prepare(); oven = new PizzaCreator().GetOven(); oven.Prepare(); //Generic true factory oven = OvenGenericFactory <PizzaCreator> .Create(); oven.Prepare(); oven = OvenGenericFactory <BurgerCreator> .Create(); oven.Prepare(); }
void RemoveMonkey(Oven monkey) { if (Ovens.Contains(monkey)) { Ovens.Remove(monkey); } }
public OvenPage() { InitializeComponent(); DataContext = new { Collection = OvenController.instance().ViewSource.View }; OvenController.instance().ViewSource.SortDescriptions.Add(new SortDescription(OrderSettings.OvenSortColumn, OrderSettings.OvenSortDirection)); btnAdd.Click += delegate { OvenSaveWindow ovenSaveWindow = new OvenSaveWindow(); ovenSaveWindow.ShowDialog(); }; btnEdit.Click += delegate { Oven selectedOven = (Oven)dgOven.SelectedItem; if (selectedOven == null) { MessageBox.Show("Выберите редактируемую запись!"); return; } OvenSaveWindow ovenSaveWindow = new OvenSaveWindow(selectedOven); ovenSaveWindow.ShowDialog(); }; btnDelete.Click += delegate { Oven selectedOven = (Oven)dgOven.SelectedItem; if (selectedOven == null) { MessageBox.Show("Выберите удаляемую запись!"); return; } if (MessageBox.Show("Подтвердите удаление!", "Подтвердите удаление!", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { selectedOven.remove(); } }; btnUp.Click += delegate { Oven oven = dgOven.SelectedItem as Oven; if (oven == null) { return; } up(oven); }; btnDown.Click += delegate { Oven oven = dgOven.SelectedItem as Oven; if (oven == null) { return; } down(oven); }; }
public void LeaveOven(Oven oven) { if (oven == NearbyOven) { NearbyOven.UnSelect(); NearbyOven = null; } }
public PizzaFacade(Dough dough, Cheese cheese, Sauce sauce, PizzaTopping topping) { this.dough = dough; this.cheese = cheese; this.sauce = sauce; this.topping = topping; this.oven = oven; }
async private void BreadCompletedHandler2(Oven oven, BreadBakedEventArgs bread) { Action updateOutputText = () => { OvenClientOutput.Text += "Event Handler 2: Invoked\n"; }; await OvenClientOutput.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(updateOutputText)); }
// Обработчик нажатия кнопки добавления компонентов protected void AddComponentButtonClick(object sender, EventArgs e) { Component newComponent; switch (dropDownComponentList.SelectedIndex) { default: newComponent = new TV(nameComponentBox.Text); break; case 1: newComponent = new Fridge(nameComponentBox.Text); break; case 2: newComponent = new Stove(nameComponentBox.Text); break; case 3: newComponent = new Oven(nameComponentBox.Text, 0, 96); break; case 4: newComponent = new MediaCenter(nameComponentBox.Text, 88.8); break; } //int id = (int)Session["NextId"]; //figuresDictionary.Add(id, newFigure); // Добавление фигуры в коллекцию //figuresPanel.Controls.Add(new FigureControl(id, figuresDictionary)); // Добавление графики для фигуры //id++; //Session["NextId"] = id; // проверка заполненности // проверка наличия имени string name = nameComponentBox.Text; if (nameComponentBox.Text == "") { infoLabel.ForeColor = Color.Red; infoLabel.Text = "Укажите имя компонента!"; } else if (componentList.ContainsKey(name)) { infoLabel.ForeColor = Color.Red; infoLabel.Text = "Такое имя уже существует. Укажите другое имя компонента."; } else { infoLabel.Text = ""; componentList.Add(name, newComponent); сomponentPanel.Controls.Add(new ComponentControl(name, componentList)); } Session["Components"] = componentList; }
protected override void populate(SQLiteDataReader reader) { Oven oven = new Oven(); oven.Id = reader.GetInt32(0); oven.Name = reader.GetString(1); oven.RowOrder = reader.GetInt32(2); add(oven); }
public void NextToOven(Oven oven) { if (NearbyOven != null) { NearbyOven.UnSelect(); } NearbyOven = oven; NearbyOven.Select(); }
public void should_caculate_ZF_postage_for_oven() { var oven = new Oven(1); var postage = new PostageCalculator().GetPostage(new List <IPostable> { oven }, m_Zt); Assert.AreEqual(30, postage); }
public ICollection <Measurement> GetMeasurements(long ovenId) { if (OvenExists(ovenId)) //oven has to exist { Oven oven = GetOven(ovenId); return(oven.Measurements); } throw new ArgumentException("Oven with given id doesn't exist."); }
public void Init(Oven oven) { this.oven = oven; this.lbName.Text = this.oven.Name; for (int j = 0; j < this.oven.Floors.Count; j++) { this.floorUCs[j].Init(this.oven.Floors[j]); } }
/// <summary> /// The set state. /// </summary> /// <param name="maker"> /// The maker. /// </param> /// <param name="currentTemperature"> /// The current temperature. /// </param> /// <param name="state"> /// The state. /// </param> public static void SetState(BiscuitMakerObject maker, int currentTemperature, OvenState state) { var isWorkingTemperature = currentTemperature <= maker.Settings.OvenMaxTemp && currentTemperature >= maker.Settings.OvenMinTemp; var newOven = Oven.Create(currentTemperature, state, isWorkingTemperature); maker.Components.Remove(maker.FirstOven); maker.Components.Add(newOven); }
public int prevRowOrderIndex(int currentIndex) { Oven oven = _collection.Where(x => x.RowOrder < currentIndex).OrderByDescending(y => y.RowOrder).FirstOrDefault(); if (oven == null) { return(0); } return(oven.RowOrder); }
public override bool UseItem(Item otherItem) { if (otherItem is Oven) { Oven oven = otherItem as Oven; oven.RemoveItem(this); } return(true); }
public int nextRowOrderIndex(int currentIndex) { Oven oven = _collection.Where(x => x.RowOrder > currentIndex).OrderBy(y => y.RowOrder).FirstOrDefault(); if (oven == null) { return(0); } return(oven.RowOrder); }
public int maxRowOrderIndex() { Oven oven = _collection.OrderByDescending(x => x.RowOrder).FirstOrDefault(); if (oven == null) { return(0); } return(oven.RowOrder); }
/// <inheritdoc /> public IImmutableList <PumpkinMuffin> CookPumpkinMuffins() { var oven = new Oven(); oven.Heat(166); return(MakeFlourMixture() .Select(flourMixture => MakeEggsMixture().Select(eggsMixture => PrepareBackingDish(flourMixture, eggsMixture))) .Select(backingDish => oven.Bake <PumpkinBatterCup, PumpkinMuffin>(backingDish, TimeSpan.FromMinutes(30)).ToMaybe()) .SelectOrElse(pumpkinMuffin => pumpkinMuffin.Cups, () => null)); }
private void down(Oven oven) { if (oven == null) { return; } if (!oven.down()) { MessageBox.Show("При выполнении запроса произошли ошибки!\nПодробнее см. в логе ошибок."); } }
public void Client1() { Dough dough = new Dough(); Sauce sauce = new Sauce("Tomato"); Topping mushroom = new Topping("Mushrooms"); Cheese mozzarella = new Cheese("Mozzarella"); Oven oven = new Oven(); PizzaFacade pf = new PizzaFacade(dough, sauce, mushroom, mozzarella); pf.MakePizza(); }
async private void BreadCompletedHandler1(Oven oven, BreadBakedEventArgs args) { Action updateOutputText = () => { OvenClientOutput.Text += "Event Handler 1: Invoked\n"; OvenClientOutput.Text += "Event Handler 1: Oven volume is: " + oven.Volume.ToString() + "\n"; OvenClientOutput.Text += "Event Handler 1: BreadBakedEventArgs flavor is: " + args.Bread.Flavor + "\n"; }; await OvenClientOutput.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(updateOutputText)); }
public void DeleteOven(Oven oven) { if (OvenExists(oven.OvenId)) { _context.Ovens.Remove(oven); } else { throw new ArgumentException("Oven with given id doesn't exist."); } }
public void Client2() { Dough dough = new Dough(); Sauce sauce = new Sauce("Tomato"); Topping greenPep = new Topping("Green Peppers"); Cheese mozzarella = new Cheese("Mozzarella"); Oven oven = new Oven(); PizzaFacade pf = new PizzaFacade(dough, sauce, mozzarella, greenPep); pf.MakePizza(); }
private void BreadCompletedHandler1(Oven oven, BreadBakedEventArgs args) { Action updateOutputText = () => { OvenClientOutput.Text += "Baking Complete\r\n"; OvenClientOutput.Text += "Bread flavor is: " + args.Bread.Flavor + "\r\n"; }; //await OvenClientOutput.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(updateOutputText)); this.BeginInvoke(updateOutputText); }
public Stove(CookingSurfase cs, Oven o) { this.myCookingSurfase = cs; this.MyOven = o; }
public void CreateDevice(Dictionary<string, Device> obj, string choice) { Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Меню создания компонента Умного дома".ToUpper() + "\n"); Console.ResetColor(); Console.WriteLine("Введите имя устройства"); string name = Console.ReadLine(); if (choice == "лампа") { Lamp myLamp = new Lamp(); myLamp.DeviceName = name; obj.Add(name, myLamp); Console.Clear(); Console.WriteLine("Компонент успешно создан \n".ToUpper()); Console.WriteLine(myLamp.ToString()); Console.ReadKey(); } if (choice == "кондиционер") { Conditioner myConditioner = new Conditioner(); myConditioner.DeviceName = name; SubMenuToCreateClimatobject(myConditioner); obj.Add(name, myConditioner); Console.Clear(); Console.WriteLine("Компонент успешно создан \n".ToUpper()); Console.WriteLine(myConditioner.ToString()); Console.ReadKey(); } if (choice == "котел") { HeatingBoiler myBoiler = new HeatingBoiler(); myBoiler.DeviceName = name; SubMenuToCreateClimatobject(myBoiler); obj.Add(name, myBoiler); Console.WriteLine("Компонент успешно создан \n".ToUpper()); Console.WriteLine(myBoiler.ToString()); Console.ReadKey(); } if (choice == "кухонная вытяжка") { KitchenVentilation myVentilation = new KitchenVentilation(); myVentilation.DeviceName = name; obj.Add(name, myVentilation); Console.Clear(); Console.WriteLine("Компонент успешно создан \n".ToUpper()); Console.WriteLine(myVentilation.ToString()); Console.ReadKey(); } if (choice == "плита") { Burner B1 = new Burner(); Burner B2 = new Burner(); Burner B3 = new Burner(); Burner B4 = new Burner(); CookingSurfase CS1 = new CookingSurfase("CS1", false, B1, B2, B3, B4); Oven O = new Oven(); Stove myCooker = new Stove(CS1, O); myCooker.DeviceName = name; obj.Add(name, myCooker); Console.Clear(); Console.WriteLine("Компонент успешно создан \n".ToUpper()); Console.WriteLine(myCooker.ToString()); Console.ReadKey(); } }
static void Main(string[] args) { Dictionary<string, Device> smartDevices = new Dictionary<string, Device>(); smartDevices.Add("L1", new Lamp("L1", false)); smartDevices.Add("C1", new Conditioner("C1", false, 40, 0, 0, EnumSeasons.summer)); Burner b1 = new Burner(); Burner b2 = new Burner(); Burner b3 = new Burner(); Burner b4 = new Burner(); CookingSurfase CookSurf = new CookingSurfase("CookSurf", false, b1, b2, b3, b4); Oven O1 = new Oven("Oven1", true, EnumOvenMode.bottomHeat, 0, true); smartDevices.Add("Cook1", new Stove("Cook1", false, CookSurf, O1)); smartDevices.Add("H1", new HeatingBoiler("H1", false, 40, 0, 0, EnumSeasons.summer)); smartDevices.Add("K1", new KitchenVentilation("K1", false, Mode.normal)); Menu menu = new Menu(); string command1; string command2; string[] C1; for (int count3 = 0; ; count3++) { menu.MainMenu(); command1 = Console.ReadLine(); Console.Clear(); C1 = command1.Split(' '); if (C1[0] == "выход") { Environment.Exit(0); } else { switch (C1[0]) { case "конфигурация": for (int count = 0; ; count++) { command2 = menu.MenuForKonfiguration(); string[] C2 = command2.Split(' '); if (C2[0] == "вернуться") { menu.MainMenu(); break; } else { switch (C2[0]) { case "создать": menu.CreateDevice(smartDevices, C2[3]); Console.Clear(); menu.DisplayObjectsAll(smartDevices); Console.ReadKey(); break; case "удалить": Console.Clear(); menu.DisplayObjectNames(smartDevices); menu.MenuToDeleteComponent(smartDevices); menu.DisplayObjectsAll(smartDevices); Console.ReadKey(); break; } } } break; case "управление": try { menu.MenuToManageComponent(smartDevices); } catch (OverflowException e) { Console.WriteLine("ОШИБКА: " + e.Message); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine("ОШИБКА: " + ex.Message); Console.ReadKey(); } break; case "отображение": menu.MenuToDisplayObjects(smartDevices); break; } } } }
public void should_caculate_postage_for_oven() { var oven = new Oven(2); var postage = new PostageCalculator().GetPostage(new List<IPostable> {oven}); Assert.AreEqual(80, postage); }
public Stove(string deviceName, bool deviceState, CookingSurfase myCookingSurfase, Oven myOven) : base(deviceName, deviceState) { this.MyCookingSurfase = myCookingSurfase; this.MyOven = myOven; }