Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var Id = e.Parameter as String;
            dbHelper = new DataHelper();
            ListPoint = await dbHelper.ReadPointsOfBusLine(int.Parse(Id));
            listBox.ItemsSource = ListPoint;

        }
Ejemplo n.º 3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            //db = new DataBusLineHelper();
            //if (await db.CheckFileExists(db.DbName) == false)
            //{
            //    await db.OnCreate(db.DbPath);
            //}


            //data = db.ReadAllBusLines();
            Db = new DataHelper();
            data = await Db.ReadAllBusLines();
            listBox.ItemsSource = data;

        }
Ejemplo n.º 4
0
 protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     DataHelper dbHelper = new DataHelper();
     await dbHelper.OnCreate();
 }