Пример #1
0
 private async void initAsync(int id)
 {
     Waiter.Visibility = Visibility.Visible;
     RestResult<Event> ret = await RestApiManager.GetEvent(id);
     if (ret.IsSuccess)
     {
         var evt = ret.Data as Event;
         vm.Id = evt.Id;
         vm.Name = evt.Name;
         vm.Description = evt.Description;
         vm.PictureNb = evt.PictureNb;
         vm.StartDate = evt.StartDate;
         vm.EndDate = evt.EndDate;
         vm.Pictures.Clear();
         for (var i = 0; i < vm.PictureNb; i++)
         {
             var number = i + 1;
             RestResult<Picture> retPic = await RestApiManager.GetPicture(id, number);
             Picture pic = null;
             if (retPic.IsSuccess)
             {
                 pic = retPic.Data;
                 pic.Number = number;
             }
             else {
                 pic = new Picture()
                 {
                     Id = number,
                     Eventt = evt,
                     Number = number,
                     FileName = "ERREUR " + number
                 };
             }
             vm.Pictures.Add(pic);
         }
         this.Page_Loaded(null, null);
         Waiter.Visibility = Visibility.Collapsed;
     }
     else
     {
         await new Windows.UI.Popups.MessageDialog(ret.ErrorMessage, ret.ErrorTitle).ShowAsync();
         Frame.GoBack();
     }
 }
Пример #2
0
 public static async Task<Boolean> LoadEventPictures(Event evt)
 {
     evt.Pictures.Clear();
     for (var i = 1; i <= evt.PictureNb; i++)
     {
         RestResult<Picture> retPic = await RestApiManager.GetPicture(evt.Id, i);
         Picture pic = null;
         if (retPic.IsSuccess)
         {
             pic = retPic.Data;
             pic.Number = i;
         }
         else {
             pic = new Picture()
             {
                 Id = i,
                 Eventt = evt,
                 Number = i,
                 FileName = "ERREUR " + i
             };
         }
         evt.Pictures.Add(pic);
     }
     return true;
 }