private void Initialize() { var buttonTranslate = new Button(); var back = new Button(); ConstructorControls.CreateButton(back, new Rectangle(10, 50, 43, 36), "", this); AddClick(back); ConstructorControls.WorkWithButton(buttonTranslate, new Rectangle(500, 132, 300, 49), "Translate", this); buttonTranslate.Click += (e, a) => { outputTextBox.Text = TranslateText.GetTextTranslation(inputTextBox.Text); }; Controls.Add(buttonTranslate); inputTextBox = new TextBox(); outputTextBox = new TextBox(); ConstructorControls.CreateTextBox(inputTextBox, 107, 204, this, 500, 411); ConstructorControls.CreateTextBox(outputTextBox, 691, 204, this, 500, 411); }
private void Initialize() { var inputTextBox = new TextBox(); var outputTextBox = new TextBox(); var back = new Button(); ConstructorControls.CreateButton(back, new Rectangle(10, 45, 41, 36), "", this); AddClick(back); ConstructorControls.CreateTextBox(inputTextBox, 99, 148, this, 449, 480); ConstructorControls.CreateTextBox(outputTextBox, 559, 148, this, 449, 480); var btn = new Button(); ConstructorControls.WorkWithButton(btn, new Rectangle(0, 0, 200, 50), "сравнить", this); btn.Click += (e, a) => { var text1 = TranslateText.GetTextTranslation(inputTextBox.Text); var text2 = outputTextBox.Text; btn.Text = LevenshteinCalculator.GetCompare(text1.Split(' ') .Select(x => { if (!Char.IsLetter(x, x.Length - 1)) { return(x.Remove(x.Length - 1)); } return(x); }).ToList(), text2.Split(' ') .Select(x => { if (!Char.IsLetter(x, x.Length - 1)) { return(x.Remove(x.Length - 1)); } return(x); }).ToList() ).ToString(); }; }