public static void AddObjectToList(EndWindow window, OOP_Lab_1.MenuItem itm, string image, Int32 element) { StackPanel stackPanel = new StackPanel { Width = 600, Height = 99 }; stackPanel.Orientation = Orientation.Horizontal; try { stackPanel.Children.Add(new Image { Source = new BitmapImage(new Uri(image)), Width = 130, Stretch = System.Windows.Media.Stretch.Fill, Height = 90 }); } catch { MessageBox.Show("Loading image error"); } Label label = new Label { Width = 600, Height = 99 }; label.Content = element.ToString() + ". " + itm.WriteDescription(); stackPanel.Children.Add(label); window.listBox.Items.Add(stackPanel); }
public static void CreateOrderList(EndWindow endWindow, List <OOP_Lab_1.MenuItem> orderList, List <string> imageList) { for (Int32 i = 0; i < orderList.Count; i++) { AddObjectToList(endWindow, orderList[i], imageList[i], i + 1); } }
private void btOrder_Click(object sender, RoutedEventArgs e) { EndWindow endWindow = new EndWindow(orderList, imageList, factoryList); PlayWithLists.CreateOrderList(endWindow, orderList, imageList); Close(); endWindow.Show(); }
public static void CreateOrderList(EndWindow endWindow, List <OOP_Lab_1.MenuItem> orderList, List <string> imageList) { endWindow.listBox.Items.Clear(); for (Int32 i = 0; i < orderList.Count; i++) { AddObjectToList(endWindow, orderList[i], imageList[i], i + 1); } endWindow.lCost1.Content = (CountCost(orderList)).ToString(); }
public EditWindow(EndWindow window, List <Factory> factoryList, List <string> imageList, List <OOP_Lab_1.MenuItem> item, Int32 selectedIndex) { InitializeComponent(); orderItem = item; this.selectedIndex = selectedIndex; this.factoryList = factoryList; this.imageList = imageList; this.window = window; }
private void btOrder_Click(object sender, RoutedEventArgs e) { answers[0] = AboutMenu1.SelectedIndex; answers[1] = Choose1.IsChecked; answers[2] = AboutMenu2.SelectedIndex == 0 ? true : false; EndWindow endWindow = new EndWindow(); MenuItem item; foreach (Factory factory in factoryList) { if (factory.Name.IsEqual(MenuItem.Text)) { item = factory.Create(answers); endWindow.tOrder.Text = (item.WriteDescription()); endWindow.tCost.Text = item.Cost.ToString() + " money."; } } endWindow.Show(); }