void OnEditMailFormClosed(object sender, FormClosedEventArgs e) { frmEditMail form = sender as frmEditMail; if (form != null) { form.SaveMessage -= OnEditMailFormSaveMessage; } }
void OnEditMailFormLoad(object sender, EventArgs e) { frmEditMail form = sender as frmEditMail; if (form != null) { form.SaveMessage += OnEditMailFormSaveMessage; } }
void EditMessage(Message message, bool newMessage, string caption) { Cursor.Current = Cursors.WaitCursor; frmEditMail form = new frmEditMail(message, newMessage, caption); form.Load += OnEditMailFormLoad; form.FormClosed += OnEditMailFormClosed; form.Location = new Point(OwnerForm.Left + (OwnerForm.Width - form.Width) / 2, OwnerForm.Top + (OwnerForm.Height - form.Height) / 2); form.Show(); Cursor.Current = Cursors.Default; }
void OnEditMailFormSaveMessage(object sender, EventArgs e) { frmEditMail form = sender as frmEditMail; if (form == null) { return; } if (!DataHelper.Messages.Contains(form.SourceMessage)) { DataHelper.Messages.Add(form.SourceMessage); } RaiseUpdateTreeViewMessages(); }