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);
         }
     }
 }
Ejemplo n.º 3
0
 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();
     }
 }