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()) { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; MeltingBowl bowl = frm.formObj["meltingBowl"] as MeltingBowl; marker.show(new System.Drawing.Point(bowl.frmObj.Location.X + (bowl.frmObj.Width / 2) - marker.frmObj.Width / 2, bowl.frmObj.Location.Y - marker.frmObj.Height)); } else { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is InstantCoffee) { var lObj = obj as InstantCoffee; hasCoffee = true; InterfaceObjects.ItemBinding.unbindItem(); lObj.hasAddedToWater = true; lObj.frmObj.Dispose(); updateImage(); } 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); } }
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; Scales scale = frm.formObj["scales"] as Scales; marker.show(new System.Drawing.Point(scale.frmObj.Location.X - (marker.frmObj.Width / 2), scale.frmObj.Location.Y - marker.frmObj.Height)); } }
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); } }
private void FrmObj_Click(object sender, EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { var obj = InterfaceObjects.ItemBinding.getBoundClass(); Form1 frm = (Form1)System.Windows.Forms.Application.OpenForms["Form1"]; if (obj is ChocolateBar) { hasChocolate = true; updateImage(); ChocolateBar choc = obj as ChocolateBar; choc.consumeChocolate(200); InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; marker.hide(); } else if (obj is Cream) { hasCream = true; updateImage(); Cream cream = obj as Cream; cream.frmObj.Dispose(); InteractionMarker marker = frm.formObj["marker"] as InteractionMarker; marker.hide(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } InterfaceObjects.ItemBinding.unbindItem(); } else { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); } }
private void FrmObj_Click(object sender, EventArgs e) { if (InterfaceObjects.ItemBinding.hasBoundItem()) { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is FlourAmount) { hasFlower = true; FlourAmount amt = obj as FlourAmount; amt.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(true); updateImage(); } else if (obj is SugarAmount) { hasSugar = true; SugarAmount sug = obj as SugarAmount; sug.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(true); updateImage(); } else if (obj is Egg) { eggCount++; Egg egg = obj as Egg; frm.formObj.Remove("egg"); frm.Controls.Remove(egg.frmObj); InterfaceObjects.ItemBinding.unbindItem(true); updateImage(); } else if (obj is Soda) { hasSoda = true; Soda soda = obj as Soda; soda.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); } else if (obj is ButterMilk) { hasButtermilk = true; ButterMilk milk = obj as ButterMilk; milk.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); } else if (obj is Cocoa) { hasCocoa = true; Cocoa cocoa = obj as Cocoa; cocoa.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); updateImage(); } else if (obj is Mixer) { Mixer mixer = obj as Mixer; if (isFinished()) { isMixed = true; mixer.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_9); updateImage(); } } else if (obj is MeltingBowl) { MeltingBowl bowl = obj as MeltingBowl; if (bowl.isBowlMelted()) { hasChocolate = true; bowl.frmObj.Dispose(); InterfaceObjects.ItemBinding.unbindItem(); TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_8); updateImage(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } } else if (obj is Flour || obj is Sugar) { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } checkState(); InteractionMarker mrk = frm.formObj["marker"] as InteractionMarker; mrk.hide(); } else { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); } }