async void matchTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            int jsonIndex = Matches.matchesList.IndexOf(e.Item as Matches.MatchesListFormat);

            await Task.Run(async() => {
                JObject val        = JObject.Parse(MatchesDetailView.returnMatchJSONText(jsonIndex));
                JObject parameters = new JObject();
                foreach (var x in val)
                {
                    if (!x.Key.Equals("numEvents"))
                    {
                        parameters.Add(x.Key, x.Value);
                    }
                    else
                    {
                        break;
                    }
                }
                Preferences.Set("tempParams", JsonConvert.SerializeObject(parameters.ToObject <MatchFormat.EntryParams> ()));
                NewMatchStart.events = MatchFormat.JSONEventsToObject(val);
                NewMatchStart.saveEvents();
                Preferences.Set("timerValue", Convert.ToInt32(val.Property("timerValue").Value));
                Preferences.Set("teamStart", (int)val.Property("team"));
                Device.BeginInvokeOnMainThread(() => {
                    Navigation.PushAsync(new MatchEntryEditTab()
                    {
                        Title = AdapterMethods.getTeamString((int)val.Property("team").Value)
                    });
                });
            });
        }
Beispiel #2
0
 async void openClicked(object sender, System.EventArgs e)
 {
     await Task.Run(async() => {
         JObject val        = JObject.Parse(returnMatchJSONText(jsonIndex));
         JObject parameters = new JObject();
         foreach (var x in val)
         {
             if (!x.Key.Equals("numEvents"))
             {
                 parameters.Add(x.Key, x.Value);
             }
             else
             {
                 break;
             }
         }
         Preferences.Set("tempParams", JsonConvert.SerializeObject(parameters.ToObject <MatchFormat.EntryParams> ()));
         NewMatchStart.events = MatchFormat.JSONEventsToObject(val);
         NewMatchStart.saveEvents();
         Preferences.Set("timerValue", Convert.ToInt32(val.Property("timerValue").Value));
         Preferences.Set("teamStart", val.Property("team").Value.ToString());
         Device.BeginInvokeOnMainThread(() => {
             Navigation.PushAsync(new MatchEntryEditTab()
             {
                 Title = AdapterMethods.getTeamString(Convert.ToInt32(val.Property("team").Value))
             });
         });
     });
 }
        //Populates List that contains all data for each timer event to appear on the Match Events Screen
        public static List <EventListFormat> EventViewList(List <MatchFormat.Data> matchData)
        {
            List <EventListFormat> listData = new List <EventListFormat> ();

            for (int i = 0; i < matchData.Count; i++)
            {
                listData.Add(new EventListFormat {
                    image     = returnEventImage(matchData[i].type),
                    eventName = returnEventText(matchData[i].type),
                    timeOccur = NewMatchStart.timeToString(matchData[i].time)
                });
            }
            return(listData);
        }