예제 #1
0
 //implenting singelton pattern to this class
 public static AddBookAttirbutes Instance(Type t)
 {
     if (instance == null)
     {
         instance = new AddBookAttirbutes(t);
     }
     instance.SetAsNewWindow(t);
     return(instance);
 }
예제 #2
0
        /// <summary>
        /// when the selected item in combox have id of -1 (the Agreed sign for this Action) the add new book attirbute window is open.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox       comboBox = (ComboBox)sender;
            BookAttributes elem     = (BookAttributes)comboBox.SelectedValue;
            Type           t        = elem.GetType();

            if (elem.ID == -1)
            {
                Form form = AddBookAttirbutes.Instance(t);
                form.ShowDialog();
                setComboBoxes();
            }
        }