コード例 #1
0
        private async Task DeleteProduct(string product_id)
        {
            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(async() =>
            {
                ret = WebService.DeleteProductByProductId(product_id);
            }).ContinueWith
                ((arg) =>
            {
                Device.BeginInvokeOnMainThread(async() =>

                {
                    if (!string.IsNullOrEmpty(ret))
                    {
                        StaticMethods.ShowToast("Product has been deleted successfully");
                        GetProfileData(filterType).Wait();
                    }
                    else
                    {
                        StaticMethods.ShowToast("Failed to delete product!, Please try again later.");
                    }
                });
            });
            StaticMethods.DismissLoader();
        }
コード例 #2
0
        private async Task ForgotPassword()
        {
            UserModel um = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                um = WebService.ForgotPassword(txtEmail.Text);
            }).ContinueWith(async
                            t =>
            {
                if (um.result == "success")
                {
                    StaticMethods.ShowToast(um.responseMessage);
                    await Navigation.PushAsync(new LoginPage());
                }
                else
                {
                    StaticMethods.ShowToast(um.responseMessage);
                }

                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #3
0
        private async Task Login()
        {
            UserModel um = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                um          = new UserModel();
                um.name     = txtUsername.Text;
                um.password = txtPass.Text;
                model       = WebService.Login(um);
            }).ContinueWith(async
                            t =>
            {
                if (model != null)
                {
                    StaticDataModel.userId = Convert.ToInt32(model.user_id);

                    StaticMethods.SaveLocalData(model);

                    StaticMethods.ShowToast("Login successfully");
                    StaticDataModel.IsAnonymousLogin = false;
                    App.Current.MainPage             = new NavigationPage(new MainPage());
                }
                else
                {
                    //StaticMethods.ShowToast(um.responseMessage);
                }

                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #4
0
        private async Task GetProducts()
        {
            StaticMethods.ShowLoader();

            _listProduct = WebService.FilterProducts(_typeOfBikes, _condition, _buy_rent,
                                                     _min_price,
                                                     _max_price,
                                                     _max_distance,
                                                     _gender,
                                                     _frameSize,
                                                     _lat,
                                                     _long
                                                     );

            Device.BeginInvokeOnMainThread(async() =>
            {
                StaticMethods.DismissLoader();
                if (_listProduct != null)
                {
                    if (_listProduct.Count > 0)
                    {
                        await Navigation.PushAsync(new HomePage(_listProduct));
                    }
                    else
                    {
                        StaticMethods.ShowToast("No products found!");
                    }
                }
                else
                {
                    StaticMethods.ShowToast("No products found!");
                }
            });
        }
コード例 #5
0
        private async Task UpdateProfile(ProfileModel.Datum model)
        {
            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                ret = WebService.UpdateProfile(model);
            }).ContinueWith(async
                            t =>
            {
                if (ret == "success")
                {
                    StaticMethods.ShowToast("Profile Updated successfully!");
                    Navigation.PopModalAsync();
                }
                else
                {
                    StaticMethods.ShowToast("Failed to update profile!");
                }



                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #6
0
        private async Task ChangePassword()
        {
            UserModel um = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                um = WebService.ChangePassword(txtOldPassword.Text, txtNewPassword.Text);
            }).ContinueWith(async
                            t =>
            {
                if (um.result == "success")
                {
                    StaticMethods.ShowToast(um.responseMessage);
                    App.Current.MainPage = new NavigationPage(new MainPage());
                }
                else
                {
                    StaticMethods.ShowToast(um.responseMessage);
                }

                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #7
0
 private bool IsValidate()
 {
     if (string.IsNullOrEmpty(txtOldPassword.Text))
     {
         txtOldPassword.PlaceholderColor = Color.Red;
         return(false);
     }
     else if (string.IsNullOrEmpty(txtNewPassword.Text))
     {
         txtNewPassword.PlaceholderColor = Color.Red;
         return(false);
     }
     else if (string.IsNullOrEmpty(txtConfirmPassword.Text))
     {
         txtConfirmPassword.PlaceholderColor = Color.Red;
         return(false);
     }
     else if (txtNewPassword.Text != txtConfirmPassword.Text)
     {
         txtNewPassword.TextColor     = Color.Red;
         txtConfirmPassword.TextColor = Color.Red;
         StaticMethods.ShowToast("Password does not match");
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #8
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            txtMsg.Focused   += TxtMsg_Focused;
            txtMsg.Unfocused += TxtMsg_Unfocused;
            btnSend.Clicked  += BtnSend_Clicked;
            txtMsg.Completed += TxtMsg_Completed;
            GetProductComments().Wait();

            MessagingCenter.Subscribe <object, string>(this, "CommentReply", (sender, msg) =>

            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (!string.IsNullOrEmpty(msg))
                    {
                        if (_comment_id != 0)
                        {
                            CommentReply(msg).Wait();
                        }
                        else
                        {
                            StaticMethods.ShowToast("Unable to send message, Please try again later!");
                        }
                    }
                });
            });
        }
コード例 #9
0
        private async Task SavePaypalId()
        {
            string ret = string.Empty;

            try
            {
                StaticMethods.ShowLoader();
                Task.Factory.StartNew(() =>
                {
                    ret = WebService.SavePaypalId(txtPaypalId.Text);
                }).ContinueWith((arg) =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (ret.Equals("success"))
                        {
                            StaticMethods.ShowToast("User paypal id saved successfully!");
                            Navigation.PopModalAsync();
                        }
                    });
                });
            }
            catch (Exception ex)
            {
            }
            finally
            {
                StaticMethods.DismissLoader();
            }
        }
