Esempio n. 1
0
        public ToolStripMenuItem Initialize(Form ConversationWindow, Connection ThisConnection)
        {
            this.MainMenu = new ToolStripMenuItem(string.Format("{0} v{1}", this.Name, this.VersionInfo.ToString()));
            this.MainMenu.CheckOnClick    = true;
            this.MainMenu.Checked         = true;
            this.MainMenu.CheckedChanged += new EventHandler(MainMenu_CheckedChanged);
            this.ThisConnection           = ThisConnection;
            this.Window = (IConversationWindow)ConversationWindow;

            return(this.MainMenu);
        }
        public ToolStripMenuItem Initialize(Form Window, Connection ThisConnection)
        {
            //SAVE THE INFORMATION WE HAVE BEEN GIVEN FOR LATER USE
            this.Connection = ThisConnection;
            this.frmWindow  = Window;
            this.Window     = (IConversationWindow)Window;

            //CREATE MENU ITEMS
            CreateMenuItems();

            //CHECK TO MAKE SURE THE KEYS EXISTS AND IF THEY DO THEN IMPORT THEM OTHERWISE CREATE THEM THEN IMPORT THEM
            CheckForPersonalKeyPair(this.Window.ConversationID);

            //RETURN THE MENU ITEM WE CREATED
            return(this.MainMenu);
        }
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            bool createdForm = false;
            Form foundForm   = null;

            //LOOP THROUGH AND LOOK FOR A WINDOW WITH THE CORRECT MESSAGE ID
            foreach (Form tmpForm in OpenWindows)
            {
                //IF WE FIND ONE REMEMBER WHICH ONE IT IS AND MOVE ON
                if ((string)tmpForm.Tag == this.ConversationID)
                {
                    foundForm = tmpForm;
                    break;
                }
            }

            //IF WE DO NOT FIND ONE THEN WE NEED TO CREATE ONE
            if (foundForm == null)
            {
                createdForm = true;
                CreateWindow(this.Sender, this.ConversationID, ref foundForm, WindowType.Conversation);
            }

            //SHOW THE FORM IF THIS IS THE FIRST TIME IT WAS CREATED
            if (createdForm)
            {
                foundForm.Invoke((MethodInvoker) delegate
                {
                    foundForm.Show();
                    ((IConversationWindow)foundForm).ClearMessages();
                });
                new Message_GetConversation()
                {
                    ConversationID = this.ConversationID
                }.Send(ThisConnection);
                return;
            }

            //USE THE INTERFACE TO PASS THE MESSAGE TO THE WINDOW WHICH WE FOUND
            IConversationWindow tmpConversation = (IConversationWindow)foundForm;

            foundForm.Invoke((MethodInvoker) delegate { tmpConversation.ReceiveMessage(this); });
        }