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)
                    });
                });
            });
        }
示例#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);
         CubeDroppedDialog.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 = val.Property("team").Value.ToString()
             });
         });
     });
 }
示例#3
0
        //Sets the value of the time if app crashed or match was restored
        private void timerValueSetter()
        {
            if (!Preferences.ContainsKey("lastItemPicked"))
            {
                Preferences.Set("lastItemPicked", 0);
                Preferences.Set("lastItemDroppped", 0);
                Preferences.Set("tempEventString", "");
                Preferences.Set("tempMatchEvents", "");
            }
            //else if (Preferences.Get ("lastItemPicked", 0) == 0 || Preferences.Get ("lastItemDropped", 0) == 0) { } else if (Preferences.Get ("lastItemDroppped", 0) > Preferences.Get ("lastItemDropped", 0)) {
            //    cubePicked.Text = ConstantVars.ITEM_DROPPED_TEXT_LIVE;
            //}

            if (!Preferences.ContainsKey("timerValue"))
            {
                Preferences.Set("timerValue", (int)timerValue);
            }
            else if (Preferences.ContainsKey("timerValue") && firstTimerStart == true)
            {
                timerValue       = Preferences.Get("timerValue", 0);
                timeSlider.Value = timerValue;
                timerText.Text   = timeToString((int)timerValue);
                firstTimerStart  = false;
            }
            try {
                try {
                    events = MatchFormat.JSONEventsToObject(JObject.Parse(Preferences.Get("tempMatchEvents", "")));
                    if (events != null && events.Count > 0)
                    {
                        lastEvent = events[events.Count - 1];
                    }
                } catch (JsonReaderException) { }
                if (Object.ReferenceEquals(events, null))
                {
                    events = new List <MatchFormat.Data>();
                }
            } catch (InvalidCastException) { }
            setEventButtons(isTimerRunning);
            int balls = calculateCurrentBalls();

            currentCellAmt.Text = balls.ToString();
            //setCubeButton ();
        }
示例#4
0
        //Sets the value of the time if app crashed or match was restored
        private void timerValueSetter()
        {
            if (!Preferences.ContainsKey("lastItemPicked"))
            {
                Preferences.Set("lastItemPicked", 0);
                Preferences.Set("lastItemDroppped", 0);
                Preferences.Set("tempEventString", "");
                Preferences.Set("tempMatchEvents", "");
                Application.Current.SavePropertiesAsync();
            }
            else if (Preferences.Get("lastItemPicked", 0) == 0 || Preferences.Get("lastItemDropped", 0) == 0)
            {
            }
            else if (Preferences.Get("lastItemDroppped", 0) > Preferences.Get("lastItemDropped", 0))
            {
                cubePicked.Image = ConstantVars.ITEM_DROPPED_IMAGE_LIVE;
                cubePicked.Text  = ConstantVars.ITEM_DROPPED_TEXT_LIVE;
            }

            if (!Preferences.ContainsKey("timerValue"))
            {
                Preferences.Set("timerValue", (int)timerValue);
            }
            else if (Preferences.ContainsKey("timerValue") && firstTimerStart == true)
            {
                timerValue       = Preferences.Get("timerValue", 0);
                timeSlider.Value = timerValue;
                timerText.Text   = timeToString((int)timerValue);
                firstTimerStart  = false;
            }
            try {
                try {
                    events = MatchFormat.JSONEventsToObject(JObject.Parse(Preferences.Get("tempMatchEvents", "")));
                } catch (JsonReaderException) { }
                if (Object.ReferenceEquals(events, null))
                {
                    events = new List <MatchFormat.Data> ();
                }
            } catch (InvalidCastException) { }
            setEventButtons(isTimerRunning);
            setCubeButton();
        }