public void TeamsPath_Changed(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "FilePath")
            {
                return;                 // none of my business
            }

            if (File.Exists(FilePath))
            {
                if (Util.IsPathOnRemovableDevice(FilePath))
                {
                    PathBrush   = new SolidColorBrush(Colors.Orange);
                    PathTooltip = "File is on removable device. Local " +
                                  "storage or a cloud folder is ideal.";
                }
                else
                {
                    PathBrush   = new SolidColorBrush(Colors.Black);
                    PathTooltip = FilePath;
                }

                Teams        = ScoutingJson.ParseTeamsList(FilePath);
                SelectedTeam = Teams.FirstOrDefault();
            }
            else
            {
                PathBrush   = new SolidColorBrush(Colors.Red);
                PathTooltip = "File does not exist.";
            }
        }
        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();
        }
        private void TeamsPathBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!hasLoaded || !File.Exists(TeamsPathBox.Text))
            {
                return;
            }

            AppSettings.TeamsPath = TeamsPathBox.Text;

            Teams = ScoutingJson.ParseTeamsList(TeamsPathBox.Text);
            if (Event != null)
            {
                Event.PostJsonLoading(Teams);
            }

            UpdateTeamsPathBox();
        }
        public void LoadTeams(string filepath)
        {
            if (!File.Exists(filepath))
            {
                return;
            }

            TeamsList temp = ScoutingJson.ParseTeamsList(filepath);

            if (temp != null)
            {
                AppSettings.TeamsFile = filepath;

                if (Event != null)
                {
                    Event.PostJsonLoading(temp);
                    UpdateRatingViewsMatch(SelectedMatch);
                }

                Teams = temp;
            }

            UpdateTextBoxInfo();
        }
Пример #5
0
        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();
        }