コード例 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            Text = $@"{AppName} {version.Major}.{version.Minor}.{version.Revision}";

            _origTextBackColor = guidTextBox.BackColor;
            _origTextForeColor = guidTextBox.ForeColor;

            _guidFormatterFactory = new GuidFormatterFactory(this);

            _guidFormatter = _guidFormatterFactory.CreateFor(Guid.NewGuid());
            UpdateGuidText();
        }
コード例 #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();
            }
        }
コード例 #3
0
 private void combButton_Click(object sender, EventArgs e)
 {
     _guidFormatter = _guidFormatterFactory.CreateFor(_guidFormatter.Guid.Comb());
     UpdateGuidText();
 }
コード例 #4
0
 private void emptyGuidButton_Click(object sender, EventArgs e)
 {
     _guidFormatter = _guidFormatterFactory.CreateFor(Guid.Empty);
     UpdateGuidText();
 }
コード例 #5
0
 private void generateNewGuidButton_Click(object sender, EventArgs e)
 {
     _guidFormatter = _guidFormatterFactory.CreateFor(Guid.NewGuid());
     UpdateGuidText();
 }