示例#1
0
        private void UpdateGuidText()
        {
            if (_guidFormatter.Guid.IsEmpty())
            {
                uppercaseCheckBox.Checked = false;
                uppercaseCheckBox.Enabled = false;
                combButton.Enabled        = false;
            }
            else
            {
                uppercaseCheckBox.Enabled = true;
                combButton.Enabled        = true;
            }

            guidTextBox.Text = _guidFormatter.GetAsFormatted();

            UpdateTextLengthLabel();
        }
示例#2
0
        private void guidTextBox_TextChanged(object sender, EventArgs e)
        {
            var input = guidTextBox.Text
                        .Replace("{", string.Empty)
                        .Replace("}", string.Empty);

            if (!Guid.TryParse(input, out var guid))
            {
                guidTextBox.BackColor = Color.Red;
                guidTextBox.ForeColor = Color.White;

                UpdateTextLengthLabel();
            }
            else
            {
                guidTextBox.BackColor = _origTextBackColor;
                guidTextBox.ForeColor = _origTextForeColor;

                _guidFormatter = _guidFormatterFactory.CreateFor(guid);

                guidTextBox.Text = _guidFormatter.GetAsFormatted();
            }
        }