private void ButtonShow_OnClick(object sender, RoutedEventArgs e) { string machine = ""; string production = ""; try { machine = ComboBoxMachine.SelectionBoxItem.ToString(); production = ComboBoxProduction.SelectionBoxItem.ToString(); } catch (Exception) { } if (machine == "Machine 1") { Lib.PostionImage selectedImage = Images1.FirstOrDefault(x => x.MachineName == machine && x.ProductionName == production); if (selectedImage != null) { ImageViewer.Source = new BitmapImage(new Uri(selectedImage.IamgePath)); } } else if (machine == "Machine 2") { Lib.PostionImage selectedImage = Images2.FirstOrDefault(x => x.MachineName == machine && x.ProductionName == production); if (selectedImage != null) { ImageViewer.Source = new BitmapImage(new Uri(selectedImage.IamgePath)); } } }
public static List <PostionImage> GetImagesForMachine2() { List <PostionImage> resultList = new List <PostionImage>(); PostionImage image1 = new PostionImage("Machine 2", "MabThera 100 mg/10 ml", Path.Combine(Application.StartupPath, "Images/Machine2MabThera100.jpg")); PostionImage image2 = new PostionImage("Machine 2", "Xeloda 500 mg", Path.Combine(Application.StartupPath, "Images/Machine2Xeloda500.jpg")); PostionImage image3 = new PostionImage("Machine 2", "MabThera 500 mg/50 ml", Path.Combine(Application.StartupPath, "Images/Machine2MabThera500.jpg")); resultList.Add(image1); resultList.Add(image2); resultList.Add(image3); return(resultList); }