예제 #1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Promotions.Clear();
                var promotions = new List <Promotion>()
                {
                    new Promotion()
                    {
                        Id = 1, Name = "Promoção de Verão", Title = "Promoção de Verão", ShortDescription = "Musculação mensal, qualquer dia e horário por apenas R$ 69,90…", Description = "Musculação mensal, qualquer dia e horário por apenas R$ 69,90.", UrlImage = "summerpromotion"
                    },
                    new Promotion()
                    {
                        Id = 2, Name = "Suplementação", Title = "Promoção de Suplementos", ShortDescription = "Marcas nacionais e internacionais pelo melhor preço...", Description = "Marcas nacionais e internacionais pelo melhor preço", UrlImage = "suplementpromotion"
                    },
                };
                foreach (var item in promotions)
                {
                    Promotions.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
        public async void GetPromotions(Guid companyId)
        {
            if (Promotions == null)
            {
                Promotions = new ObservableCollection <SharedPromotion>();
            }
            Promotions.Clear();
            HttpClient client = new HttpClient();
            string     res    = await client.GetStringAsync(new Uri("http://localhost:51070/api/Promotion?companyID=" + companyId));

            var list = JsonConvert.DeserializeObject <List <SharedPromotion> >(res);

            foreach (var item in list)
            {
                // Navigate to promotionpage
                // item.Command = new DelegateCommand<Guid>(GoToPromotionDetail);
                Promotions.Add(item);
            }
            if (list.Count > 0)
            {
                Visible = Visibility.Visible;
            }
            RaisePropertyChanged("Promotions");
        }
예제 #3
0
 internal void ClearPromotions()
 {
     Promotions.Clear();
 }
예제 #4
0
 private void DeletePromotions()
 {
     Promotions.Clear();
     Company.Promotions.Clear();
 }