private void Button7_Click(object sender, EventArgs e) { Baguet newBg = serialization.Deserialize(); string str = String.Format("Object DEserialized: Width: {0}, Height: {1}, Cost: {2}", newBg.Width, newBg.Height, newBg.Cost); textBox9.Text = str; }
private void Button1_Click(object sender, EventArgs e) { //Storage st = new Storage(); if (radioButton1.Checked) { order = new Order(Storage.MaterialTakingFromDB); } else if (radioButton2.Checked) { order = new Order(Storage.MaterialTakingFromFile); } list = new List <Type>(); Type[] materials; if (checkBox1.Checked) { list.Add(typeof(Wood)); } if (checkBox2.Checked) { list.Add(typeof(MetalProfile)); } if (checkBox3.Checked) { list.Add(typeof(PlasticProfile)); } if (checkBox4.Checked) { list.Add(typeof(Dye)); } if (checkBox5.Checked) { for (int i = 0; i < trackBar1.Value; i++) { list.Add(typeof(Polish)); } } materials = list.ToArray(); try { // || // || // \/ bg = order.MakeOrder(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text), materials); if (order.Cost == -1) { MessageBox.Show("Not enough materials in storage"); } else if (order.Cost > 0) { MessageBox.Show("Cost of your baguet is " + order.Cost); } } catch (FormatException ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); MessageBox.Show(ex.GetType().ToString()); } }