Esempio n. 1
0
        public static async Task DownloadExerciseListAsync()
        {
            HttpClient client = new HttpClient();
            string url = "https://dl.dropboxusercontent.com/u/13921141/WorkoutPlanner/api.json";
            HttpResponseMessage response = await client.GetAsync(url);
            string content = await response.Content.ReadAsStringAsync();
            
            JArray x = JArray.Parse(content);
            foreach (JObject jo in x)
            {
                string title = (string) jo.GetValue("title");
                int dur = (int) jo.GetValue("duration");
                string type = (string) jo.GetValue("type");
                string murl = (string) jo.GetValue("url");
                ExerciseType et = new ExerciseType(title, type, dur);
                lastExercise = et;
                et._url = murl;
            }

            //Now load data
            await SaveHandler.LoadUserImagesLocalDataAsync();

            SplashScreen.DataLoaded = true;

        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string selectedIndex = "";
            if (NavigationContext.QueryString.TryGetValue("exerciseToShow", out selectedIndex))
            {
                active = ExerciseType.FromName(selectedIndex);
                Label.Text = active.Name;
                SynchronizationContext ctx = SynchronizationContext.Current;

                TheWebView.Navigating += TheWebView_Navigating;
                TheWebView.Navigated += TheWebView_Navigated;
                //TheWebView.Navigate(new Uri(active.Url));
                DownloadHTMLAsync(ctx, active.Url, TheWebView);
                
            }
            else
            {
                return;
            }
        }
Esempio n. 3
0
 public ExerciseViewModel(ExerciseType type, int amount)
 {
     _type = type;
     _amount = amount;
     _duration = amount * _type.Duration;
 }