private void buttonSelect_Click(object i_Sender, EventArgs i_Args) { if (treeViewCategories.SelectedNode != null) { SelectedPost = treeViewCategories.SelectedNode.Tag as CannedPost; if (SelectedPost != null) { this.DialogResult = DialogResult.OK; this.Close(); } } }
private void buttonSave_Click(object i_Sender, EventArgs i_Args) { if (CannedPost == null) { CannedPost = new CannedPost(); } CannedPost.Name = this.textBoxName.Text; CannedPost.Categories.Clear(); foreach (string category in textBoxCategories.Text.Split(',')) { string trimmedCategory = category.Trim(); if (!string.IsNullOrEmpty(trimmedCategory)) { CannedPost.Categories.Add(trimmedCategory.Trim()); } } CannedPost.StatusTextTemplate = Template.Parse(textBoxTemplate.Text); this.DialogResult = DialogResult.OK; this.Close(); }
private void showEditPost(CannedPost i_Post) { FormEditCannedPost editForm = new FormEditCannedPost(); editForm.CannedPost = i_Post; editForm.ShowDialog(); if (editForm.DialogResult == DialogResult.OK) { XmlSerializer serializer = new XmlSerializer(typeof(CannedPost)); using (TextWriter writer = new StreamWriter(Path.Combine(this.CannedPostsDirectoryPath, editForm.CannedPost.Name + ".post.xml"))) { serializer.Serialize(writer, editForm.CannedPost); } } refreshPostList(); }