예제 #1
0
        private void TxtbxResult_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            var textBox = (TextBox)sender;

            if (TryParse(textBox.Text, out var index) &&
                index > 0 && index <= _history.Count)
            {
                ApplyResult(_history.GetPattern(index - 1));
                textBox.SelectAll();
            }
            else
            {
                if (_history.Count == 0)
                {
                    MessageBox.Show("아직 생성된 패턴이 없습니다.");
                    textBox.Text = (_history.CurrentIndex).ToString();
                }
                else
                {
                    MessageBox.Show("1부터 " + _history.Count + "까지의 숫자만 입력해주세요!");
                    textBox.Text = (_history.CurrentIndex + 1).ToString();
                }
                return;
            }

            CheckMovable();
        }