Example #1
0
        public ShopListViewModel(IDialogNotifier dialog, int shop)
        {
            Items         = new ObservableCollection <Goods>();
            Dialog        = dialog;
            ShopID        = shop;
            SelectedItems = new List <Goods>();
            LoadItems     = new Command(async() =>
            {
                var items = await Server.GetShopGoods(ShopID);
                if (items.Error == null)
                {
                    foreach (var item in items.Data)
                    {
                        Items.Add(item);
                    }
                }
            });

            AddItems = new Command(async() =>
            {
                SelectedItems.AddRange(Items.Where(x => x.ColBusket > 0));
                Dialog.Cancel();
                MessagingCenter.Send <Object, List <Goods> >(this, "AddItems", SelectedItems);
            });

            Increase = new Command <Goods>(item => item.ColBusket++);
            Decrease = new Command <Goods>(item => item.ColBusket--);
        }
        async void ExitDialog(IDialogNotifier notifier, bool isCancel = false)
        {
            await Task.Delay(1000);

            Device.BeginInvokeOnMainThread(() => {
                if (isCancel)
                {
                    notifier.Cancel();
                }
                else
                {
                    notifier.Complete();
                }
            });
        }
Example #3
0
 public ChatController(IDialogNotifier dialogNotifier,
                       IChatService chatService)
 {
     _dialogNotifier = dialogNotifier;
     _chatService    = chatService;
 }
Example #4
0
 public DialogView()
 {
     DialogNotifier = new DialogNotifier();
 }