예제 #1
0
 protected void EditNotes(WorkshopDetail session)
 {
     var animOut = AnimationUtils.LoadAnimation(this, Resource.Animation.fadeout);
     fab.StartAnimation(animOut);
     animOut.AnimationEnd += async (sender, e) =>
     {
         if (IsEditing)
         {
             var dialog = DialogHelper.CreateProgressDialog("Saving...", this);
             dialog.Show();
             var response = await Services.Workshop.AddNotes(editTxtNotes.Text, session.Id);
             dialog.Hide();
             if (response.Success)
             {
                 IsEditing = !IsEditing;
                 AnimateButton();
                 FlipView();
             }
             else
                 DialogHelper.ShowDialog(this, response.Message, response.Title);
         }
         else
         {
             locked = DateTime.UtcNow.AddDays(-7) > session.DateEnd;
             editTxtNotes.Enabled = !locked;
             if (locked && editTxtNotes.Text == "")
                 editTxtNotes.Text = "No notes";
             IsEditing = !IsEditing;
             AnimateButton();
             FlipView();
         }
     };
 }
예제 #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var extras = Intent.Extras;
            if (extras != null)
            {
                //Get vars from bundle
                var workshopId = extras.GetInt("Id");

                cts.Cancel();
                //Get the Booking Details
                if (extras.GetBoolean("IsBooking"))
                    session = await Services.Workshop.GetWorkshopFromBooking(workshopId);
                else
                {
                    session = Services.Workshop.GetWorkshop(workshopId);
                    HideEdit = true;
                }

                ListBaseAdapter.InitColors(Resources);
                SetToolbarColor(ListBaseAdapter.GetColor(session.WorkshopSetId));
                InitWorkshopComponents();
                UpdateFields();

                cts.Cancel();
                //Load booking information so the buttons can be updated
                //Get Local Data First, then update later
                await Task.Factory.StartNew(() => LoadBooking(true));

                if(!extras.GetBoolean("IsBooking"))
                    isWaitlisted = await Services.Workshop.IsWaitlisted(session.Id);

                //Do a background Sync now
                await Task.Factory.StartNew(() => LoadBooking(false, false));
            }
        }