public MainWindow() { InitializeComponent(); using (PlatformDataBase dataBase = new PlatformDataBase( ((IDefaultSettings)this).path + ((IDefaultSettings)this).data.links, ((IDefaultSettings)this).path + ((IDefaultSettings)this).data.data)) this.books = dataBase.EachBooks(books = new List <Book>()); insert(ref books); }
private void refresh_Click(object sender, RoutedEventArgs e) { setData( ((IDefaultSettings)this).path + ((IDefaultSettings)this).data.links, ((IDefaultSettings)this).path + ((IDefaultSettings)this).data.data); using (PlatformDataBase dataBase = new PlatformDataBase(( (IDefaultSettings)this).path + ((IDefaultSettings)this).data.links, ((IDefaultSettings)this).path + ((IDefaultSettings)this).data.data)) books = dataBase.EachBooks(books); }
public void SetData(string links, string database) { XmlDocument document = new XmlDocument(); document.Load(getPath()); XmlElement root = document.DocumentElement; foreach (XmlElement book in root) { if ((root != null) && (root.HasChildNodes)) { using (PlatformDataBase dataBase = new PlatformDataBase(links, database)) dataBase.AddBooks( book.Attributes["id"].Value, book.Attributes["author"].Value, book.Attributes["title"].Value, book.Attributes["year"].Value ); } } }