private void joinButton_Click(object sender, EventArgs e)
 {
     try
     {
         int tryPort = 0;
         this.isHost    = false;
         cw.callingForm = this;
         if (ipBox.Text == "" || portBox.Text == "" || nicknameBox.Text == "" || !int.TryParse(portBox.Text.ToString(), out tryPort))
         {
             MessageBox.Show("You must enter an IP Address, Port, and Nickname to connect to a server.", "Missing Info");
             return;
         }
         this.Hide();
         cw.Show();
         cw.connectTo(ipBox.Text, int.Parse(portBox.Text), nicknameBox.Text);
     }
     catch (Exception otheree) {
         MessageBox.Show("Error:\n\n" + otheree.ToString(), "Error connecting...");
         cw.Hide();
         this.Show();
     }
 }
Beispiel #2
0
 private void ChatWindow_WindowSeparationEvent(bool isSeparation)
 {
     if (isSeparation)
     {
         //拆分
         if (this.isSeparation)
         {
             return;
         }
         //根据chatNavigationModelsList数量拆分窗口
         for (int i = 0; i < chatNavigationModelsList.Count(); i++)
         {
             chatWindowsList.Add(new ChatWindow(userInfo)
             {
                 DataContext = messageList.Where(o => o.Item1.UserID == chatNavigationModelsList[i].UserID).First().Item1
             });
         }
         foreach (var temp in chatWindowsList)
         {
             var temp2 = temp.DataContext as UserInfoModel;
             temp.chatList.listBox.ItemsSource = messageList.Where(o => o.Item1.UserID == temp2.UserID)?.First().Item2;
             temp.SendMessageEvent            += ChatWindow_SendMessageEvent;
             temp.WindowSeparationEvent       += ChatWindow_WindowSeparationEvent;
             temp.Show();
         }
         chatWindow.Hide();
     }
     else
     {
         //合并
         chatWindow.Show();
         foreach (var temp in chatWindowsList)
         {
             temp.CloseThisWindow();
         }
         chatWindowsList.Clear();
     }
     this.isSeparation = isSeparation;
 }
Beispiel #3
0
        private void LogoutButtonClicked(object sender, EventArgs e)
        {
            foreach (var idc in individualChatDrivers)
            {
                idc.hideWindow();
            }

            individualChatDrivers.Clear();
            chatWindow.getPanelSettings().Visible = false;
            graphicsDriver.ResetSearchField();
            graphicsDriver.ShowFriendsLabel(sender, e);
            loggingOut = true;
            ChatWindowClosed(sender, new FormClosedEventArgs(CloseReason.None));
            chatWindow.Hide();
            writer.WriteLogout(MessageType.logout);
            Thread.Sleep(250);
            restart(this, e);
            loggingOut = false;
            chatWindow.getMessageBox().Clear();
            chatWindow.getStatusTextBox().Visible = false;
            chatWindow.getStatusTextBox().Clear();
            chatWindow.statusTextLbl.Text      = ""; // Clear the status label on logout.
            chatWindow.settingsLabel.BackColor = Color.Transparent;
        }
Beispiel #4
0
 /// <summary>チャット枠を隠す</summary>
 public void HideChatWindow() => ChatWindow.Hide();
Beispiel #5
0
 private void Start()
 {
     Me.Hide();
     Other.Hide();
 }