コード例 #1
0
        public async Task <bool> AddProperty(RealtorProperty realtorProperty)
        {
            try
            {
                await firebase
                .Child("Realtor Property")
                .PostAsync(new RealtorProperty()
                {
                    CompanyName = realtorProperty.CompanyName,
                    AccountName = realtorProperty.AccountName,
                    Avatar      = realtorProperty.Avatar,
                    ItemName    = realtorProperty.ItemName,
                    ItemPrice   = realtorProperty.ItemPrice,
                    Description = realtorProperty.Description,
                    Location    = realtorProperty.Location,
                    ItemType    = realtorProperty.ItemType,
                    Negotiable  = realtorProperty.Negotiable,
                    PhoneNumber = realtorProperty.PhoneNumber,
                    Email       = realtorProperty.Email,
                    FirstImage  = realtorProperty.FirstImage,
                    SecondImage = realtorProperty.SecondImage,
                    ThirdImage  = realtorProperty.ThirdImage,
                    FourthImage = realtorProperty.FourthImage
                });

                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error:{e}");
                return(false);
            }
        }
コード例 #2
0
        private async void ExecuteSelectionCommand()
        {
            if (RealtorDataSelection != null)
            {
                var parameters = new NavigationParameters();
                parameters.Add("nav", RealtorDataSelection);
                await NavigationService.NavigateAsync("BuyDetailPage", parameters);

                RealtorDataSelection = null;
            }
        }
コード例 #3
0
        private async void ExecuteShopSelectionCommand()
        {
            if (ShopSelection != null)
            {
                var shopParameter = new NavigationParameters();
                shopParameter.Add("nav", ShopSelection);
                await NavigationService.NavigateAsync("BuyDetailPage", shopParameter);

                ShopSelection = null;
            }
        }
コード例 #4
0
 public override void OnNavigatedTo(INavigationParameters parameters)
 {
     if (parameters.ContainsKey("nav"))
     {
         BuyItems           = parameters.GetValue <RealtorProperty>("nav");
         Seller             = BuyItems.CompanyName;
         Avatar             = BuyItems.Avatar;
         ItemName           = BuyItems.ItemName;
         ImagePicture       = BuyItems.FirstImage;
         ItemPrice          = BuyItems.ItemPrice;
         Description        = BuyItems.Description;
         Location           = BuyItems.Location;
         Negotiable         = BuyItems.Negotiable;
         SellerPhoneNumber  = BuyItems.PhoneNumber;
         SellerEmailAddress = BuyItems.Email;
     }
 }
コード例 #5
0
        async void UploadProperty()
        {
            //checking for connectivity
            var network = Connectivity.NetworkAccess;

            if (network != NetworkAccess.Internet)
            {
                await MaterialDialog.Instance.SnackbarAsync(message : "Error: No internet access", actionButtonText : "OK", msDuration : 3000, configuration : snackBarConfiguration);

                return;
            }

            if (string.IsNullOrEmpty(ItemName) || string.IsNullOrEmpty(Location) || Price == 0M || string.IsNullOrEmpty(Description) || string.IsNullOrEmpty(Type))
            {
                await MaterialDialog.Instance.SnackbarAsync(message : "Error: Fill the required fields", actionButtonText : "OK", msDuration : 3000, configuration : snackBarConfiguration);

                return;
            }

            IsBusy = false;
            var loadingPageConfiguration = new MaterialLoadingDialogConfiguration()
            {
                BackgroundColor  = Color.FromHex("1DA1F2"),
                MessageTextColor = Color.FromHex("FFFFFF"),
                CornerRadius     = 10,
                TintColor        = Color.FromHex("FFFFFF"),
                ScrimColor       = Color.FromHex("1DA1F2").MultiplyAlpha(0.32)
            };

            var loadingDialog = await MaterialDialog.Instance.LoadingDialogAsync(message : "Processing", configuration : loadingPageConfiguration);



            if (image1 == 1)
            {
                firstImageUrl = await remoteService.UploadFile(mediaFile1.GetStream(), Path.GetFileName(mediaFile1.Path));
            }

            if (image2 == 1)
            {
                secondImageUrl = await remoteService.UploadFile(mediaFile2.GetStream(), Path.GetFileName(mediaFile2.Path));
            }

            if (image3 == 1)
            {
                thirdImageUrl = await remoteService.UploadFile(mediaFile3.GetStream(), Path.GetFileName(mediaFile3.Path));
            }

            if (image4 == 1)
            {
                fourthImageUrl = await remoteService.UploadFile(mediaFile4.GetStream(), Path.GetFileName(mediaFile4.Path));
            }

            //firstImageUrl = await remoteService.UploadFile(mediaFile1.GetStream(), Path.GetFileName(mediaFile1.Path));
            //secondImage = await remoteService.UploadFile(mediaFile2.GetStream(), Path.GetFileName(mediaFile2.Path));
            //thirdImageUrl = await remoteService.UploadFile(mediaFile3.GetStream(), Path.GetFileName(mediaFile3.Path));
            //fourthImageUrl = await remoteService.UploadFile(mediaFile4.GetStream(), Path.GetFileName(mediaFile4.Path));


            var realtorProperty = new RealtorProperty()
            {
                CompanyName = Settings.CompanyNameSettings,
                AccountName = Settings.UsernameSettings,
                Avatar      = Settings.AvatarSettings,
                ItemName    = this.ItemName.ToLower().Trim(),
                ItemPrice   = this.Price,
                Description = this.Description.ToLower().Trim(),
                Location    = this.Location.ToLower().Trim(),
                ItemType    = this.Type,
                Negotiable  = this.Negotiable,
                PhoneNumber = Settings.PhoneNumberSettings,
                Email       = Settings.EmailSettings,
                FirstImage  = firstImageUrl,
                SecondImage = secondImageUrl,
                ThirdImage  = thirdImageUrl,
                FourthImage = fourthImageUrl,
                IsFavorite  = false
            };

            var upload = await remoteService.AddProperty(realtorProperty);

            await loadingDialog.DismissAsync();

            IsBusy = true;

            if (upload)
            {
                ItemName           = null;
                Price              = 0;
                Description        = null;
                Location           = null;
                Type               = null;
                Negotiable         = null;
                FirstImage.Source  = "Upload.png";
                SecondImage.Source = "Upload.png";
                ThirdImage.Source  = "Upload.png";
                FourthImage.Source = "Upload.png";
                await MaterialDialog.Instance.SnackbarAsync(message : "Uploaded successfully", actionButtonText : "OK", msDuration : 3000, configuration : snackBarConfiguration);
            }
            else
            {
                await MaterialDialog.Instance.SnackbarAsync(message : "Uploaded failed", actionButtonText : "OK", msDuration : 3000, configuration : snackBarConfiguration);
            }



            //IsBusy = true;
        }