public InfoOverlay(RecordedMatch record)
		{
			InitializeComponent();

			DescriptionBox.Text = record.TeamDescription;
			ExpectationsBox.Text = record.TeamExpectations;
		}
Beispiel #2
0
        /// <summary>
        /// Adjusts team info from recorded match
        /// </summary>
        /// <param name="frc"></param>
        /// <param name="data"></param>
        public static void AdjustTeamInfo(FrcEvent frc, RecordedMatch data)
        {
            Team t = frc.LoadTeam(data.TrackedTeamID);

            t.Description  = data.TeamDescription;
            t.Expectations = data.TeamExpectations;
        }
		public SaveOverlay(RecordedMatch record, int globalPos)
		{
			Record = record;
			GlobalPosition = globalPos;
			Record.Winner = AllianceColor.Red;

			InitializeComponent();
		}
Beispiel #4
0
        /// <summary>
        /// Merges match recordings together after deserialization
        /// </summary>
        /// <param name="frc">Event to load data from</param>
        /// <param name="redA">Team A on Red</param>
        /// <param name="redB">Team B on Red</param>
        /// <param name="redC">Team C on Red</param>
        /// <param name="blueA">Team A on Blue</param>
        /// <param name="blueB">Team B on Blue</param>
        /// <param name="blueC">Team C on Blue</param>
        /// <returns></returns>
        public static Match Merge(FrcEvent frc, RecordedMatch redA, RecordedMatch redB, RecordedMatch redC,
                                  RecordedMatch blueA, RecordedMatch blueB, RecordedMatch blueC)
        {
            redA.PostJsonLoading(frc);
            redB.PostJsonLoading(frc);
            redC.PostJsonLoading(frc);
            blueA.PostJsonLoading(frc);
            blueB.PostJsonLoading(frc);
            blueC.PostJsonLoading(frc);

            AllianceGroup <RecordedMatch> red  = new AllianceGroup <RecordedMatch>(redA, redB, redC);
            AllianceGroup <RecordedMatch> blue = new AllianceGroup <RecordedMatch>(blueA, blueB, blueC);

            return(FormMatch(frc, red, blue));
        }
		private void TeamsDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			if (IsSettingUp)
			{
				return;
			}

			int index = TeamsDropDown.SelectedIndex;

			SelectedTeam = PregameMatch.GetTeamByInclusiveIndex(index);
			Color = PregameMatch.GetTeamColor(SelectedTeam);

			Record = new RecordedMatch(Record.MatchNumber, SelectedTeam, Color);

			if (PregameMatch.GetTeamColor(SelectedTeam) == AllianceColor.Blue)
			{
				TeamInfoBtn.Background = new SolidColorBrush(BLUE_ALLIANCE);
			}
			else // red (or indeterminate, but that'll never happen)
			{
				TeamInfoBtn.Background = new SolidColorBrush(RED_ALLIANCE);
			}

			PregameReset();

			UpdateInfoTooltip();
		}
		public void MergeMatchRecords()
		{
			foreach (RecordedMatch record in Records)
			{
				Merging.AdjustTeamInfo(Event, record);
			}

			Match merged = Merging.Merge(Event,
				Records[0], Records[1], Records[2],
				Records[3], Records[4], Records[5]);

			int index = Event.Matches.FindIndex((m) => m.Number == merged.Number);
			if (index != -1)
			{
				Event.Matches[index] = merged;
			}
			else
			{
				Event.Matches.Add(merged);
			}

			ScoutingJson.SaveEvent(Event, SavePath + Event.EventName + 
				ScoutingJson.EventExtension);

			ArchiveRecords(merged.Number);
			Records = new RecordedMatch[6];
			OnPropertyChanged("CanMerge");
		}
		public UpdateViewModel()
		{
			_checkedPaths = new ObservableCollection<UpdateModel>();

			ProcessSelectedCmd = new DoStuffCommand(() => 
				ProcessPath(SelectedPathModel), obj => true);
			MergeMatchCmd = new DoStuffCommand(MergeMatchRecords, obj => true);

			SuperTimer = new DispatcherTimer();
			SuperTimer.Interval = TimeSpan.FromSeconds(2);
			SuperTimer.Tick += SuperTimer_Tick;
			SuperTimer.IsEnabled = true;

			Records = new RecordedMatch[6];

			bool prettifySetup = false;

			RedA = new TeamIndicator(false, -1);
			RedB = new TeamIndicator(false, -1);
			RedC = new TeamIndicator(false, -1);
			BlueA = new TeamIndicator(true, -1);
			BlueB = new TeamIndicator(true, -1);
			BlueC = new TeamIndicator(true, -1);
			
			if (prettifySetup)
			{
				RedA.IsReady = true;
				RedC.IsReady = true;
				BlueB.IsReady = true;
				BlueA.IsReady = true;
			}

			_processAllNewFolders = false;
		}
		/// <summary>
		/// Adjusts team info from recorded match
		/// </summary>
		/// <param name="frc"></param>
		/// <param name="data"></param>
		public static void AdjustTeamInfo(FrcEvent frc, RecordedMatch data)
		{
			Team t = frc.LoadTeam(data.TrackedTeamID);
			t.Description = data.TeamDescription;
			t.Expectations = data.TeamExpectations;
		}
		/// <summary>
		/// Merges match recordings together after deserialization
		/// </summary>
		/// <param name="frc">Event to load data from</param>
		/// <param name="redA">Team A on Red</param>
		/// <param name="redB">Team B on Red</param>
		/// <param name="redC">Team C on Red</param>
		/// <param name="blueA">Team A on Blue</param>
		/// <param name="blueB">Team B on Blue</param>
		/// <param name="blueC">Team C on Blue</param>
		/// <returns></returns>
		public static Match Merge(FrcEvent frc, RecordedMatch redA, RecordedMatch redB, RecordedMatch redC,
			RecordedMatch blueA, RecordedMatch blueB, RecordedMatch blueC)
		{
			redA.PostJsonLoading(frc);
			redB.PostJsonLoading(frc);
			redC.PostJsonLoading(frc);
			blueA.PostJsonLoading(frc);
			blueB.PostJsonLoading(frc);
			blueC.PostJsonLoading(frc);

			AllianceGroup<RecordedMatch> red = new AllianceGroup<RecordedMatch>(redA, redB, redC);
			AllianceGroup<RecordedMatch> blue = new AllianceGroup<RecordedMatch>(blueA, blueB, blueC);

			return FormMatch(frc, red, blue);
		}
		public static void SaveMatchRecord(RecordedMatch rec, string path)
		{
			Initialize(false);

			string contents = JsonConvert.SerializeObject(rec, Formatting.Indented);
			File.WriteAllText(path, contents);
		}