private async void btnSave_Click(object sender, RoutedEventArgs e) { processBar.Visibility = Visibility.Visible; DataHelper dbHelper = new DataHelper(); DataBusLine name = new DataBusLine(data.Name, data.Data); dbHelper.InsertNewBusLine(name); //System.Diagnostics.Debug.WriteLine("Them tuyen"); DataBusLine newLine = await dbHelper.GetNewLine(); //System.Diagnostics.Debug.WriteLine("Lay gia tri vua them"); int i = 0; if (newLine != null) { foreach (var item in data.ListPoints) { i++; DataPoint dataPoint = new DataPoint(item.Name, newLine.Id, item.Long, item.Lat); dbHelper.InsertNewPoint(dataPoint); //System.Diagnostics.Debug.WriteLine("Them diem"); } processBar.Visibility = Visibility.Collapsed; var dialog = new MessageDialog("Lưu dữ liệu thành công! total: " + i); await dialog.ShowAsync(); System.Diagnostics.Debug.WriteLine(data.Name); System.Diagnostics.Debug.WriteLine(data.Data); } Frame.Navigate(typeof (MainPage)); }
public async void InsertNewPoint(DataPoint newS) { await ConnectDb(); await _conn.InsertAsync(newS); }