Exemplo n.º 1
0
        public async override void Activate(object parameter)
        {
            _keep = true;
            PinSecTileVisibility   = Visibility.Collapsed;
            UnpinSecTileVisibility = Visibility.Collapsed;
            var course = parameter as Cour;

            if (course != null)
            {
                SelectedCourse = course;
            }
            else
            {
                SelectedCourse       = CatalogueService.GetCourseByCourseId(long.Parse((parameter.ToString()).Substring(1)));
                BackButtonVisibility = Visibility.Collapsed;
            }

            try
            {
                IsLoadingProgressRing = true;
                CoursesScheduleList   = new ObservableCollection <CourDate>(await CatalogueService.GetCourseScheduleByCourseId(SelectedCourse.C_id));
                IsLoadingProgressRing = false;
                if (CoursesScheduleList.Count == 0)
                {
                    var dialog = new MessageDialog("Desolé, aucune date disponible pour cette formation.");    //eng: This course has no available dates.
                    if (_keep)
                    {
                        Window.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => dialog.ShowAsync());
                    }
                }
            }
            catch (Exception ex)
            {
                var dialog = new MessageDialog("L'application  n'a pas réussi à récupérer les dates pour cette formation, vérifier votre connexion Internet s'il vous plaît.");  //eng: The app can't retrieve  the dates, please check your internet connection.
                if (_keep)
                {
                    Window.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => dialog.ShowAsync());
                }
                IsLoadingProgressRing = false;
            }
            PinSecTileVisibility   = SecondaryTile.Exists("S" + SelectedCourse.C_id.ToString()) ? Visibility.Collapsed : Visibility.Visible;
            UnpinSecTileVisibility = SecondaryTile.Exists("S" + SelectedCourse.C_id.ToString()) ? Visibility.Visible : Visibility.Collapsed;
            base.Activate(parameter);
        }
 public override void Activate(object parameter)
 {
     RoamingFavorite = (bool)(ApplicationData.Current.RoamingSettings.Values["RoamingFavorite"]);
     CourseDetails   = (parameter as Cour);
     if (CourseDetails != null)
     {
         IsCourseFavorite = CatalogueService.IsCourseFavorite(CourseDetails.C_id, RoamingFavorite);
     }
     else
     {
         CourseDetails        = CatalogueService.GetCourseByCourseId(long.Parse(parameter.ToString()));
         IsCourseFavorite     = CatalogueService.IsCourseFavorite(CourseDetails.C_id, RoamingFavorite);
         BackButtonVisibility = Visibility.Collapsed;
     }
     RegisterForShare();
     SendLiveTileUpdate();
     Network.InternetConnectionChanged += async(s, e) => Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         IsDatesVisible = (e.IsConnected ? Visibility.Visible : Visibility.Collapsed);
     });
     PinSecTileVisibility   = SecondaryTile.Exists(CourseDetails.C_id.ToString()) ? Visibility.Collapsed : Visibility.Visible;
     UnpinSecTileVisibility = SecondaryTile.Exists(CourseDetails.C_id.ToString()) ? Visibility.Visible : Visibility.Collapsed;
     base.Activate(parameter);
 }