Esempio n. 1
0
        /// <summary>
        /// Loads the UIConfiguration from its default path.
        /// </summary>
        /// <returns></returns>
        public static UIConfiguration Load()
        {
            string configFile = Path.Combine(Utilities.GetLocalAppDataFolderPath(), "IlsAnsbachOperationViewerConfig.xml");
            if (!File.Exists(configFile))
            {
                return new UIConfiguration();
            }

            UIConfiguration configuration = new UIConfiguration();

            XDocument doc = XDocument.Load(configFile);

            XElement vehicleE = doc.Root.Element("Vehicles");
            configuration.VehicleMustContainAbbreviations = vehicleE.Attribute("MustContainAbbreviations").Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            foreach (XElement resE in vehicleE.Elements("Vehicle"))
            {
                Vehicle vehicle = new Vehicle();
                vehicle.Identifier = resE.Attribute("Identifier").Value;
                vehicle.Name = resE.Attribute("Name").Value;

                FileInfo imageFile = new FileInfo(Path.Combine(Utilities.GetWorkingDirectory(Assembly.GetExecutingAssembly()), resE.Attribute("Image").Value));
                vehicle.Image = imageFile.FullName;

                configuration.Vehicles.Add(vehicle);
            }

            return configuration;
        }
Esempio n. 2
0
        /// <summary>
        /// Loads the UIConfiguration from its default path.
        /// </summary>
        /// <returns></returns>
        public static UIConfiguration Load()
        {
            string configFile = Path.Combine(Utilities.GetWorkingDirectory(Assembly.GetExecutingAssembly()), "Config\\IlsAnsbachOperationViewerConfig.xml");

            if (configFile == null)
            {
                return(null);
            }

            UIConfiguration configuration = new UIConfiguration();

            XDocument doc = XDocument.Load(configFile);

            XElement vehicleE = doc.Root.Element("Vehicles");

            configuration.VehicleMustContainAbbreviations = vehicleE.Attribute("MustContainAbbreviations").Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            foreach (XElement resE in vehicleE.Elements("Vehicle"))
            {
                Vehicle vehicle = new Vehicle();
                vehicle.Identifier = resE.Attribute("Identifier").Value;
                vehicle.Name       = resE.Attribute("Name").Value;

                FileInfo imageFile = new FileInfo(Path.Combine(Utilities.GetWorkingDirectory(Assembly.GetExecutingAssembly()), resE.Attribute("Image").Value));
                vehicle.Image = imageFile.FullName;

                configuration.Vehicles.Add(vehicle);
            }

            return(configuration);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IlsAnsbachViewModel"/> class.
 /// </summary>
 public IlsAnsbachViewModel()
 {
     _configuration = UIConfiguration.Load();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IlsAnsbachViewModel"/> class.
 /// </summary>
 public IlsAnsbachViewModel()
 {
     _configuration = UIConfiguration.Load();
 }