public MainWindow()
        {
            InitializeComponent();
            AddDoubleClickEventStyle(lbUsers, dGSerials_MouseDoubleClick);
            ResourceDictionary myResourceDictionary = new ResourceDictionary();

            myResourceDictionary.Source = new Uri("Styles.xaml", UriKind.Relative);
            Application.Current.Resources.MergedDictionaries.Add(myResourceDictionary);

            try
            {
                LogIn dialog = new LogIn();
                if (dialog.ShowDialog() == true)
                {
                    client = new ChatClient(dialog.username.Text, "127.0.0.1", 11000, this);
                    client.Connect();

                    AddLobbyTab();
                    lbUsers.ItemsSource    = client.users;
                    client.PrivateMessage += PrivateMessageHandler;
                    client.ReciveMessageAsync();
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }

            CommandBinding binding = new CommandBinding(Commands.SendMessageCommand);

            binding.CanExecute += binding_CanExecute;
            binding.Executed   += binding_Executed;
            this.CommandBindings.Add(binding);
            btnSend.Command = Commands.SendMessageCommand;
        }