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()) { InterfaceObjects.ItemBinding.bindItemToCursor(frmObj, this); } else { var obj = InterfaceObjects.ItemBinding.getBoundClass(); if (obj is ChocolateBar) { var lObj = obj as ChocolateBar; lObj.consumeChocolate(200); TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_2); isChocolate = true; updateImage(); } else if (obj is Butter) { var lObj = obj as Butter; if (!lObj.hasBeenMixed) { lObj.useButter(); lObj.hasBeenMixed = true; isButtered = true; TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_3); updateImage(); } } else if (obj is MeasuringJug) { MeasuringJug lObj = obj as MeasuringJug; if (lObj.isComplete()) { isWatered = true; TaskListBox tasks = frm.formObj["tasks"]; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_4); lObj.hide(); lObj.setPosition(-50, -50); updateImage(); } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NOT_READY, 5); } } else { ErrorLogic.Error.showErrorDialog(Properties.Resources.NO_INTERACTION, 5); } var marker = frm.formObj["marker"] as InteractionMarker; marker.hide(); InterfaceObjects.ItemBinding.unbindItem(); } }
private void checkFinished() { if (hasCutOne && hasCutTwo) { Form1 frm = (Form1)Application.OpenForms["Form1"]; Classes.FormObjects.ObjectSpecific.TaskListBox tasks = frm.formObj["tasks"] as Classes.FormObjects.ObjectSpecific.TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_11); Classes.FormObjects.ObjectSpecific.Caketin tin = frm.formObj["caketin"] as Classes.FormObjects.ObjectSpecific.Caketin; tin.markCut(); Dispose(); } }
public void checkState() { if (isNearlyFinished()) { TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_6); } if (isFinished()) { TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_7); } }
private void updateImage() { if (hasChocolate && hasCream && hasHeated) { frmObj.BackgroundImage = Properties.Resources.Glass_Mixing_Mixed_Melted; Form1 frm = (Form1)Application.OpenForms["Form1"]; TaskListBox tasks = frm.formObj["tasks"] as TaskListBox; tasks.markTaskComplete(Properties.Resources.INSTRUCTION_2); } else if (hasChocolate && hasCream) { frmObj.BackgroundImage = Properties.Resources.Glass_Mixing_Bowl_Cream_Chocolate; } else if (hasChocolate) { frmObj.BackgroundImage = Properties.Resources.Glass_Mixing_Bowl_Chocolate; } else if (hasCream) { frmObj.BackgroundImage = Properties.Resources.Glass_Mixing_Bowl_Flower; } }
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); } }
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); } } } }