private void OpenCamouflageFile(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog { Filter = "camouflages | *.xml" }; if (ofd.ShowDialog() == true) { ClearAll(); tabControlMenu.SelectedIndex = 0; loader = new Loader(); if (loader.Load(ofd.FileName)) { ships = new Ships(loader.ShipGroup); camos = new Camouflages(loader.Camouflage, loader.ShipGroup); schemes = new Schemes(loader.ColorScheme); CbShip.ItemsSource = ships.Names; miSave.IsEnabled = true; EnableTabGrids(true); } else { MessageBox.Show("Invalid xml file.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); miSave.IsEnabled = false; } } }
public Camouflages(XmlNodeList camos, XmlNodeList groups) { ships = new Ships(groups); hashedCamouflages = new Dictionary <int, Camouflage>(); foreach (XmlNode camo in camos) { var x = new Camouflage(camo); var h = x.GetHashCode(); hashedCamouflages.Add(h, x); } }