public ChatControl(ChatWindow window, TabItem containingTab, SteamChatHandler chatHandler, ChatUser friend)
        {
            ContainingTab = containingTab;
            Friend = friend;
            ChatterId = friend.Summary.SteamId;

            _window = window;
            _chatHandler = chatHandler;

            Loaded += ChatControl_Loaded;

            InitializeComponent();
        }
        void CheckCreateChatWindow()
        {
            if (ChatWindow != null) return;

            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(() =>
                {
                    ChatWindow = new ChatWindow(ChatEventsManager, ChatHandler, SteamUserHandler);
                    ChatWindow.Closed += ChatWindow_Closed;
                    ChatWindow.Show();
                });
            }
            else
            {
                ChatWindow = new ChatWindow(ChatEventsManager, ChatHandler, SteamUserHandler);
                ChatWindow.Closed += ChatWindow_Closed;
                ChatWindow.Show();
            }
        }
 static void ChatWindow_Closed(object sender, EventArgs e)
 {
     var window = sender as ChatWindow;
     if (window == null) return;
     ChatWindow = null;
 }