public async void GetUser()
        {
            try
            {
                bool success = GetDetails();
                if (success)
                {
                    NameLabel.Text            = rassavadaEntity.Name;
                    ProPicImage.Source        = rassavadaEntity.ProfilePic;
                    LevelLabel.Text           = "Local Guide Level " + rassavadaEntity.level;
                    MainProgressVBar.Progress = rassavadaEntity.Points / (rassavadaEntity.high - rassavadaEntity.low);
                    PointsLabel.Text          = rassavadaEntity.Points + " Points >";
                    LowPointsLabel.Text       = rassavadaEntity.low.ToString();
                    HighPointsLabel.Text      = rassavadaEntity.high.ToString();
                    entity = rassavadaEntity;
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("No Internet", "Check your internet connection and try again. If the problem persists please restart the app", "Ok");

                    GetUser();
                }
            }
            catch (Exception e)
            {
                await App.Current.MainPage.DisplayAlert("No Internet", "Check your internet connection", "Ok");

                GetUser();
            }
        }
 public HomePage()
 {
     InitializeComponent();
     Refresh.SetHome(this);
     //#if DEBUG
     //            requestURL = "https://us-central1-e0-rasvada.cloudfunctions.net/PageHome";
     //#endif
     requestURL      = "https://us-central1-e0-trouvailler.cloudfunctions.net/PageHome ";
     rassavadaEntity = new RassavadaEntity()
     {
     };
     GetUser();
 }
 public ProfilePage(RassavadaEntity rassavadaEntity)
 {
     InitializeComponent();
     LevelLabel.Text           = "Local Guide Level " + rassavadaEntity.level;
     MainProgressVBar.Progress = rassavadaEntity.Points / (rassavadaEntity.high - rassavadaEntity.low);
     PointsLabel.Text          = rassavadaEntity.Points + " Points >";
     LowPointsLabel.Text       = rassavadaEntity.low.ToString();
     HighPointsLabel.Text      = rassavadaEntity.high.ToString();
     EmailLabel.Text           = "Email : " + rassavadaEntity.CEmail;
     PhoneNumberLabel.Text     = "Phone Number : " + rassavadaEntity.PhoneNo;
     AddressLabel.Text         = "Address : " + rassavadaEntity.HomeAddress;
     Vehiclelabel.Text         = "Vehicle Status : " + rassavadaEntity.Vehicle;
     PackCrLabel.Text          = rassavadaEntity.PackAdd;
     ExpCrLabel.Text           = rassavadaEntity.PlaceAdd;
     PicCrLabel.Text           = rassavadaEntity.PhotoAdd;
 }
 private bool GetDetails()
 {
     try
     {
         Dictionary <string, object> postParameters = new Dictionary <string, object>();
         postParameters.Add("UserId", Application.Current.Properties["User"]);
         HttpWebResponse webResponse        = FormUpload.MultipartFormPost(requestURL, "someone", postParameters, "", "");
         StreamReader    responseReader     = new StreamReader(webResponse.GetResponseStream());
         string          returnResponseText = responseReader.ReadToEnd();
         rassavadaEntity = JsonConvert.DeserializeObject <RassavadaEntity>(returnResponseText);
         webResponse.Close();
         return(true);
     }
     catch (Exception e)
     {
         DisplayAlert("Server Error", "Please check your internet connection and try again", "Ok");
         return(false);
     }
 }
Exemple #5
0
        public LeaderBoardPage(RassavadaEntity rassavadaEntity)
        {
            InitializeComponent();
            string requestURL;

            NameLabel.Text     = rassavadaEntity.Name;
            PropicImage.Source = rassavadaEntity.ProfilePic;
            LevelLabel.Text    = "Local Giude Level " + rassavadaEntity.level;
            PointsLabel.Text   = rassavadaEntity.Points + "";


            try
            {
//#if DEBUG
//                requestURL = "https://us-central1-e0-rasvada.cloudfunctions.net/PageLeaderboard";
//#endif


                requestURL = "https://us-central1-e0-trouvailler.cloudfunctions.net/PageLeaderboard";

                Dictionary <string, object> postParameters = new Dictionary <string, object>();
                postParameters.Add("UserId", Application.Current.Properties["User"]);
                HttpWebResponse webResponse        = FormUpload.MultipartFormPost(requestURL, "someone", postParameters, "", "");
                StreamReader    responseReader     = new StreamReader(webResponse.GetResponseStream());
                string          returnResponseText = responseReader.ReadToEnd();
                //rassavadaEntity = JsonConvert.DeserializeObject<RassavadaEntity>(returnResponseText);

                leaderList = JsonConvert.DeserializeObject <LeaderList>(returnResponseText);
                webResponse.Close();
            }
            catch (Exception e)
            {
                DisplayAlert("No Internet", "Please check your internet connection", "Ok");
            }

            MainCollectionView.ItemsSource = leaderList.Leaderboard;
        }