void InitServerCommandView() { CommandView commandView; commandView = new CommandView(); //grid_second.Children.Add(commandView); }
public CommandView() { current = this; this.Visibility = Visibility.Hidden; textBlock_server_name = new TextBlock(); textBlock_server_name.Margin = new Thickness(5, 5, 95, 5); textBlock_server_name.VerticalAlignment = VerticalAlignment.Top; this.Children.Add(textBlock_server_name); TextBlock command = new TextBlock(); command.Text = "Command :"; command.Margin = new Thickness(5, 35, 5, 5); command.Width = 70; command.VerticalAlignment = VerticalAlignment.Top; command.HorizontalAlignment = HorizontalAlignment.Left; this.Children.Add(command); textBox_command = new TextBox(); textBox_command.Margin = new Thickness(80, 35, 95, 5); textBox_command.VerticalAlignment = VerticalAlignment.Top; textBox_command.HorizontalAlignment = HorizontalAlignment.Stretch; textBox_command.KeyDown += TextBox_command_KeyDown; textBox_command.FontFamily = new FontFamily("Consolas"); this.Children.Add(textBox_command); Button btn_send = new Button(); btn_send.Background = Brushes.White; btn_send.Content = "Send(or Run)"; btn_send.Margin = new Thickness(5, 35, 5, 5); btn_send.VerticalAlignment = VerticalAlignment.Top; btn_send.HorizontalAlignment = HorizontalAlignment.Right; btn_send.Width = 85; btn_send.Click += Button_send_Click; this.Children.Add(btn_send); textBox_result = new TextBox(); textBox_result.IsReadOnly = true; textBox_result.Margin = new Thickness(5, 60, 5, 5); textBox_result.TextWrapping = TextWrapping.Wrap; textBox_result.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; textBox_result.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; textBox_result.FontFamily = new FontFamily("Consolas"); textBox_result.TextChanged += TextBox_result_TextChanged; this.Children.Add(textBox_result); //timer_read = new DispatcherTimer(); //timer_read.Interval = TimeSpan.FromSeconds(0.001); //timer_read.Tick += Timer_read_Tick; }
public void Refresh(ServerInfo si) { if (CommandView.current == null) { return; } CommandView.clear(); CommandView.current.textBlock_server_name.Text = si.name + " / " + si.ip /*+ " / " + si.id + " / " + si.password*/; if (CommandView.current == null) { return; } CommandView.current.textBox_command.Focus(); }