Exemplo n.º 1
0
        private async void OnItemContentTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            PublisherBankViewModel publisher = ((FrameworkElement)sender).DataContext as PublisherBankViewModel;

            _lastPublisherId = publisher.Id;
            if (publisher != null)
            {
                var message = string.Format("đang {0} {1}...", publisher.Subscribed ? "gỡ" : "cài", publisher.Name);
                this.SetProgressIndicator(true, message);
                this.llmsPublisher.IsEnabled = false;

                AppResult <bool> result = publisher.Subscribed ? await _feedManager.UnsubscribePublisher(publisher.Id) : await _feedManager.SubscribePublisher(publisher.Id);

                if (result.HasError)
                {
                    Messenger.ShowToast(result.ErrorMessage());
                }
                else
                {
                    Binding();
                    var doneMessage = string.Format("{0} {1} xong...", publisher.Subscribed ? "cài" : "gỡ", publisher.Name);
                    Messenger.ShowToast(doneMessage);
                }

                this.llmsPublisher.IsEnabled = true;
                this.SetProgressIndicator(false);
            }
        }