private void Stop_Button_Click(object sender, RoutedEventArgs e)
        {
            myTimer.Stop();


            if (txtSpeed.Text == "Wait")
            {
                speed = 0;
            }
            distance = (double)((int)(distance * 100)) / 100;
            speed    = (double)((int)(speed * 100)) / 100;

            Seance s = new Seance(DateTime.Now, speed, calories, distance, currentTimeMin);

            //All Seances
            if (IsolatedStorageHelper.GetObject <List <Seance> >("allSeances") == null)
            {
                listSeance.Seances.Add(s);
                IsolatedStorageHelper.SaveObject <List <Seance> >("allSeances", listSeance.Seances);
            }
            else
            {
                listSeance.Seances = IsolatedStorageHelper.GetObject <List <Seance> >("allSeances");
                listSeance.Seances.Add(s);
                IsolatedStorageHelper.SaveObject <List <Seance> >("allSeances", listSeance.Seances);
            }
            ///////////////////////////////////////////////////////////////////////////////////////////

            start = false;
            btnShare.Visibility = Visibility.Visible;
            btnStop.Visibility  = Visibility.Collapsed;

            //Frame.Navigate(typeof(MainPage));
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            lastSeance         = new MainViewModel();
            lastSeance.Seances = IsolatedStorageHelper.GetObject <List <Seance> >("allSeances");

            if (lastSeance.Seances == null || lastSeance.Seances.Count == 0)
            {
                txtVitesse.Text  = "No Data";
                txtDuree.Text    = "No Data";
                txtDistance.Text = "No Data";
                txtCalories.Text = "No Data";
                txtDate.Text     = "No Data";
            }
            else
            {
                Seance lastOne = lastSeance.Seances.Last();
                txtCalories.Text = lastOne.Calories + " Kcal";
                txtDistance.Text = lastOne.Distance + " Km";
                txtDuree.Text    = lastOne.Duree + " min";
                txtVitesse.Text  = lastOne.Vitesse + " Km/h";
                txtDate.Text     = lastOne.DateSeance.ToString();
            }
            double bestStep = IsolatedStorageHelper.GetObject <double>("bestSteps");

            txtBestStep.Text = bestStep + "";

            double bestPush = IsolatedStorageHelper.GetObject <double>("bestPush");

            txtBestPush.Text = bestPush + "";
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
       Seance s = new Seance();
     s = (Seance)e.Parameter;
     txtDate.Text = s.DateSeance+"";
     txtCalories.Text = s.Calories+"";
     txtDistance.Text = s.Distance+"";
     txtDuree.Text = s.Duree+"";
     txtVitesse.Text = s.Vitesse+"";
     DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
 }
Пример #4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Seance s = new Seance();

            s                = (Seance)e.Parameter;
            txtDate.Text     = s.DateSeance + "";
            txtCalories.Text = s.Calories + "";
            txtDistance.Text = s.Distance + "";
            txtDuree.Text    = s.Duree + "";
            txtVitesse.Text  = s.Vitesse + "";
            DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
        }
        private void Stop_Button_Click(object sender, RoutedEventArgs e)
        {
            myTimer.Stop();


            if (txtSpeed.Text == "Wait") 
            {
                speed = 0;
            }
            distance = (double)((int)(distance * 100)) / 100;
            speed = (double)((int)(speed * 100)) / 100;

            Seance s = new Seance(DateTime.Now, speed, calories, distance, currentTimeMin);

            //All Seances
            if (IsolatedStorageHelper.GetObject<List<Seance>>("allSeances") == null)
            {
                listSeance.Seances.Add(s);
                IsolatedStorageHelper.SaveObject<List<Seance>>("allSeances",listSeance.Seances);
            }
            else
            {
                listSeance.Seances = IsolatedStorageHelper.GetObject<List<Seance>>("allSeances");
                listSeance.Seances.Add(s);
                IsolatedStorageHelper.SaveObject<List<Seance>>("allSeances", listSeance.Seances);
            }
            ///////////////////////////////////////////////////////////////////////////////////////////
            
            start = false;
            btnShare.Visibility = Visibility.Visible;
            btnStop.Visibility = Visibility.Collapsed;
            
            //Frame.Navigate(typeof(MainPage));
        }