/// <summary> /// Save window state when the form is closing. /// </summary> private void CIXMessageEditor_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.Cancel || DialogResult == DialogResult.None) { if (!CheckForClosing()) { e.Cancel = true; return; } } MessageEditorCollection.Remove(this); this.SaveToSettings(); IsClosed = true; }
/// <summary> /// Display the message editor window. /// </summary> private void CIXMessageEditor_Load(object sender, EventArgs e) { bool isReply = _message.CommentID > 0; string forumName = string.Empty; string topicName = string.Empty; Editor = nmMessage; // Restore the form width, height and state from the last time it // was invoked. this.RestoreFromSettings(); Folder folder = _message.Topic; if (folder != null) { Folder parentFolder = folder.ParentFolder; if (parentFolder != null) { forumName = parentFolder.Name; } topicName = folder.Name; } if (isReply && folder != null) { string replyName = string.Empty; isReply = false; CIXMessage parentMessage = folder.Messages.MessageByID(_message.CommentID); if (parentMessage != null) { replyName = parentMessage.Author; Mugshot mugshot = Mugshot.MugshotForUser(replyName, true); nmReplyImage.Image = mugshot.RealImage; nmReplyUsername.Text = string.Format(Resources.ReplyEditorTitle, replyName); nmReplyText.Text = parentMessage.Body; // Make the full body available as a tooltip. nmBodyTooltip.SetToolTip(nmReplyText, parentMessage.Body); isReply = true; } Text = string.Format(Resources.ReplyTitle, replyName, forumName, topicName); } else { Text = string.Format(Resources.NewMessageTitle, forumName, topicName); } if (!isReply) { nmReplyPanel.Visible = false; nmMessage.Top -= nmReplyPanel.Height; nmMessage.Height += nmReplyPanel.Height; } // Load signature list ReloadSignaturesList(nmSignatureList); // Add any existing message with signature. LoadMessage(forumName, _message.Body); nmMessage.Font = UI.GetFont(UI.Forums.font, UI.Forums.fontsize); _wasPending = _message.IsPending; _message.PostPending = false; MessageEditorCollection.Add(this); EnableSendButton(); }