public frmEmoticons(frmConversation Owner, List <Dictionary <string, string> > Emoticons) { InitializeComponent(); this.Owner = Owner; //LOOP THROUGH EACH EMOTICON IN THE LIST WE WERE GIVEN AND ADD THEM TO OUR DISPLAY foreach (Dictionary <string, string> ImageFile in Emoticons) { PictureBox tmpPic = new PictureBox(); //SETUP THE PICTURE BOXES PROPERTIES BEFORE ADDING IT TO THE DISPLAY tmpPic.ImageLocation = Path.Combine(Application.StartupPath, "Images\\Emoticons\\" + ImageFile["image"]); tmpPic.Size = new Size(28, 28); tmpPic.SizeMode = PictureBoxSizeMode.StretchImage; tmpPic.Tag = ImageFile["send"]; tmpPic.Visible = true; //SETUP EVENT HANDLERS tmpPic.Click += new EventHandler(tmpPic_Click); tmpPic.MouseEnter += new EventHandler(tmpPic_MouseEnter); tmpPic.MouseLeave += new EventHandler(tmpPic_MouseLeave); //ADD THE CONTROL TO THE FLOW LAYOUT PANEL panelPicHolder.Controls.Add(tmpPic); } }
private void GetConversation(string ConversationID) { bool FoundWindow = false; frmConversation tmpWindow = null; //DOUBLE CHECK TO MAKE SURE THE WINDOW IS NOT ALREADY OPEN foreach (Form openWindow in Application.OpenForms) { try { //TRY TO CONVERT EVERY WINDOW INTO A CONVERSATION WINDOW tmpWindow = (frmConversation)openWindow; //CHECK THE TAG TO SEE IF THIS IS THE CONVERSATION THE USER IS LOOKING FOR if ((string)tmpWindow.Tag == ConversationID) { FoundWindow = true; } } catch { //THIS IS TO CATCH THE OTHER WINDOWS WHICH ARE NOT OF TYPE FRMCONVERSATION } } //IF THE WINDOW WAS NOT FOUND THEN ASK THE SERVER FOR THE CONVERSATION if (!FoundWindow) { frmConversation tmpConversation = new frmConversation(ThisConnection, ConversationID); tmpConversation.Show(); new Message_GetConversation() { ConversationID = ConversationID }.Send(ThisConnection); } else { //THE WINDOW WAS FOUND SO WE NEED TO JUST BRING IT TO THE FRONT AND SHOW IT tmpWindow.Show(); tmpWindow.BringToFront(); } }