Exemple #1
0
 public static MessengerClientMain GetMessengerClient()
 {
     if (messengerClient == null)
     {
         messengerClient = new MessengerClientMain();
     }
     return(messengerClient);
 }
Exemple #2
0
 public void ShowDialog(MessengerClientMain owner, String chatName, RequestChatMessage requestChatMessage)
 {
     UI.FormChat form = new UI.FormChat(owner, chatName);
     if (requestChatMessage != null)
     {
         form.messageList.Add(requestChatMessage);
     }
     chatWindowList.Add(form);
     form.ShowDialog();
 }
Exemple #3
0
        //=====================================================================================================


        //Messenger client main
        //-----------------------------------------------------------------------------------------------------
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            messengerClient = new MessengerClientMain();
            //messengerClient = client;
            //client.StartClient();
            //NetworkPacket netPacket = new NetworkPacket(ClientSocket, new RequestChatMessage().GetMaximumPacketSize());
            // Thread receiveThread = new Thread(client.ReceiveThreadWorker);
            // receiveThread.Start();
            //Application.Run(client.form)
            //Application.Run(GetMessengerClient().form);
        }
Exemple #4
0
        public void AddNewChatWindow(MessengerClientMain owner, String chatName, RequestChatMessage requestChatMessage = null)
        {
            bool isChatWindowOpen = false;

            foreach (UI.FormChat chat in chatWindowList)
            {
                if (chat.chatName == chatName)
                {
                    isChatWindowOpen = true;
                    break;
                }
            }
            if (!isChatWindowOpen)
            {
                Thread thread = new Thread(() => ShowDialog(owner, chatName, requestChatMessage));
                thread.Name = "thread" + addedWindowsThreadList.Count;
                thread.Start();
                addedWindowsThreadList.Add(thread);
            }
        }