Ejemplo n.º 1
0
        // On button "OK" click
        private void okButton_Click(object sender, EventArgs e)
        {
            if (!Glyph.CheckIfEveryRowColumnHasValue(glyphEditor.GlyphData))
            {
                MessageBox.Show("A glyph must have at least one white cell in every row and column.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (Glyph.CheckIfRotationInvariant(glyphEditor.GlyphData))
            {
                MessageBox.Show("The glyph is rotation invariant (it looks the same if rotated), so its rotaton will not be recognized.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if ((glyphDataChecker != null) && (!glyphDataChecker(glyphEditor.GlyphData)))
            {
                // return since external glyph data checker does not like the glyph
                return;
            }

            glyph.Name     = nameBox.Text.Trim( );
            glyph.Data     = glyphEditor.GlyphData;
            glyph.UserData = visualizationData;

            DialogResult = DialogResult.OK;
            Close( );
        }