コード例 #10
0
        private async Task AddRemoveSaveUser(string userid, string method, string Responsemessage)
        {
            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                ret = WebService.SaveUnsaveUser(userid, method);
            }).ContinueWith(async
                            t =>
            {
                if (ret == "success")
                {
                    StaticMethods.ShowToast(Responsemessage);
                    if (method == "save_users")
                    {
                        isFavourite     = true;
                        imgHeart.Source = "h.png";
                    }
                    else
                    {
                        isFavourite     = false;
                        imgHeart.Source = "h_unlike.png";
                    }
                }
                else
                {
                    StaticMethods.ShowToast("Unable to make changes, Please try again after some time.");
                }
                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #11
0
        async void call_Tapped(object sender, System.EventArgs e)
        {
            try
            {
                Device.BeginInvokeOnMainThread(() =>

                {
                    var model = StaticMethods.GetLocalSavedData();
                    if (model != null)
                    {
                        if (model.contact_number != null)
                        {
                            DependencyService.Get <IiOSMethods>().Call(model.contact_number);
                        }
                        else
                        {
                            StaticMethods.ShowToast("Contact no not availale!");
                        }
                    }
                });
            }
            catch (Exception ex)
            {
            }
        }
コード例 #12
0
        private bool Isvalidated()
        {
            try
            {
                if (string.IsNullOrEmpty(txtUsername.Text))
                {
                    txtUsername.PlaceholderColor = Color.Red;
                    return(false);
                }

                else if (string.IsNullOrEmpty(txtEmail.Text))
                {
                    txtEmail.PlaceholderColor = Color.Red;
                    return(false);
                }

                else if (string.IsNullOrEmpty(txtPass.Text))
                {
                    txtPass.PlaceholderColor = Color.Red;
                    return(false);
                }
                else if (string.IsNullOrEmpty(txtConPass.Text))
                {
                    txtConPass.PlaceholderColor = Color.Red;
                    return(false);
                }
                else if (txtPass.Text != txtConPass.Text)
                {
                    txtConPass.TextColor = Color.Red;
                    return(false);
                }
                else if (!string.IsNullOrEmpty(txtEmail.Text))
                {
                    if (!Regex.Match(txtEmail.Text, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success)
                    {
                        txtEmail.PlaceholderColor = Color.Red;
                        StaticMethods.ShowToast("Invalid email.");
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }


                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
            }
        }
コード例 #13
0
        private async Task GetProducts()
        {
            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                //_listProduct = WebService.FilterProducts(_typeOfBikes,_condition,_buy_rent,
                //                                         Convert.ToInt32(lblStartPriceRange),
                //                                         Convert.ToInt32(lblEndPriceRange),
                //                                         Convert.ToInt32(lblEndDistanceRange),
                //                                         StaticDataModel.Lattitude,
                //                                         StaticDataModel.Longitude);
                var list = new List <string> {
                    _model.data[0].type_of_bike
                };
                _listProduct = WebService.FilterProducts(list, null, null,
                                                         0,
                                                         0,
                                                         0,
                                                         null,
                                                         null,
                                                         StaticDataModel.Lattitude,
                                                         StaticDataModel.Longitude);
            }).ContinueWith(async
                            t =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (_listProduct != null)
                    {
                        if (_listProduct.Count > 0)
                        {
                            await Navigation.PushModalAsync(new HomePage(_listProduct));
                        }
                        else
                        {
                            StaticMethods.ShowToast("No products found!");
                        }
                    }
                    else
                    {
                        StaticMethods.ShowToast("No products found!");
                    }
                });


                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #14
0
        private async Task GetAllChatUsers()
        {
            string ret = string.Empty;

            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                _chatUserModel = WebService.GetChatUserList();
            }).ContinueWith(async
                            t =>
            {
                try
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (_chatUserModel != null)
                        {
                            if (!ReferenceEquals(_chatUserModel.data, null))
                            {
                                for (int i = 0; i < _chatUserModel.data.Count; i++)
                                {
                                    _chatUserModel.data[i].name = _chatUserModel.data[i].name + "-" + _chatUserModel.data[i].product_name;
                                    var date_time = _chatUserModel.data[i].last_chating_time;
                                    if (!string.IsNullOrEmpty(date_time))
                                    {
                                        var time  = Convert.ToDateTime(date_time);
                                        var _time = time.ToString("hh:mm tt");
                                        _chatUserModel.data[i].last_chating_time = _time;
                                    }
                                }
                                flowlistview.FlowItemsSource = _chatUserModel.data;
                            }
                            else
                            {
                                Device.BeginInvokeOnMainThread(() =>
                                {
                                    StaticMethods.ShowToast("No User model data");
                                });
                            }
                        }
                    });
                }
                catch (Exception ex)
                {
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #15
0
 void BtnSubmit_Clicked(object sender, EventArgs e)
 {
     if (_rating == 0)
     {
         StaticMethods.ShowToast("Please rate before submit!");
     }
     else if (string.IsNullOrEmpty(txtReview.Text))
     {
         txtReview.PlaceholderColor = Color.Red;
     }
     else
     {
         AddComment();
     }
 }
コード例 #16
0
 void Flowlistview_FlowItemTapped(object sender, ItemTappedEventArgs e)
 {
     if (isFirstLoad)
     {
         isFirstLoad = false;
         var item = e.Item as ChatUserModel.Datum;
         if (item != null)
         {
             Navigation.PushModalAsync(new Payment_A_Page(item));
         }
         else
         {
             StaticMethods.ShowToast("Unable to get detais. Please try again later!");
         }
     }
 }
コード例 #17
0
        private async Task SignUp(User user)
        {
            UserModel um = null;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                um = new UserModel();
                um.is_social_signup = 1;
                um.email            = user.Email;
                if (user.Name != null)
                {
                    um.name = user.Name;
                }
                else
                {
                    um.name = user.First_Name + "" + user.Last_Name;
                }
                um.password = "******";
                model       = WebService.SignUp(um);
            }).ContinueWith(async
                            t =>
            {
                if (model != null)
                {
                    StaticDataModel.userId = Convert.ToInt32(model.user_id);
                    StaticMethods.SaveLocalData(model);

                    StaticMethods.ShowToast("Login successfully");
                    StaticDataModel.IsAnonymousLogin = false;
                    App.Current.MainPage             = new NavigationPage(new MainPage());
                }
                else
                {
                    StaticMethods.ShowToast("User already exists.");
                }

                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #18
0
 void BtnRentit_Clicked(object sender, EventArgs e)
 {
     imageBytes = new List <byte[]>();
     // var bytes = img1.GetBytes?.Invoke();
     imageBytes.Add(img1.GetBytes?.Invoke());
     imageBytes.Add(img2.GetBytes?.Invoke());
     imageBytes.Add(img3.GetBytes?.Invoke());
     imageBytes.Add(img4.GetBytes?.Invoke());
     if (IsvalidatedRentTab())
     {
         if (imageBytes.Count > 0)
         {
             AddProduct_Rent().Wait();
         }
         else
         {
             StaticMethods.ShowToast("Please select or take a picture to continue!");
         }
     }
 }
コード例 #19
0
        private async Task GetReviews()
        {
            StaticMethods.ShowLoader();
            Task.Factory.StartNew(

                () =>
            {
                model = WebService.GetMyReviews();
            }).ContinueWith(async
                            t =>
            {
                if (!ReferenceEquals(model.review_data, null))
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        for (int i = 0; i < model.review_data.Count; i++)
                        {
                            if (!string.IsNullOrEmpty(model.review_data[i].profile_pic))
                            {
                                model.review_data[i].profile_pic = Constants.ProfilePicUrl + model.review_data[i].profile_pic;
                            }
                            else
                            {
                                model.review_data[i].profile_pic = "dummyprofile.png";
                            }

                            SetRating(Convert.ToInt32(model.review_data[i].rating), i);
                        }
                        flowlistview.FlowItemsSource = model.review_data;
                    });
                }
                else
                {
                    StaticMethods.ShowToast("No Reviews!");
                }


                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #20
0
 async void BtnSubmit_Clicked(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtEmail.Text))
     {
         if (!string.IsNullOrEmpty(txtEmail.Text))
         {
             if (!Regex.Match(txtEmail.Text, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success)
             {
                 txtEmail.TextColor = Color.Red;
                 StaticMethods.ShowToast("Invalid email.");
             }
             else
             {
                 ForgotPassword().Wait();
             }
         }
     }
     else
     {
         txtEmail.PlaceholderColor = Color.Red;
     }
 }
コード例 #21
0
        private async Task UpdateOfferStatus()
        {
            try
            {
                string lblPriceText = lblPrice.Text;
                lblPriceText      = lblPriceText.Replace(" ", string.Empty);
                lblPriceText      = lblPriceText.Replace("€", string.Empty);
                _offerstatusModel = WebService.SaveOfferStatus(Convert.ToInt32(_productModel.user_id), Convert.ToInt32(_productModel.product_id), Convert.ToDouble(lblPriceText), offer_status);

                if (string.Equals(_offerstatusModel.result, "success"))
                {
                    SetOfferStatus(offer_status);
                }
                else
                {
                    StaticMethods.ShowToast(_offerstatusModel.responseMessage);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #22
0
        private async Task AddComment()
        {
            string ret = string.Empty;

            StaticMethods.ShowLoader();
            Task.Factory.StartNew(
                // tasks allow you to use the lambda syntax to pass wor
                () =>
            {
                ret = WebService.AddComment(_rating, txtReview.Text);
            }).ContinueWith(async
                            t =>
            {
                if (ret == "success")
                {
                    StaticMethods.ShowToast("Your reviews has been submitted successfully!");
                    App.Current.MainPage = new NavigationPage(new MainPage());
                }


                StaticMethods.DismissLoader();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
        }
コード例 #23
0
        async void option_Tapped(object sender, System.EventArgs e)
        {
            try
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (StaticDataModel.userId.ToString().Equals(_productModel.user_id))
                    {
                        if (offer_status.Equals("0"))
                        {
                            StaticMethods.ShowToast("No Offer available.");
                        }
                        else
                        {
                            if (optionCount % 2 == 0)
                            {
                                imgTopBackgroud.IsVisible = true;
                                var height = App.ScreenHeight / 1.4;
                                flowlistview.HeightRequest = height - 100;

                                _slChatLayout.HeightRequest   = height - 100;
                                _sclChatContent.HeightRequest = height;
                            }
                            else
                            {
                                imgTopBackgroud.IsVisible = false;

                                var height = App.ScreenHeight / 3.4;
                                _slChatLayout.HeightRequest   = App.ScreenHeight - height;
                                flowlistview.HeightRequest    = App.ScreenHeight - height;
                                _sclChatContent.HeightRequest = height;
                            }

                            optionCount++;
                        }
                    }
                    else
                    {
                        if (optionCount % 2 == 0)
                        {
                            imgTopBackgroud.IsVisible = true;
                            //flowlistview.HeightRequest = App.ScreenWidth / 1.3;
                            var height = App.ScreenHeight / 1.4;
                            _slChatLayout.HeightRequest   = height - 100;
                            _sclChatContent.HeightRequest = height;
                            flowlistview.HeightRequest    = height - 100;
                        }
                        else
                        {
                            imgTopBackgroud.IsVisible = false;
                            //flowlistview.HeightRequest = App.ScreenHeight - 130;
                            var height = App.ScreenHeight - 60;

                            _slChatLayout.HeightRequest   = height - 100;
                            _sclChatContent.HeightRequest = height;
                            flowlistview.HeightRequest    = App.ScreenHeight - height;
                        }

                        optionCount++;
                    }
                });
            }
            catch (Exception ex)
            {
            }
        }