Esempio n. 1
0
        public RentEnd(RentModel rentInfo)
        {
            this.Title = "Оформление доплаты";

            _limit = new Label {
                Text = $"{rentInfo.RentPrice.Time}"
            };
            _time = new Label {
                Text = $"Перекатано {rentInfo.Overtime}"
            };
            Extra = new Entry {
                Placeholder = "Сумма"
            };
            _submit = new Button {
                Text = "OK"
            };
            _submit.Clicked += _submit_Clicked;

            Content = new StackLayout
            {
                Children =
                {
                    _limit,
                    _time,
                    Extra,
                    _submit
                }
            };
        }
Esempio n. 2
0
 /// <summary>
 /// Add new rent
 /// </summary>
 /// <param name="rentItem"></param>
 private void AddNewRent(RentModel rentItem)
 {
     rentItem.Navigate = Navigate;
     rentItem.Confirm  = ConfirmActionResult;
     rentItem.Test     = InputBox;
     _rentList.Add(new RentViewModel(rentItem, DeleteRent));
     MoveLastRent();
 }
Esempio n. 3
0
 public RentViewModel(RentModel rent, RentManipulate delete)
 {
     _rent  = rent;
     Delete = delete;
     ///Press Button play-stop
     this.ChangeMode = new Command(async(nothing) =>
     {
         try
         {
             if (_rent.StoredId == 0)
             {
                 rent.StoredId = await StoreRent();
             }
             _rent.ChangeMode(OnPropertyChanged);
         }
         catch (Exception ex)
         {
             App.Database.SaveError(new Error {
                 Date = DateTime.Now, Invoker = $"{this.GetType().Name}->ChangeMode", Message = ex.Message
             });
         }
     });
     ///Delete rent from view
     this.Remove = new Command(async(nothing) =>
     {
         try
         {
             if (await _rent.CanRemoveAsync())
             {
                 Delete(this);
             }
         }
         catch (Exception ex)
         {
             App.Database.SaveError(new Error {
                 Date = DateTime.Now, Invoker = $"{this.GetType().Name}->Remove", Message = ex.ToString()
             });
         }
     });
     this.Call = new Command(() =>
     {
         if (_rent.Client.Phone == "")
         {
             App.Toast("Номер отсутствует!");
             return;
         }
         //var ans = await _rent.Confirm($"Вызвать {item.ClientName}?");
         //if (ans == true)
         //{
         Device.OpenUri(new Uri($"tel:{_rent.Client.Phone}"));
         //}
         //else
         //{
         //    App.Toast("Отмена");
         //}
     });
     ///complete rent and remove
     this.Complete = new Command(async(nothing) =>
     {
         try
         {
             if (await _rent.CanCompleteAsync())
             {
                 Delete(this);
             }
         }
         catch (Exception ex)
         {
             App.Database.SaveError(new Error {
                 Date = DateTime.Now, Invoker = $"{this.GetType().Name}->Complete", Message = ex.Message
             });
         }
     });
 }