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) { } }
private void PrepareUI() { try { StaticDataModel._CurrentContext.IsGestureEnabled = false; flowlistview.FlowColumnMinWidth = App.ScreenWidth; flowlistview.HeightRequest = App.ScreenHeight / 3; imgProduct.HeightRequest = App.ScreenHeight / 4; imgProduct.Source = _product.product_image; lblProductTitle.Text = _product.product_name; if (StaticMethods.IsIpad()) { _slFooter.HeightRequest = 100; txtMsg.HeightRequest = 80; btnSend.HeightRequest = 60; btnSend.WidthRequest = 60; btnSend.BorderRadius = 30; } var model = StaticMethods.GetLocalSavedData(); if (!string.IsNullOrEmpty(model.name)) { _userName = model.name; } if (Convert.ToInt32(_product.user_id) == StaticDataModel.userId) { _isProductAdmin = true; } } catch (Exception ex) { } }
private async Task GetProfile() { StaticMethods.ShowLoader(); Task.Factory.StartNew( () => { _profileModel = WebService.GetProfile(StaticDataModel.userId); }).ContinueWith(async t => { if (_profileModel != null) { Device.BeginInvokeOnMainThread(async() => { lblUserName.Text = _profileModel.data[0].name; lblEmail.Text = _profileModel.data[0].website_url; lblReviews.Text = _profileModel.data[0].total_reviews + " Reviews"; lblMyReviews.Text = _profileModel.data[0].get_review + " Reviews"; lblMail.Text = _profileModel.data[0].email; lblContactNo.Text = _profileModel.data[0].contact_number; lblSavedUser.Text = _profileModel.data[0].saved_users + " Saved Users"; if (!string.IsNullOrEmpty(_profileModel.data[0].profile_pic)) { imgProfile.Source = Constants.ProfilePicUrl + _profileModel.data[0].profile_pic; } if (!string.IsNullOrEmpty(_profileModel.data[0].ratings)) { var val = Math.Round(Convert.ToDouble(_profileModel.data[0].ratings), 3); lblRating.Text = val.ToString(); } var model = StaticMethods.GetLocalSavedData(); if (model != null) { if (model.is_retailer == "1") { imgRibbon.IsVisible = true; } } }); } StaticMethods.DismissLoader(); }, TaskScheduler.FromCurrentSynchronizationContext() ); }
async void help_Tapped(object sender, System.EventArgs e) { try { Device.BeginInvokeOnMainThread(() => { var model = StaticMethods.GetLocalSavedData(); if (model != null) { if (model.help_url != null) { Device.OpenUri(new Uri(model.help_url)); } } }); } catch (Exception ex) { } }
public App() { InitializeComponent(); //To initialize location locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; var exists = CrossSecureStorage.Current.HasKey("userId"); if (!exists) { MainPage = new NavigationPage(new LoginPage()); } else { var model = StaticMethods.GetLocalSavedData(); StaticDataModel.userId = model.user_id; MainPage = new BikeSpot.MainPage(); } //StaticDataModel.userId = 13; //MainPage = new NavigationPage(new BikeSpot.ChatUsersPage()); }
public MainPage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); //menuPage = new MasterPage(); // Master = menuPage; //Detail = new NavigationPage(new HomePage()); var model = StaticMethods.GetLocalSavedData(); if (model != null) { if (!string.IsNullOrEmpty(model.name)) { _masterpage._lblUserName.Text = model.name; } else { _masterpage._lblUserName.Text = "(User Name)"; } _masterpage._lblEmail.Text = model.email; if (!string.IsNullOrEmpty(model.profile_pic)) { _masterpage._imgProfile.Source = Constants.ProfilePicUrl + model.profile_pic; } else { _masterpage._imgProfile.Source = "dummyprofile.png"; } } //To access navigation menu on a button click StaticDataModel._CurrentContext = this; //event to opent menu slider MenuTapped = new Command(async(x) => { Device.BeginInvokeOnMainThread(async() => { this.IsPresented = true; }); }); //Tap events var tapeventHome = new TapGestureRecognizer(); tapeventHome.Tapped += (s, e) => { // handle the tap IsPresented = false; Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(HomePage))); }; _masterpage._slHome.GestureRecognizers.Add(tapeventHome); var tapevent = new TapGestureRecognizer(); tapevent.Tapped += (s, e) => { // handle the tap IsPresented = false; Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(Settings))); }; _masterpage._imgTemp.GestureRecognizers.Add(tapevent); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (s, e) => { // handle the tap IsPresented = false; //Detail = new NavigationPage((Page)Activator.CreateInstance (typeof(MyProfilePage))); }; _masterpage._imgProfile.GestureRecognizers.Add(tapGestureRecognizer); var tapGestureRecognizerProfile = new TapGestureRecognizer(); tapGestureRecognizerProfile.Tapped += (s, e) => { // handle the tap StaticDataModel.IsFromNavigationMenu = true; IsPresented = false; StaticDataModel.IsFromSell = true; Navigation.PushModalAsync(new AddProductPage()); }; _masterpage._slSell.GestureRecognizers.Add(tapGestureRecognizerProfile); var tapGestureRecognizer3 = new TapGestureRecognizer(); tapGestureRecognizer3.Tapped += (s, e) => { // handle the tap StaticDataModel.IsFromNavigationMenu = true; IsPresented = false; StaticDataModel.IsFromSell = false; Navigation.PushModalAsync(new AddProductPage()); }; _masterpage._slRent.GestureRecognizers.Add(tapGestureRecognizer3); var tapGestureRecognizer4 = new TapGestureRecognizer(); tapGestureRecognizer4.Tapped += (s, e) => { // handle the tap StaticDataModel.IsFromNavigationMenu = true; IsPresented = false; Navigation.PushModalAsync(new ChatUsersPage()); }; _masterpage._slMessages.GestureRecognizers.Add(tapGestureRecognizer4); var tapGestureRecognizer5 = new TapGestureRecognizer(); tapGestureRecognizer5.Tapped += (s, e) => { // handle the tap IsPresented = false; //Detail = new NavigationPage((Page)Activator.CreateInstance (typeof(BikeWizardStartPage))); Navigation.PushModalAsync(new BikeWizardStartPage()); }; _masterpage._slBikeWizard.GestureRecognizers.Add(tapGestureRecognizer5); var tapGestureRecognizer6 = new TapGestureRecognizer(); tapGestureRecognizer6.Tapped += (s, e) => { // handle the tap IsPresented = false; DisplayAlert("Message", "It will work in next version.", "OK"); }; _masterpage._slUpgrades.GestureRecognizers.Add(tapGestureRecognizer6); var tapGestureRecognizer7 = new TapGestureRecognizer(); tapGestureRecognizer7.Tapped += (s, e) => { // handle the tap IsPresented = false; DisplayAlert("Message", "It will work in next version.", "OK"); }; _masterpage._slPrivateRetailerAccount.GestureRecognizers.Add(tapGestureRecognizer7); var tapGestureRecognizer8 = new TapGestureRecognizer(); tapGestureRecognizer8.Tapped += (s, e) => { // handle the tap IsPresented = false; DisplayAlert("Message", "It will work in next version.", "OK"); }; _masterpage._slFaq.GestureRecognizers.Add(tapGestureRecognizer8); var tapGestureRecognizer9 = new TapGestureRecognizer(); tapGestureRecognizer9.Tapped += (s, e) => { // handle the tap IsPresented = false; DisplayAlert("Message", "It will work in next version.", "OK"); }; _masterpage._slContact.GestureRecognizers.Add(tapGestureRecognizer9); var tapGestureRecognizer10 = new TapGestureRecognizer(); tapGestureRecognizer10.Tapped += (s, e) => { // handle the tap IsPresented = false; DisplayAlert("Message", "It will work in next version.", "OK"); }; _masterpage._slSiteNotice.GestureRecognizers.Add(tapGestureRecognizer10); }
private async Task GetProfile() { StaticMethods.ShowLoader(); Task.Factory.StartNew( () => { _profileModel = WebService.GetProfile(_userId); }).ContinueWith(async t => { try { if (_profileModel != null) { Device.BeginInvokeOnMainThread(async() => { lblUserName.Text = _profileModel.data[0].name; lblEmail.Text = _profileModel.data[0].website_url; lblReviews.Text = _profileModel.data[0].total_reviews + " Reviews"; if (!string.IsNullOrEmpty(_profileModel.data[0].profile_pic)) { imgProfile.Source = Constants.ProfilePicUrl + _profileModel.data[0].profile_pic; } else { imgProfile.Source = "dummyprofile.png"; } if (!string.IsNullOrEmpty(_profileModel.data[0].ratings)) { var val = Math.Round(Convert.ToDouble(_profileModel.data[0].ratings), 3); lblRating.Text = val.ToString(); } var model = StaticMethods.GetLocalSavedData(); if (model != null) { if (model.is_retailer == "1") { imgRibbon.IsVisible = true; } } GetProfileData("rent").Wait(); }); } } catch (Exception ex) { } finally { Device.BeginInvokeOnMainThread(() => { GetProfileData("sell").Wait(); }); } StaticMethods.DismissLoader(); }, TaskScheduler.FromCurrentSynchronizationContext() ); }