public MainWindow() { InitializeComponent(); Grid MainGrid = Content as Grid; restore = MainGrid.FindName("Restore") as Canvas; maximize = MainGrid.FindName("Maximize") as Canvas; minimize = MainGrid.FindName("Minimize") as Canvas; tab_ctrl = MainGrid.FindName("tabControl") as TabControl; tcp_server = MainGrid.FindName("TCPServer") as TabItem; tcp_client = MainGrid.FindName("TCPClient") as TabItem; udp_server = MainGrid.FindName("UDPServer") as TabItem; udp_client = MainGrid.FindName("UDPClient") as TabItem; restore.Visibility = Visibility.Collapsed; Background = default_brush; tcp_server.Background = brush_color1; tcp_client.Background = brush_color2; udp_server.Background = brush_color3; udp_client.Background = brush_color4; m_TcpServer = new TcpServerDebug(MainGrid); m_TcpClient = new TcpClientDebug(MainGrid); m_UdpServer = new UdpServerDebug(MainGrid); m_UdpClient = new UdpClientDebug(MainGrid); }