void ReleaseDesignerOutlets() { if (ButtonListBook != null) { ButtonListBook.Dispose(); ButtonListBook = null; } if (ButtonSave != null) { ButtonSave.Dispose(); ButtonSave = null; } if (TextAuthor != null) { TextAuthor.Dispose(); TextAuthor = null; } if (TextGenre != null) { TextGenre.Dispose(); TextGenre = null; } if (TextTitle != null) { TextTitle.Dispose(); TextTitle = null; } }
public XNode ToXML() { XElement xPoem = new XElement(Fb2Const.fb2DefaultNamespace + Fb2PoemElementName); if (!string.IsNullOrEmpty(ID)) { xPoem.Add(new XAttribute("id", ID)); } if (!string.IsNullOrEmpty(Lang)) { xPoem.Add(new XAttribute(XNamespace.Xml + "lang", Lang)); } if (Title != null) { xPoem.Add(Title.ToXML()); } foreach (EpigraphItem PoemEpigraph in Epigraphs) { xPoem.Add(PoemEpigraph.ToXML()); } foreach (IFb2TextItem PoemStanza in content) { xPoem.Add(PoemStanza.ToXML()); } foreach (TextAuthorItem TextAuthor in authors) { xPoem.Add(TextAuthor.ToXML()); } if (Date != null) { xPoem.Add(Date.ToXML()); } return(xPoem); }
private void BtnCancel_Click(object sender, RoutedEventArgs e) { TextTitle.Clear(); TextAuthor.Clear(); TextSummary.Clear(); preview = null; manager = null; extension = null; compiler = null; StackResult.Visibility = Visibility.Collapsed; StackOpen.Visibility = Visibility.Visible; }
private void btnSave_Click(object sender, EventArgs e) { Book b = new Book(); if (string.IsNullOrEmpty(TextDescription.Text) || string.IsNullOrEmpty(TextAuthor.Text) || string.IsNullOrEmpty(TextName.Text) || string.IsNullOrEmpty(ComboCategory.Text)) { MetroFramework.MetroMessageBox.Show(this, "All field should be filled up.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); TextName.Focus(); return; } else { if (TextName.Text.Length <= 50) { b.name = TextName.Text; } else { MetroFramework.MetroMessageBox.Show(this, "Book Name Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TextAuthor.Text.Length <= 50) { b.author = TextAuthor.Text; } else { MetroFramework.MetroMessageBox.Show(this, "Author Name Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TextDescription.Text.Length <= 500) { b.description = TextDescription.Text; } else { MetroFramework.MetroMessageBox.Show(this, "Description Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (pictureBox.Image != null) { b.picture = imageToByteArray(pictureBox.Image); //return; } if (!string.IsNullOrEmpty(TextLink.Text)) { b.link = TextLink.Text; } b.category = ComboCategory.Text; b.rating = 0; BookServices.Insert(b); MetroFramework.MetroMessageBox.Show(this, "Added successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Refresh(); TextDescription.Clear(); TextAuthor.Clear(); TextName.Clear(); ComboCategory.SelectedIndex = 0; TextLink.Clear(); pictureBox.Image = null; } }