示例#1
0
        private void SelectPartToExport()
        {
            using (var dlg = new SelectBrickDialog())
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    PartToExport            = dlg.SelectedBrick;
                    PartBrowseTextBox.Value = dlg.SelectedBrick.PartId.ToString();
                    PartNameLabel.Text      = dlg.SelectedBrick.Description;

                    UpdateCanExport();
                }
            }
        }
示例#2
0
        private void PartBrowseTextBox_ValueChanged(object sender, EventArgs e)
        {
            if (PartToExport != null)
            {
                if (PartToExport.PartId.ToString() != PartBrowseTextBox.Value.Trim())
                {
                    PartToExport = null;
                }
                else
                {
                    return;
                }
            }

            ValidateSelectedPartID();
        }
示例#3
0
        private void ValidateSelectedPartID()
        {
            if (!int.TryParse(PartBrowseTextBox.Value, out int partID) &&
                !string.IsNullOrEmpty(PartBrowseTextBox.Value))
            {
                PartNameLabel.Text      = "Invalid part ID";
                PartNameLabel.ForeColor = Color.Red;
            }
            else
            {
                if (!string.IsNullOrEmpty(PartBrowseTextBox.Value))
                {
                    PartToExport = FindPartInfo(partID);
                }
                else
                {
                    PartToExport = null;
                }
                UpdateSelectedPartDescription();
            }

            UpdateCanExport();
        }