public ListViewPage() { Title = "List View Page"; var listViewData = SampleDataModelFactory.GetSampleData(); var cell = new DataTemplate(typeof(WhiteTextImageCell)); cell.SetValue(TextCell.TextProperty, "Number"); cell.SetBinding(ImageCell.DetailProperty, "Number"); cell.SetValue(ImageCell.ImageSourceProperty, "Hash"); var listView = new ListView { ItemTemplate = cell, ItemsSource = listViewData, BackgroundColor = Color.FromHex("#2980b9") }; listView.ItemTapped += (s, e) => { var item = e.Item; AnalyticsHelpers.TrackEvent(AnalyticsConstants.LIST_VIEW_ITEM_TAPPED, new Dictionary <string, string> { { AnalyticsConstants.LIST_VIEW_ITEM_NUMBER, item.ToString() } }); DisplayAlert("Number Tapped", $"You Selected Number {item.ToString()}", "OK"); }; Content = listView; }
public async void OnButtonClick(object sender, EventArgs e) { string entryText = textEntry.Text; AnalyticsHelpers.TrackEvent(AnalyticsConstants.GO_BUTTON_TAPPED, new Dictionary <string, string> { { AnalyticsConstants.TEXT_ENTERED, entryText } }); Device.BeginInvokeOnMainThread(() => { //Hide the keyboard textEntry.Unfocus(); //Show the activity indicator and hide the Go Button activityIndicator.IsRunning = true; activityIndicator.IsVisible = true; goButton.IsVisible = false; goButton.IsEnabled = false; }); //Perform a task for 2000 miliseconds await Task.Delay(2000); Device.BeginInvokeOnMainThread(() => { //Hide the activity indicator now that task has completed activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; goButton.IsVisible = true; goButton.IsEnabled = true; //display the textLabel.Text = entryText; }); }
public override async void Login(string userName, string passWord, bool saveUserName) { base.Login(userName, passWord, saveUserName); var success = await DependencyService.Get <ILogin>().CheckLogin(userName, passWord); if (success) { var insightsDict = new Dictionary <string, string> { { "User Type", "NonApprover" }, { "Uses TouchId", "Yes" }, }; if (saveUserName) { await DependencyService.Get <ILogin>().SaveUsername(userName); insightsDict.Add("Saves username", "Yes"); } else { insightsDict.Add("Saves username", "No"); } App.IsLoggedIn = true; if (Device.OS == TargetPlatform.iOS) { await Navigation.PopAsync(); } else { await Navigation.PushAsync(new FirstPage(), false); Navigation.RemovePage(this); } } else { var signUp = await DisplayAlert("Invalid Login", "Sorry, we didn't recoginize the username or password. Feel free to sign up for free if you haven't!", "Sign up", "Try again"); if (signUp) { await Navigation.PushModalAsync(new NewUserSignUpPage()); AnalyticsHelpers.TrackEvent("NewUserSignUp", new Dictionary <string, string> { { "ActionPoint", "System Prompt" }, }); } } }
protected override void OnAppearing() { base.OnAppearing(); AnalyticsHelpers.TrackEvent(AnalyticsConstants.FIRST_PAGE_ON_APPEARING); }