Exemplo n.º 1
0
        async Task ExecutePullToRefreshCommanded()
        {
            AnalyticsHelpers.TrackEvent(AnalyticsConstants.PullToRefreshCommanded);

            await RefreshDataAsync();

            OnLoadingDataFromBackendCompleted();
        }
Exemplo n.º 2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            AnalyticsHelpers.TrackEvent(AnalyticsConstants.ListViewPageAppeared);

            _listView.ItemTapped += HandleListViewItemTapped;
            _viewModel.LoadingDataFromBackendCompleted += HandleLoadingDataFromBackendCompleted;
        }
Exemplo n.º 3
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            AnalyticsHelpers.TrackEvent(AnalyticsConstants.FirstPageOnAppeared);

            _goButton.Clicked       += HandleButtonClicked;
            _listPageButton.Clicked += HandleListPageButtonClicked;
        }
Exemplo n.º 4
0
        async Task RefreshDataFromLocalDatabaseAsync()
        {
            try
            {
                var dataListAsIEnumerable = await DependencyService.Get <IDataService>().GetItemsFromLocalDatabaseAsync <ListPageDataModel>();

                DataList = dataListAsIEnumerable?.ToList();
            }
            catch (Exception e)
            {
                AnalyticsHelpers.Log("Error Retriving Data From Local Database", e.Message, e);
            }
        }
        async Task ExecuteGoButtonTapped()
        {
            AnalyticsHelpers.TrackEvent(AnalyticsConstants.GoButtonTapped, new Dictionary <string, string> {
                { AnalyticsConstants.FirstPageTextEntered, EntryText }
            });

            IsActiityIndicatorRunning = true;

            await Task.Delay(2000);

            IsActiityIndicatorRunning = false;
            LabelText = EntryText;
        }
Exemplo n.º 6
0
        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" },
                    });
                }
            }
        }
Exemplo n.º 7
0
        async void HandleListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            var listView = sender as ListView;
            var tappedListPageDataModel = e.Item as ListPageDataModel;

            AnalyticsHelpers.TrackEvent(AnalyticsConstants.ListViewItemTapped,
                                        new Dictionary <string, string> {
                { AnalyticsConstants.ListViewItemNumber, tappedListPageDataModel.DetailProperty }
            }
                                        );

            await DisplayAlert("Number Tapped", $"You Selected Number {tappedListPageDataModel.DetailProperty}", "OK");

            listView.SelectedItem = null;
        }
Exemplo n.º 8
0
        async Task RefreshDataFromAzureAsync()
        {
            var isAzureDatabaseReachable = await CrossConnectivity.Current.IsRemoteReachable(AzureConstants.AzureDataServiceUrl, 80, 1000);

            if (!CrossConnectivity.Current.IsConnected || !isAzureDatabaseReachable)
            {
                return;
            }

            try
            {
                var dataListAsIEnumerable = await DependencyService.Get <IDataService>().GetItemsAsync <ListPageDataModel>();

                DataList = dataListAsIEnumerable.ToList();
            }
            catch (Exception e)
            {
                AnalyticsHelpers.Log("Error Retrieving Data From Azure", e.Message, e);
            }
        }