private void BreadCompletedHandler1(Oven oven, BreadBakedEventArgs args) { Action updateOutputText = () => { textBox1.Text += "Baking Complete\r\n"; textBox1.Text += "Bread flavor is: " + args.Bread.Flavor + "\r\n"; }; this.BeginInvoke(updateOutputText); }
public Form1() { InitializeComponent(); appliances = new List <Appliance>(); appliance = new Oven("oven big", 200, 200); freezer1 = new Freezer("freezer type freezer", 122, -10); freezer2 = new Freezer("freezer type freezer", 155, -20); oven = new Oven("oven", 222, 500); appliances.Add(appliance); appliances.Add(freezer1); appliances.Add(freezer2); appliances.Add(oven); }
private void bakeBread_Click(object sender, EventArgs e) { int length = 1024; StringBuilder sb = new StringBuilder(length); int result = GetCurrentPackageFullName(ref length, sb); if (result != APPMODEL_ERROR_NO_PACKAGE) { this.Text += " - " + sb.ToString(); } //Initialize the oven and register eventlisteners if (_myOven == null) { _myOven = new Microsoft.SDKSamples.Kitchen.Oven(); _myOven.BreadBaked += new TypedEventHandler <Oven, BreadBakedEventArgs>(BreadCompletedHandler1); } _myOven.BakeBread("Wheat"); }