示例#1
0
        async void teamClicked(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            String teamName  = e.Item.ToString();
            int    teamnum   = AdapterMethods.getTeamInt(teamName, App.teamsList);
            JArray pitValues = (JArray)JObject.Parse(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "")) ["PitNotes"];

            Preferences.Set("teamStart", teamnum);
            await Navigation.PushAsync(new PitEntry (false, teamnum, true) { Title = teamName });
        }
        async void teamClicked(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            var x       = (listView.ItemsSource as IEnumerable <RankStruct>).ToList();
            int teamnum = AdapterMethods.getTeamInt(((RankStruct)e.Item).Key, App.teamsList);

            //String item = x.Find (y => y.Equals (teamnum)).Key;
            teamSend = teamnum;
            Debug.WriteLine("befrore send" + ((RankStruct)e.Item).Key);
            await Navigation.PushAsync(new RankingsDetailView (mainRank.returnTeamTimes(teamnum)) { Title = ((RankStruct)e.Item).Key });
        }
        async void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            teamName = e.Item.ToString();
            int teamnum;

            try
            {
                teamnum = AdapterMethods.getTeamInt(teamName, App.teamsList);
                Preferences.Set("teamStart", teamnum);
                switch (goToMatch)
                {
                case ConstantVars.TEAM_SELECTION_TYPES.match:
                    await Navigation.PushAsync(new MatchEntryEditTab()
                    {
                        Title = teamName
                    });

                    Navigation.RemovePage(this);
                    break;

                case ConstantVars.TEAM_SELECTION_TYPES.pit:
                    await Navigation.PushAsync(new PitEntry(true, teamnum, true) { Title = teamName });

                    Navigation.RemovePage(this);
                    break;

                case ConstantVars.TEAM_SELECTION_TYPES.teamSelection:
                    await Navigation.PopAsync();

                    break;
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Failed to get team number from the list", "", "OK");

                System.Diagnostics.Debug.WriteLine(ex);
            }
        }