예제 #1
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()
             });
         });
     });
 }
예제 #2
0
        async void resetClicked(object sender, System.EventArgs e)
        {
            var ensure = await DisplayActionSheet("Are you sure you want to reset everything about this match?", ConstantVars.CANCEL, null, ConstantVars.YES);

            if (ensure == ConstantVars.YES)
            {
                events.Clear();
                CubeDroppedDialog.saveEvents();
                timeSlider.Value = 0;
                isTimerRunning   = false;
                climbTime        = 0;
            }
        }
예제 #3
0
 void climbClicked(object sender, System.EventArgs e)
 {
     if (!isTimerRunning)
     {
         DisplayAlert("Error", "Timer not Started", "OK");
     }
     else if (climbTime == 0)
     {
         //Adds info to to JSON about climb
         climbTime = (int)timerValue;
         events.Add(new MatchFormat.Data {
             time = climbTime, type = (int)MatchFormat.ACTION.startClimb
         });
         CubeDroppedDialog.saveEvents();
         setClimbButton();
     }
 }
예제 #4
0
        async void cubeClicked(object sender, System.EventArgs e)
        {
            if (!isTimerRunning)
            {
                await DisplayAlert("Error", "Timer not Started", "OK");
            }
            else if (cubePicked.Text == ConstantVars.ITEM_PICKED_TEXT_LIVE)
            {
                //Performs actions to open popup for adding cube dropped, etc
                pickedTime = (int)timerValue;
                Preferences.Set("lastItemPicked", (int)pickedTime);
                String action = "";
                while (String.IsNullOrWhiteSpace(action))
                {
                    action = await DisplayActionSheet("Choose Pick Type:", ConstantVars.CANCEL, null, ConstantVars.PICK_1_TEXT, ConstantVars.PICK_2_TEXT);
                }
                if (!action.ToString().Equals(ConstantVars.CANCEL))
                {
                    if (action.ToString().Equals(ConstantVars.PICK_1_TEXT))
                    {
                        events.Add(new MatchFormat.Data {
                            time = (int)pickedTime, type = (int)MatchFormat.ACTION.pick1
                        });
                    }
                    else if (action.ToString().Equals(ConstantVars.PICK_2_TEXT))
                    {
                        events.Add(new MatchFormat.Data {
                            time = (int)pickedTime, type = (int)MatchFormat.ACTION.pick2
                        });
                    }
                    cubePicked.Image = ConstantVars.ITEM_DROPPED_IMAGE_LIVE;
                    cubePicked.Text  = ConstantVars.ITEM_DROPPED_TEXT_LIVE;
                    CubeDroppedDialog.saveEvents();
                }
            }
            else if (cubePicked.Text == ConstantVars.ITEM_DROPPED_TEXT_LIVE)
            {
                //Performs action/s to open popup for adding cube dropped, etc
                droppedTime = (int)timerValue;
                await Navigation.PushAsync(new CubeDroppedDialog());

                cubePicked.Image = ConstantVars.ITEM_PICKED_IMAGE_LIVE;
                cubePicked.Text  = ConstantVars.ITEM_PICKED_TEXT_LIVE;
            }
        }
 void removeAtIndex(int index)
 {
     NewMatchStart.events.RemoveAt(index);
     eventsList.RemoveAt(index);
     CubeDroppedDialog.saveEvents();
 }