示例#1
0
        public CardsViewModel()
        {
            Title            = "Browse";
            Cards            = new ObservableCollection <Card>();
            LoadCardsCommand = new Command(async() => await ExecuteLoadCardsCommand());

            MessagingCenter.Subscribe <NewCardPage, Card>(this, "AddCard", async(obj, card) =>
            {
                var newCard = card as Card;
                Cards.Add(newCard);
                await DataStore.AddCardAsync(newCard);
            });
        }
        public ItemsViewModel()
        {
            Title   = "Decks";
            IsLarge = (App.ScreenHeight > 1000);
            Width   = App.ScreenWidth;

            _planets   = new List <Card>();
            _anomalies = new List <Card>();
            _stars     = new List <Card>();

            Cards            = new ObservableCollection <Card>();
            LoadCardsCommand = new Command(async() => await ExecuteLoadCardsCommand());

            MessagingCenter.Subscribe <NewItemPage, Card>(this, "AddCard", async(obj, card) =>
            {
                var _card = card as Card;
                Cards.Add(_card);
                await DataStore.AddCardAsync(_card);
            });
        }