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); } }
/// <summary> /// User connected /// </summary> /// <param name="un"></param> internal void Connected(string un) { FormMsgScreen frm = this[un]; if (frm == null) { return; } frm.UserConnectionStateChanged(true); }
/// <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); }
/// <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(); }
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(); }
/// <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); }
/// <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); }