Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum TextBoxMode
- {
- SingleLine,
- MultiLine
- }
- TextBox CreateTextBox(string label, TextBoxMode textBoxMode)
- {
- var lbl = new Label();
- lbl.Content = $"{label}:";
- lbl.Dump();
- var textBox = new TextBox();
- if (textBoxMode == TextBoxMode.MultiLine)
- {
- textBox.AcceptsReturn = true;
- textBox.AcceptsTab = true;
- textBox.Height = 150;
- textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
- textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
- }
- textBox.FontFamily = new System.Windows.Media.FontFamily("Courier New");
- textBox.Dump();
- return textBox;
- }
- Button CreateButton(string caption)
- {
- var button = new Button();
- button.Content = caption;
- button.Width = 100;
- button.Margin = new System.Windows.Thickness(5);
- button.Dump();
- return button;
- }
- void Main()
- {
- var textName = CreateTextBox("Name", TextBoxMode.SingleLine);
- var textInput = CreateTextBox("Input", TextBoxMode.MultiLine);
- var btnGo = CreateButton("Go");
- var textOutput = CreateTextBox("Output", TextBoxMode.MultiLine);
- btnGo.Click += (s, e) => textOutput.Text = Process(textInput.Text);
- }
- string Process(string input)
- {
- return input;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement