private void Window_Loaded(object sender, RoutedEventArgs e) { hasLoaded = true; LoadSettings(); if (Directory.Exists(EventPathBox.Text)) { Event = ScoutingJson.ParseFrcEvent(EventPathBox.Text); } if (Directory.Exists(TeamsPathBox.Text)) { Teams = ScoutingJson.ParseTeamsList(TeamsPathBox.Text); if (Event != null) { Event.PostJsonLoading(Teams); } } SortDataGrid.ItemsSource = DataGridSummaries; UpdateEventPathBox(); UpdateTeamsPathBox(); RefreshDrives(); }
public void LoadEventFile(string file) { if (!File.Exists(file)) { Event = null; } else { Event = ScoutingJson.ParseFrcEvent(file); } EventPath_Color = GetPathBrush(); EventPath_Tooltip = GetPathTooltip(); DoSendData(); }
public bool IsPathValid() { if (!File.Exists(EventPath)) { return(false); } FrcEvent frc = ScoutingJson.ParseFrcEvent(EventPath); if (frc == null) { return(false); } return(frc.EventName != null && frc.EventName != ""); }
private void EventPathBox_TextChanged(object sender, TextChangedEventArgs e) { if (!hasLoaded || !File.Exists(EventPathBox.Text)) { return; } AppSettings.EventPath = EventPathBox.Text; Event = ScoutingJson.ParseFrcEvent(EventPathBox.Text); if (Teams != null) { Event.PostJsonLoading(Teams); } UpdateEventPathBox(); }
public void Calculate() { FrcEvent before = Event; try { Event = ScoutingJson.ParseFrcEvent(EventPath + "\\" + Event.EventName + ScoutingJson.EventExtension); FrcAnalysis.Event = Event; } catch (Exception e) { Util.DebugLog(LogLevel.Error, "ANALYSIS", "Could not load Event:\n\t" + e.Message); Event = before; } FrcAnalysis.Calculate(); SaveAnalysis(); }
public void LoadEvent(string filepath) { if (!File.Exists(filepath)) { return; } FrcEvent temp = ScoutingJson.ParseFrcEvent(filepath); if (temp != null) { Event = temp; AppSettings.EventFile = filepath; if (Teams != null) { Event.PostJsonLoading(Teams); } SelectedMatch = Event.Matches.FirstOrDefault(); } UpdateTextBoxInfo(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { var spsd = new StartupPathSelectionDialog(); bool?res = spsd.ShowDialog(); if (res != true) { Application.Current.Shutdown(); return; } Event = ScoutingJson.ParseFrcEvent(spsd.EventPath); Teams = ScoutingJson.ParseTeamsList(spsd.TeamsPath); EventPath = Util.GetFolderPath(spsd.EventPath); if (Event != null && Teams != null) { Event.PostJsonLoading(Teams); } hasLoaded = true; LoadCreateAnalysis(); MatchSelectionList.ItemsSource = Event.Matches; }
public void DoContextualLoading() { if (CantTakeNo) { OKBtn.IsEnabled = File.Exists(TeamsPathBox.Text) && File.Exists(EventPathBox.Text); } bool matchIDReady = true; if (File.Exists(EventPathBox.Text)) { FrcEvent frc = ScoutingJson.ParseFrcEvent(EventPathBox.Text); if (frc.IsCorrectlyLoaded()) { Settings.Frc = frc; EventPathBox.Foreground = new SolidColorBrush(Colors.Black); EventPathBox.ToolTip = null; } else { EventPathBox.Foreground = new SolidColorBrush(Colors.Red); EventPathBox.ToolTip = "File is invalid or corrupted."; matchIDReady = false; } } else { EventPathBox.Foreground = new SolidColorBrush(Colors.Red); EventPathBox.ToolTip = "File does not exist."; matchIDReady = false; } if (Settings.Frc != null && File.Exists(TeamsPathBox.Text)) { TeamsList teams = ScoutingJson.ParseTeamsList(TeamsPathBox.Text); if (teams != null && teams.IsCorrectlyLoaded()) { Settings.Frc.PostJsonLoading(teams); MatchID = 1; TeamsPathBox.Foreground = new SolidColorBrush(Colors.Black); TeamsPathBox.ToolTip = null; } else { TeamsPathBox.Foreground = new SolidColorBrush(Colors.Red); TeamsPathBox.ToolTip = "File is invalid or corrupted."; matchIDReady = false; } } else { TeamsPathBox.Foreground = new SolidColorBrush(Colors.Red); TeamsPathBox.ToolTip = "File does not exist."; matchIDReady = false; } MatchIDDownBtn.IsEnabled = matchIDReady; MatchIDUpBtn.IsEnabled = matchIDReady; UpdateTeamPreviews(); }