private async void KartaDoBazy(StorageFile file) { KartaPostaci kp = new KartaPostaci(); using (var stream = await file.OpenStreamForReadAsync()) { string streamContents; using (var sr = new StreamReader(stream)) { streamContents = sr.ReadToEnd(); } var document = XDocument.Parse(streamContents); using (XmlReader reader = XmlReader.Create(new StringReader(document.ToString()))) { reader.ReadToFollowing("Karta"); reader.MoveToFirstAttribute(); List <object> lista = new List <object>(); String[] kolumny = mSQH.getKolumny(); for (int i = 0; i < (kolumny.Length); i++) { reader.ReadToFollowing(kolumny[i]); lista.Add(reader.ReadElementContentAsString()); // Debug.WriteLine(i+":"+kolumny[i]+"\t"+ lista.Last().ToString()); } //reader.ReadToFollowing("imie"); //kp.setImie(reader.ReadElementContentAsString()); kp.setByList(lista); mSQH.addNewKP(kp); } //Show(document.ToString()); } }
private void Dodaj_Click(object sender, RoutedEventArgs e) { MySQLiteHelper mSQL = new MySQLiteHelper(); mSQL.makeDB(); mSQL.addNewKP(KPMain); Show("dodano"); Window.Current.Close(); }