public virtual Task Delete(RetroItem retroItem)
        {
            var t = new TaskCompletionSource <bool> ();

            if (_items.Contains(retroItem))
            {
                _items.Remove(retroItem);
            }
            t.SetResult(true);

            return(t.Task);
        }
Ejemplo n.º 2
0
        public override async System.Threading.Tasks.Task Save(RetroItem retroItem)
        {
            await EnsureInitialized();

            if (String.IsNullOrWhiteSpace(retroItem.Id))
            {
                await RetroItems.InsertAsync(retroItem);
            }
            else
            {
                await RetroItems.UpdateAsync(retroItem);
            }
        }
Ejemplo n.º 3
0
        public RetroItemListPage()
        {
            Title = "Retro Items";

            _listView = new ListView();
            _listView.ItemTemplate  = new DataTemplate(typeof(RetroItemCell));
            _listView.ItemSelected += (sender, e) => {
                var retroItem = (RetroItem)e.SelectedItem;
                var todoPage  = new RetroItemPage();
                todoPage.BindingContext = retroItem;
                Navigation.PushAsync(todoPage);
            };

            var tbi = new ToolbarItem("Add", null, () => {
                var retroItem           = new RetroItem();
                var todoPage            = new RetroItemPage();
                todoPage.BindingContext = retroItem;
                Navigation.PushAsync(todoPage);
            }, 0, 0);

            ToolbarItems.Add(tbi);

            var loginButton = new Button()
            {
                Text = "Login",
            };

            loginButton.Clicked += async(sender, e) => {
                await Navigation.PushModalAsync(new LoginPage());
            };

            loginButton.BindingContext = App.Service;
            loginButton.SetBinding(Button.IsVisibleProperty, "IsLoggedIn", BindingMode.OneWay, new OppositeValueConverter());

            var layout = new StackLayout()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    _listView,
                    loginButton,
                }
            };

            Content = layout;
        }
Ejemplo n.º 4
0
        public override async System.Threading.Tasks.Task Delete(RetroItem retroItem)
        {
            await EnsureInitialized();

            await RetroItems.DeleteAsync(retroItem);
        }