public MainWindow() { ModalWindow modalWindow = new ModalWindow(); modalWindow.ShowDialog(); _currentСlient = ModalWindow._currentСlient; if (_currentСlient == null) { System.Windows.Application.Current.Shutdown(); } else { InitializeComponent(); _common = new BLL.Common(); Conversations = new ObservableCollection <ConversationModel>(); Messages = new ObservableCollection <MessageEventArgsModel>(); _clientTcp = new TcpClientConnection(); _clientTcp.OnMessage += SetMessage; _clientTcp.SentStartMessage += SentStartMessage; UpdateСlientData(); _clientTcp.StartTcpClient(_portNumber); } }