private void FrmObj_Click(object sender, EventArgs e) { if (!InterfaceObjects.ItemBinding.hasBoundItem()) { if (chocAmount == 400) { //Move marker to above new picturebox InteractionMarker mark = frm.formObj["marker"]; MeltingBowl bowl = frm.formObj["meltingBowl"]; mark.show(new System.Drawing.Point(bowl.frmObj.Location.X, bowl.frmObj.Location.Y - 40)); } else { InteractionMarker mark = frm.formObj["marker"]; CoveringBowl bowl = frm.formObj["coveringBowl"]; mark.show(new System.Drawing.Point(bowl.frmObj.Location.X, bowl.frmObj.Location.Y - 40)); } InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); } else { //Potentially replace with window for slicing 200g chocolate. var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is MeltingBowl) { consumeChocolate(200); InterfaceObjects.ItemBinding.unbindItem(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } } }
private void FrmObj_Click(object sender, EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } else { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; CoveringBowl bowl = frm.formObj["coveringBowl"] as CoveringBowl; marker.show(bowl.frmObj.Location); } }
public override void interaction() { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is Butter) { addButter(obj as Butter); } else if (obj is MixingBowl) { MixingBowl bowl = obj as MixingBowl; if (bowl.isBowlMixed()) { isFilled = true; frmObj.BackgroundImage = Properties.Resources.CakeTinFull; bowl.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } } else if (obj is CoveringBowl) { CoveringBowl bowl = obj as CoveringBowl; if (bowl.isFinished() && isCut) { try { Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; InterfaceObjects.ItemBinding.blockAction(); frm.Controls.Add(Panels.EndPanel.getPanel()); Sink sink = frm.formObj["sink"] as Sink; sink.frmObj.Dispose(); CoveringBowl bwl = frm.formObj["coveringBowl"] as CoveringBowl; bwl.frmObj.Dispose(); } catch (Exception e) { //handled... } } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } } else if (obj is Knife) { if (isCooked) { InterfaceObjects.SlicingSubmenuWrapper.createSubmenu(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); InterfaceObjects.ItemBinding.unbindItem(); } } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); InterfaceObjects.ItemBinding.unbindItem(); } }
private void FrmObj_Click(object sender, System.EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { var loc = InterfaceObjects.ItemBinding.getBoundClass(); if (loc is Caketin) { Caketin lObj = loc as Caketin; if (lObj.isBowlFilled()) { hasCaketinInOven = true; lObj.hide(); InterfaceObjects.ItemBinding.unbindItem(); changeCakeOvenImage(); Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_10); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); InterfaceObjects.ItemBinding.unbindItem(); } } else if (loc is MeltingBowl) { MeltingBowl lObj = loc as MeltingBowl; if (lObj.isComplete()) { lObj.setMelted(); Form1 frm = (Form1)Application.OpenForms["Form1"]; TaskListBox tasks = frm.formObj["tasks"]; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_5); InterfaceObjects.ItemBinding.unbindItem(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } } else if (loc is CoveringBowl) { CoveringBowl bowl = loc as CoveringBowl; if (bowl.hasIngredients()) { bowl.hasHeated = true; bowl.frmObj.BackgroundImage = Properties.Resources.Glass_Mixing_Bowl_Chocolate; Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_12); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } InterfaceObjects.ItemBinding.unbindItem(); } else { InterfaceObjects.ItemBinding.unbindItem(); ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } } else { if (hasCaketinInOven && elapsedTimeInoven >= (cookingTime + (cookingTime / 4))) { Form1 frm = (Form1)Application.OpenForms["Form1"]; if (elapsedTimeInoven >= (cookingTime - (cookingTime / 4))) { hasCaketinInOven = false;; Caketin tin = frm.formObj["caketin"] as Caketin; tin.isCooked = true; tin.frmObj.BackgroundImage = Properties.Resources.CoolingRack; tin.show(); changeCakeOvenImage(); turnOvenOff(); //tin.frmObj.SetBounds(lObj.frmObj.Location.X, lObj.frmObj.Location.X, 280, 150); } } } }