private void FrmObj_Click(object sender, EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is MixingBowl) { MixingBowl bowl = obj as MixingBowl; if (bowl.isFinished()) { bowl.setMixed(); Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_9); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } InterfaceObjects.ItemBinding.unbindItem(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } } else { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); } }
private void FrmObj_Click(object sender, EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } else { Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; Egg egg = new Egg(); egg.setSize(frm.getResolution()); InterfaceObjects.ItemBinding.bindItemToCursor(egg.frmObj, egg); frm.formObj.Add("egg", egg); frm.Controls.Add(egg.frmObj); InteractionMarker mrk = frm.formObj["marker"] as InteractionMarker; MixingBowl bwl = frm.formObj["mixingBowl"] as MixingBowl; mrk.show(new System.Drawing.Point(bwl.frmObj.Location.X + (bwl.frmObj.Width / 2), bwl.frmObj.Location.Y - mrk.frmObj.Height)); updateState(); } }
private void FrmObj_Click(object sender, EventArgs e) { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is Flour) { Form1 frm = (Form1)Application.OpenForms["Form1"]; Flour flour = obj as Flour; flour.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); FlourAmount amt = new FlourAmount(); amt.setSize(frm.getResolution()); frm.Controls.Add(amt.frmObj); InterfaceObjects.ItemBinding.bindItemToCursor(amt.frmObj, amt); InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; MixingBowl mixing = frm.formObj["mixingBowl"]; marker.setPosition(mixing.frmObj.Location.X, mixing.frmObj.Location.Y); } else if (obj is Sugar) { Sugar sug = obj as Sugar; sug.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); Form1 frm = (Form1)Application.OpenForms["Form1"]; SugarAmount amt = new SugarAmount(); amt.setSize(frm.getResolution()); frm.Controls.Add(amt.frmObj); InterfaceObjects.ItemBinding.bindItemToCursor(amt.frmObj, amt); InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; MixingBowl mixing = frm.formObj["mixingBowl"]; marker.setPosition(mixing.frmObj.Location.X, mixing.frmObj.Location.Y); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } }
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(); } }