public void klik(object sender, EventArgs e) { Type pom; pom = sender.GetType(); if (this.proveriAktivniFormi()) { if (pom.Name == "ToolStripMenuItem") { ToolStripMenuItem nov = ((ToolStripMenuItem)sender); if (nov.Tag == "Product") { AddProduct nova = new AddProduct(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Company") { AddCompany nova = new AddCompany(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag=="Group") { ProductGroup nova = new ProductGroup(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "ProductC") { AddProductsToCompany nova = new AddProductsToCompany("Company", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "CompanyP") { AddProductsToCompany nova = new AddProductsToCompany("Product", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SProduct") { AddProductsToCompany nova = new AddProductsToCompany("Product", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SCompany") { AddProductsToCompany nova = new AddProductsToCompany("Company", false ); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SGroup") { AddProductsToCompany nova = new AddProductsToCompany("Group", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } } else { ToolStripButton nov = ((ToolStripButton)sender); if (nov.Tag == "Product") { AddProduct nova = new AddProduct(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Company") { AddCompany nova = new AddCompany(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag=="Group") { ProductGroup nova = new ProductGroup(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "ProductC") { AddProductsToCompany nova = new AddProductsToCompany("Company", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "CompanyP") { AddProductsToCompany nova = new AddProductsToCompany("Product", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SProduct") { AddProductsToCompany nova = new AddProductsToCompany("Product", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SCompany") { AddProductsToCompany nova = new AddProductsToCompany("Company", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SGroup") { AddProductsToCompany nova = new AddProductsToCompany("Group", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } } } else MessageBox.Show("You can not open new form,because there is active one: \n - " + this.ActiveMdiChild.Name.ToString(), "Active Form - " + this.ActiveMdiChild.Name.ToString()); }
public void klik(object sender, EventArgs e) { Type pom; pom = sender.GetType(); if (this.proveriAktivniFormi()) { if (pom.Name == "ToolStripMenuItem") { ToolStripMenuItem nov = ((ToolStripMenuItem)sender); if (nov.Tag == "Product") { AddProduct nova = new AddProduct(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Company") { AddCompany nova = new AddCompany(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Group") { ProductGroup nova = new ProductGroup(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "ProductC") { AddProductsToCompany nova = new AddProductsToCompany("Company", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "CompanyP") { AddProductsToCompany nova = new AddProductsToCompany("Product", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SProduct") { AddProductsToCompany nova = new AddProductsToCompany("Product", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SCompany") { AddProductsToCompany nova = new AddProductsToCompany("Company", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SGroup") { AddProductsToCompany nova = new AddProductsToCompany("Group", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } } else { ToolStripButton nov = ((ToolStripButton)sender); if (nov.Tag == "Product") { AddProduct nova = new AddProduct(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Company") { AddCompany nova = new AddCompany(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "Group") { ProductGroup nova = new ProductGroup(); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "ProductC") { AddProductsToCompany nova = new AddProductsToCompany("Company", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "CompanyP") { AddProductsToCompany nova = new AddProductsToCompany("Product", true); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SProduct") { AddProductsToCompany nova = new AddProductsToCompany("Product", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SCompany") { AddProductsToCompany nova = new AddProductsToCompany("Company", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } else if (nov.Tag == "SGroup") { AddProductsToCompany nova = new AddProductsToCompany("Group", false); nova.MdiParent = this; this.ActivateMdiChild(nova); nova.Show(); } } } else { MessageBox.Show("You can not open new form,because there is active one: \n - " + this.ActiveMdiChild.Name.ToString(), "Active Form - " + this.ActiveMdiChild.Name.ToString()); } }