Пример #1
0
 private async Task getScreenFromServer()
 {
     try {
         screens = await LessonUtil.GetScreensByLessonAsync(lesson_id);
     } catch (Exception ex) {
         DialogFactory.ToastDialog(this, "Data Error", "Error Connecting to Server,please try again later!", Constants.TEXT_ERROR);
     }
     if (screens != null)
     {
         //make text and images
         screen = screens [0];
         string type = screen.Type;
         if (type.Contains("text"))
         {
             var texts = screen.Texts;
             Utils.makeTextViews(texts, this, ll_content, Color.Black);
         }
         if (type.Contains("image"))
         {
             var imageslist = screen.Images;
             var images     = new List <Image> (imageslist);
             Utils.makeTextImages(this, ll_content, images);
         }
         //make return button
         Utils.makeReturnButton(this, ll_content);
         ll_content.Visibility = ViewStates.Visible;
         ll_load.Visibility    = ViewStates.Invisible;
     }
 }
Пример #2
0
        public async override void RowSelected(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            // Loading indicator
            var loadingOverlay = new LoadingOverlay(Container.View.Bounds);

            Container.View.Add(loadingOverlay);

            IList <Screen> screens = null;

            try
            {
                screens = (await LessonUtil.GetScreensByLessonAsync(Items[indexPath.Row].Id));
            }
            catch (Exception e)
            {
                var alert = UIAlertController.Create("Something goes wrong", String.Format("Please check your Internet connection and try again.{0} Details: {1}", Environment.NewLine, e.Message), UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                Container.PresentViewController(alert, true, null);
            }
            loadingOverlay.HideThenRemove();

            if ((screens != null) && (screens.Count > 0))
            {
                Container.NavigationController.PushViewController(new LessonScreenViewController(Items[indexPath.Row].Id, screens, 0, new List <ScreenAnswer>()), true);
            }
            else
            {
                var alert = UIAlertController.Create("Oops!", "There is nothing in this lesson.", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                Container.PresentViewController(alert, true, null);
            }

            tableView.DeselectRow(indexPath, true);
        }
Пример #3
0
        private async void getVideoUrlFromServer()
        {
            var result = await LessonUtil.GetScreensByLessonAsync(lessonId);

            if (result != null && result.Count > 0)
            {
                Constants.screens = result;
                //jump to screenactivity
                Intent intent = new Intent(this, typeof(ScreensActivity));
                intent.PutExtra(Constants.LESSON_TITLE, currentLesson.Title);
                intent.PutExtra(Constants.LESSON_DES, currentLesson.Description);
                intent.PutExtra(Constants.LESSON_ID, currentLesson.Id);
                StartActivity(intent);
                Finish();
            }
            else
            {
                lv_list.Visibility = ViewStates.Visible;
                ll_load.Visibility = ViewStates.Invisible;
                DialogFactory.ToastDialog(this, "Empty lesson", "Oops,this lesson has not uploaded yet!", 0);
            }
        }