Beispiel #1
0
        public void TextChanged(object sender, EventArgs e)
        {
            RichTextBox richTextBox = (RichTextBox)sender;

            if (richTextBox.InvokeRequired)
            {
                TextChangedDelegate textChangedDelegate = new TextChangedDelegate(TextChanged);
                richTextBox.Invoke(textChangedDelegate, new object[] { sender, e });
            }
            else
            {
                string text = richTextBox.Text;

                int value;
                int.TryParse(text, out value);

                if (value > 0 && value < 10)
                {
                    Board.SetValue(X, Y, value);
                    richTextBox.ReadOnly    = true;
                    richTextBox.MouseLeave -= new System.EventHandler(this.MouseLeave);

                    Board.FigureStuffOut();

                    //UpdateGui.BeginInvoke(null, null, null, null);
                    UpdateGui.Invoke(null, null);
                }
            }
        }
Beispiel #2
0
        public void SetPossibleValues(object sender, string values)
        {
            RichTextBox richTextBox = (RichTextBox)sender;

            if (richTextBox.InvokeRequired)
            {
                SetValuesDelegate setValuesDelegate = new SetValuesDelegate(SetPossibleValues);
                richTextBox.Invoke(setValuesDelegate, new object[] { sender, values });
            }
            else
            {
                if (richTextBox.Text != values)
                {
                    richTextBox.Text = values;
                    //UpdateGui.BeginInvoke(null, null, null, null);
                    UpdateGui.Invoke(null, null);
                }
            }
        }