/// <summary>
        /// Constructor.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            dispatcher = Dispatcher.CurrentDispatcher;

            // Ignore unhandled exceptions
            Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcherUnhandledException;
            Application.Current.DispatcherUnhandledException += CurrentDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            TaskScheduler.UnobservedTaskException += TaskSchedulerUnobservedTaskException;

            // Listen to chat events
            chats = new Chats(dispatcher);
            chats.ConnectionFailed += ConnectionFailedHandler;
            chats.Connected += ConnectedHandler;
            chats.UserConnected += UserConnectedHandler;
            chats.Disconnected += DisconnectedHandler;
            chats.UserDisconnected += UserDisconnectedHandler;
            chats.Broadcasted += BroadcastedHandler;
            chats.UserBroadcasted += UserBroadcastedHandler;
            chats.Whispered += WhisperedHandler;
            chats.UserWhispered += UserWhisperedHandler;

            UpdateTitle();
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            dispatcher = Dispatcher.CurrentDispatcher;

            // Ignore unhandled exceptions
            Dispatcher.CurrentDispatcher.UnhandledException  += CurrentDispatcherUnhandledException;
            Application.Current.DispatcherUnhandledException += CurrentDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomainUnhandledException;
            TaskScheduler.UnobservedTaskException            += TaskSchedulerUnobservedTaskException;

            // Listen to chat events
            chats = new Chats(dispatcher);
            chats.ConnectionFailed += ConnectionFailedHandler;
            chats.Connected        += ConnectedHandler;
            chats.UserConnected    += UserConnectedHandler;
            chats.Disconnected     += DisconnectedHandler;
            chats.UserDisconnected += UserDisconnectedHandler;
            chats.Broadcasted      += BroadcastedHandler;
            chats.UserBroadcasted  += UserBroadcastedHandler;
            chats.Whispered        += WhisperedHandler;
            chats.UserWhispered    += UserWhisperedHandler;

            UpdateTitle();
        }