/// <summary> /// opens the singelton instance of addbook form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddBook_Click(object sender, EventArgs e) { AddBooks addBooks = AddBooks.Instance(); Utils.SwitchBetweenWindows(this, addBooks); // addBooks.ShowDialog(); }
//implenting singelton pattern to this class public static AddBooks Instance(Book Book = null) { if (instance == null) { instance = new AddBooks(); } instance.SetAsNewWindow(Book); return(instance); }
private void EditBook_Click(object sender, EventArgs e) { AddBooks addBooks = AddBooks.Instance(book); Utils.SwitchBetweenWindows(this, addBooks); }