Esempio 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);
        }