Exemplo n.º 1
0
        void HandleClickRow(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            var col = tblTags.Columns[e.ColumnIndex];

            bool deleteClicked = col == tblcolBibDelete;
            bool numberClicked = col == tblcolBibNumber;
            bool colorClicked  = col == tblcolShirtColor || col == tblcolShoeColor || col == tblcolShortsColor;

            TaggedPerson personClicked = (TaggedPerson)tblTags.Rows[e.RowIndex].DataBoundItem;

            if (deleteClicked)
            {
                Model.CurrentPhoto.DeleteTaggedPerson(personClicked);
            }
            if (numberClicked)
            {
                Model.CurrentPhoto.AskToTagBibNumber(MainWindow.Singleton.MainPictureBox, personClicked);
            }
            if (colorClicked)
            {
                Model.CurrentPhoto.AskForColorClassificationsOfPerson(personClicked);
            }

            RequestRedrawGraphics();
        }
Exemplo n.º 2
0
        void BackgroundForSelectedColors(object sender, DataGridViewCellFormattingEventArgs e)
        {
            try
            {
                TaggedPerson person = (TaggedPerson)tblTags.Rows[e.RowIndex].DataBoundItem;
                string       col    = tblTags.Columns[e.ColumnIndex].Name;
                switch (col)
                {
                case "tblcolShoeColor":
                    e.CellStyle.BackColor = e.CellStyle.SelectionBackColor = person.ShoeColor.IsEmpty ? Color.White : person.ShoeColor;
                    e.CellStyle.ForeColor = e.CellStyle.SelectionForeColor = person.ShoeColor.IsEmpty ? SystemColors.ControlText : Utils.LabelForeColorForBackColor(person.ShoeColor);
                    break;

                case "tblcolShortsColor":
                    e.CellStyle.BackColor = e.CellStyle.SelectionBackColor = person.ShortsColor.IsEmpty ? Color.White : person.ShortsColor;
                    e.CellStyle.ForeColor = e.CellStyle.SelectionForeColor = person.ShortsColor.IsEmpty ? SystemColors.ControlText : Utils.LabelForeColorForBackColor(person.ShortsColor);
                    break;

                case "tblcolShirtColor":
                    e.CellStyle.BackColor = e.CellStyle.SelectionBackColor = person.ShirtColor.IsEmpty ? Color.White : person.ShirtColor;
                    e.CellStyle.ForeColor = e.CellStyle.SelectionForeColor = person.ShirtColor.IsEmpty ? SystemColors.ControlText : Utils.LabelForeColorForBackColor(person.ShirtColor);
                    break;

                case "tblcolHatColor":
                    e.CellStyle.BackColor = e.CellStyle.SelectionBackColor = person.HatColor.IsEmpty ? Color.White : person.HatColor;
                    e.CellStyle.ForeColor = e.CellStyle.SelectionForeColor = person.HatColor.IsEmpty ? SystemColors.ControlText : Utils.LabelForeColorForBackColor(person.HatColor);
                    break;
                }
            }
            catch
            {
                // Data out of range error
            }
        }
Exemplo n.º 3
0
 public BibNumberDialog(TaggedPerson person)
 {
     Person = person;
     InitializeComponent();
     CropBibPhoto();
     BindEvents();
 }
Exemplo n.º 4
0
 public PersonBaseClassificationDialog(TaggedPerson person)
 {
     InitializeComponent();
     Person = person;
     CropPersonPhoto();
     BindDataToControls();
     // Resize to left
     Height = 900;
 }
Exemplo n.º 5
0
        void UpdateSelectedRunnerRow()
        {
            TaggedPerson runner = Model.CurrentPhoto.SelectedRunner;
            int          rowIdx = Model.CurrentPhoto.TaggedRunners.IndexOf(runner);

            tblTags.ClearSelection();
            if (rowIdx == -1)
            {
                return;
            }
            tblTags.Rows[rowIdx].Selected = true;
        }
Exemplo n.º 6
0
        public void RequestUpdateSelectedRunner()
        {
            TaggedPerson person = Model.CurrentPhoto.SelectedRunner;

            if (person != null)
            {
                mnuRunnerStaticNumberValue.Text = $"Selected Runner: {person.BibNumber}";
                UpdateSelectedRunnerRow();
                RequestRedrawGraphics();
                if (Model.CurrentPhoto.TaggingStep == StepType.SelectFaceRegion)
                {
                    lblInstructions.Text = StepType.SelectFaceRegion.ToInstructionString().Replace("{#}", person.BibNumber);
                    lblInstructions.Invalidate();
                }
            }
        }
Exemplo n.º 7
0
        public PersonColorClassificationsDialog(TaggedPerson person)
        {
            InitializeComponent();
            Person = person;
            CropPersonPhoto();

            // If not wearing a hat, disable!
            if (!Person.IsWearingHat)
            {
                btnClearHatColor.Enabled     = pnlHatColor.Enabled = rdoSettingHatColor.Enabled = false;
                rdoSettingShirtColor.Checked = _isSettingShirtColor = true;
                _isSettingHatColor           = false;
            }

            BindDataToControls();
            BindEvents();
            UpdateInstructionsLabel();
            Height = 900;
        }