Пример #1
0
        public static CEtaElementsDatabase XMLLoad()
        {
            XDocument _xml_document          = XDocument.Load("db.xml");
            XElement  _xml_elements_database = _xml_document.Element("EtaElementsDatabase");

            if (_xml_elements_database == null)
            {
                throw new ArgumentException("No EtaElementsDatabase element");
            }

            XAttribute _attribute_version = _xml_elements_database.Attribute("Version");

            if (_attribute_version == null)
            {
                throw new ArgumentException("No Version attribute");
            }
            uint _version = uint.Parse(_attribute_version.Value);

            if (_version > __CURRENT_VERSION)
            {
                throw new ArgumentException("EtaElementsDatabase version is higher than supported by current version of Software. Please Update software");
            }
            if (_version < __CURRENT_VERSION)
            {
                ConvertVersion(_xml_elements_database, _version);
            }

            CEtaElementsDatabase _elements_database = new CEtaElementsDatabase();

            _elements_database.XMLParse(_xml_elements_database);
            return(_elements_database);
        }
Пример #2
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     CElementItem.CPackage.XMLLoad();
     _elements_database        = CEtaElementsDatabase.XMLLoad();
     TV_Containers.DataContext = new object[] { _elements_database };
     _timer = new DispatcherTimer(new TimeSpan(0, 0, 5), DispatcherPriority.ApplicationIdle, (sender2, args) => { if (_elements_database != null)
                                                                                                                  {
                                                                                                                      CElementItem.CPackage.XMLSaveTemp(); _elements_database.XMLSaveTemp();
                                                                                                                  }
                                  }, Dispatcher.CurrentDispatcher);
 }
Пример #3
0
 public WindowPackages(CEtaElementsDatabase elements_database)
 {
     _elements_database = elements_database;
     InitializeComponent();
 }