private void loadInformation(object sender, RoutedEventArgs e, bool savecontent)
        {
            //SystemTray.ProgressIndicator.Text = "Fetching information";
            if (savecontent == true)
            {
                LoadStorage storedjson = new LoadStorage();
                storedjson.loadFile("Information");
                var deserialized = JsonConvert.DeserializeObject<InformationList>(storedjson.loadFile("Information"));
                lstInformation.ItemsSource = deserialized.information;
            }
            else
            {
                var w = new WebClient();
                w.DownloadStringAsync(new Uri(apiurl + "iwcollege/fetchCollegeInformation/"));
                Observable
                  .FromEvent<DownloadStringCompletedEventArgs>(w, "DownloadStringCompleted")
                  .Subscribe(r =>
                  {
                      try
                      {
                          saveTo.Save("Information", r.EventArgs.Result);
                          var deserialized = JsonConvert.DeserializeObject<InformationList>(r.EventArgs.Result);
                          lstInformation.ItemsSource = deserialized.information;
                      }
                      catch (WebException webex)
                      {

                          MessageBox.Show("Couldn't load Information, so we'll give you a cached copy.");
                          loadInformation(null, null, true);
                      }
                  });
            }

            prog.IsIndeterminate = false;
            prog.IsVisible = false;
            SystemTray.SetIsVisible(this, false);
        }
        /*private void updateTile()
        {
            //create the tile

            ShellTile apptile = ShellTile.ActiveTiles.First();
           if (apptile != null)
           {
            StandardTileData tiledata = new StandardTileData
            {
                //set the title
                BackTitle = "IWCollege",
                //set the content
                BackContent = lstCourseList.c
                //set the count to 0
                Count = 0,
                //set main title
                Title = "IWCollege",
                //set the bg image.
                BackBackgroundImage = new Uri("/Images/backtile.png", UriKind.RelativeOrAbsolute)
            };
            //add the tile
            apptile.Update(tiledata);
           }
        }*/
        private void loadCourses(object sender, RoutedEventArgs e, bool savecontent)
        {
            //SystemTray.ProgressIndicator.Text = "Fetching courses";
            if (savecontent == true)
            {
                //load localcontent
                LoadStorage storedjson = new LoadStorage();
                storedjson.loadFile("Subjects");
                var deserialized = JsonConvert.DeserializeObject<SubjectsList>(storedjson.loadFile("Subjects"));
                lstCourseList.ItemsSource = deserialized.subjects;
            }
            else
            {
                    var w = new WebClient();
                    w.DownloadStringAsync(new Uri(apiurl + "iwcollege/fetchCourseAreas/"));

                    Observable
                      .FromEvent<DownloadStringCompletedEventArgs>(w, "DownloadStringCompleted")
                      .Subscribe(r =>
                      {
                          try
                          {
                              saveTo.Save("Subjects", r.EventArgs.Result);
                              var deserialized = JsonConvert.DeserializeObject<SubjectsList>(r.EventArgs.Result);
                              lstCourseList.ItemsSource = deserialized.subjects;
                              //updateTile();
                          }
                          catch (WebException webex)
                          {
                              MessageBox.Show("Couldn't load Subjects, so we'll give you a cached copy.");
                              loadCourses(null, null, true);
                          }
                      });
            }
        }