Example #1
0
        /// <summary>
        /// Happens when redirected to this page
        /// </summary>
        /// <param name="parameters"></param>
        public override void OnNavigatedTo(INavigationParameters parameters)
        {
            IsBusy = true;
            // Get passed parameters
            if (parameters.TryGetValue(Universe.SaleItemParameter, out SaleItem saleItem))
            {
                try
                {
                    _saleItem     = saleItem;
                    AuctionEnding = _saleItem.TimeAdded.AddDays(3);

                    //Null check
                    if (!string.IsNullOrEmpty(_saleItem.AuctionWinner))
                    {
                        CheckAnyAuctionWinner = true;
                        RaisePropertyChanged(nameof(CheckAnyAuctionWinner));
                    }

                    SaleItem = _saleItemViewModelFactory.CreateSaleItemViewModel(_saleItem);
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
            }

            RaisePropertyChanged(nameof(AuctionEnding));
            RaisePropertyChanged(nameof(SaleItem));
            IsBusy = false;
        }
        private async void UpdateView()
        {
            var saleItems = await _saleItemsManager.GetOwnSaleItems();

            OwnSaleItemList = saleItems.Select(saleItem => _saleItemViewModelFactory.CreateSaleItemViewModel(saleItem)).ToList().OrderByDescending(saleItem => saleItem.TimeAdded);
            await Application.Current.MainPage.DisplayAlert("Sold!", "You have sold and item successfully!", "OK");

            RaisePropertyChanged(nameof(OwnSaleItemList));
        }