示例#1
0
        private void MessagingForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            FormMsgScreen frm = sender as FormMsgScreen;

            if (frm != null)
            {
                frm.FormClosing -= new System.Windows.Forms.FormClosingEventHandler(MessagingForm_FormClosing);
                _Forms.Remove(frm);
            }
        }
示例#2
0
        /// <summary>
        /// User connected
        /// </summary>
        /// <param name="un"></param>
        internal void Connected(string un)
        {
            FormMsgScreen frm = this[un];

            if (frm == null)
            {
                return;
            }

            frm.UserConnectionStateChanged(true);
        }
示例#3
0
            /// <summary>
            /// Initialize a new instance of this class
            /// </summary>
            /// <param name="form"></param>
            public FormWritingStateManager(FormMsgScreen form)
            {
                _Form = form;

                timer = new System.Timers.Timer
                {
                    Interval = 300
                };
                timer.Elapsed            += new System.Timers.ElapsedEventHandler(timer_Elapsed);
                _Form.rtfMessage.KeyDown += new KeyEventHandler(rtfMessage_KeyDown);
            }
示例#4
0
        /// <summary>
        /// Begin messaging with the given user
        /// </summary>
        /// <param name="un"></param>
        internal void Begin(string un)
        {
            FormMsgScreen form = this[un];

            if (form == null)
            {
                form              = new FormMsgScreen(this, un);
                form.FormClosing += new System.Windows.Forms.FormClosingEventHandler(MessagingForm_FormClosing);
                _Forms.Add(form);
            }

            form.Show();
        }
示例#5
0
        private void OnClientUpdatePicture(NetCommand command)
        {
            command.Response = new NetResponse(true);
            ParameterString uname = command.Parameters["un"]
                                    as ParameterString;

            if (uname == null)
            {
                return;
            }

            FormMsgScreen form = _Manager[uname.Value];

            if (form == null)
            {
                return;
            }

            form.InvokeRefreshImage();
        }
示例#6
0
        /// <summary>
        /// Append received message into the target user form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InvokeSendMessage(object sender, EventArgs e)
        {
            var command = sender as NetCommand;

            if (command == null)
            {
                return;
            }

            var fr  = command.Parameters["fr"] as ParameterString;
            var msg = command.Parameters["msg"] as ParameterString;

            var form = this[fr.Value];

            if (form == null)
            {
                form              = new FormMsgScreen(this, fr.Value);
                form.FormClosing += new System.Windows.Forms.FormClosingEventHandler(MessagingForm_FormClosing);
                _Forms.Add(form);
            }
            form.Show();
            form.AddMessage(msg.Value);
        }
示例#7
0
 /// <summary>
 /// Initialize a new instance of this class
 /// </summary>
 /// <param name="form"></param>
 public MessageManager(FormMsgScreen form)
 {
     _Form       = form;
     _SenderFont = new Font(TextBox.Font, FontStyle.Bold);
 }