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)
                    });
                });
            });
        }
Exemplo n.º 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))
             });
         });
     });
 }
Exemplo n.º 3
0
 protected override void OnAppearing()
 {
     if (!teamName.Equals(Preferences.Get("teamStart", 0)))
     {
         teamName   = Preferences.Get("teamStart", -1);
         this.Title = AdapterMethods.getTeamString(teamName);
     }
 }
Exemplo n.º 4
0
 protected override void OnAppearing()
 {
     if (!teamName.Equals(Preferences.Get("teamStart", 0)))
     {
         newName    = Preferences.Get("teamStart", 0);
         this.Title = AdapterMethods.getTeamString(newName);
     }
     eventName = Preferences.Get(ConstantVars.CURRENT_EVENT_NAME, "");
 }
        /*
         * This is the order in which the array is ordered
         * overall, cargoTime, hatchTime, climb, lvl1, lvl2, lvl3
         */
        public RankingsDetailView(String[] times)
        {
            InitializeComponent();
            setScoreValues(times);
            string teamString = AdapterMethods.getTeamString(Rankings.teamSend);

            pitButton.IsVisible = Rankings.pitTeams.Contains(teamString);
            String team = Rankings.teamSend.ToString();

            listView.ItemsSource = Matches.matchesList.Where(matchesList => matchesList.teamNameAndSide.ToLower().Contains(team.ToLower() + " - "));
        }
Exemplo n.º 6
0
        public static List <string> getListVals(JObject input)
        {
            List <string> teamsInclude = new List <string> ();

            if (input.ContainsKey("PitNotes"))
            {
                JArray pits = (JArray)input["PitNotes"];
                foreach (var x in pits)
                {
                    teamsInclude.Add(AdapterMethods.getTeamString((int)x["team"]));
                }
            }
            return(teamsInclude);
        }
 void matchConfirm()
 {
     if (!Preferences.ContainsKey("appState"))
     {
         appRestore = false;
         Preferences.Set("appState", 0);
         Preferences.Set("teamStart", 0);
         Preferences.Set("timerValue", (int)0);
         Preferences.Set("tempParams", "");
         Preferences.Set("tempMatchEvents", "");
         Preferences.Set("tempPitNotes", "");
         Preferences.Set(ConstantVars.CURRENT_EVENT_NAME, "");
     }
     else if (!String.IsNullOrWhiteSpace(Preferences.Get("tempMatchEvents", "")) || !String.IsNullOrWhiteSpace(Preferences.Get("tempParams", "")))       //App.Current.Properties["appState"].ToString() == "1"
     {
         appRestore = true;
         NavigationPage.SetHasNavigationBar(this, false);
         Navigation.PushAsync(new MatchEntryEditTab()
         {
             Title = AdapterMethods.getTeamString(Preferences.Get("teamStart", 0))
         });
     }
     else if (!String.IsNullOrWhiteSpace(Preferences.Get("tempPitNotes", "")))
     {
         appRestore = true;
         NavigationPage.SetHasNavigationBar(this, false);
         Navigation.PushAsync(new PitEntry(true, Preferences.Get("teamStart", 0), true)
         {
             Title = AdapterMethods.getTeamString(Preferences.Get("teamStart", 0))
         });
     }
     else if (Preferences.Get("appState", 0) == 0)
     {
         appRestore = false;
         Preferences.Set("appState", 0);
         Preferences.Set("timerValue", (int)0);
         Preferences.Set("teamStart", 0);
         Preferences.Set("tempMatchEvents", "");
         Preferences.Set("tempParams", "");
         Preferences.Set("tempPitNotes", "");
     }
     if (!Preferences.ContainsKey(ConstantVars.APP_DATA_STORAGE))
     {
         Preferences.Set(ConstantVars.APP_DATA_STORAGE, "");
         Preferences.Set("tempMatchEvents", "");
         Preferences.Set("tempPitNotes", "");
     }
     populateMatchesList();
 }
        //Updates events with given enum
        private void updateEvents()
        {
            //Updates string data from matches
            Debug.WriteLine(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "reee"));
            //JObject temp = JObject.Parse(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "{}"));
            //Debug.WriteLine(temp);
            //if (temp.ContainsKey(eventName))
            //{
            //    temp = (JObject)temp[eventName];
            //}
            //else
            //{
            //    temp = new JObject();
            //}
            mainRank.setData(App.getCompJson(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "{}"), eventName));
            //Gets all data and sets it into ascending order based on each team's average time
            Dictionary <int, double> x     = mainRank.getRank(rankChoice);
            Dictionary <int, double> y     = new Dictionary <int, double>(x);
            List <RankStruct>        ranks = new List <RankStruct> ();

            if (!(rankPicker.SelectedIndex == 7))
            {
                y = (from pair in x orderby pair.Value descending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
            }
            else
            {
                try {
                    y = (from pair in x orderby pair.Key ascending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
                } catch {
                    y = new Dictionary <int, double> ();
                }
            }

            foreach (var s in y)
            {
                ranks.Add(new RankStruct {
                    Key = AdapterMethods.getTeamString(s.Key), Value = s.Value, color = getTeamColor(s.Key)
                });
            }
            listView.ItemsSource = ranks;
            rankList             = ranks;
            setListVisibility(y.Count());
        }
 async void pitClicked(object sender, System.EventArgs e)
 {
     Preferences.Set("teamStart", Rankings.teamSend);
     await Navigation.PushAsync(new PitEntry (true, Rankings.teamSend, false) { Title = AdapterMethods.getTeamString(Rankings.teamSend) });
 }