private void printCode() { Product obj = productBindingSource.Current as Product; if (obj != null) { ucBarCode uc; if (!frmDashboard.Instance.MetroContainer.Controls.ContainsKey("ucBarCode")) { uc = new ucBarCode(); uc.Dock = DockStyle.Fill; frmDashboard.Instance.MetroContainer.Controls.Add(uc); } else { uc = (frmDashboard.Instance.MetroContainer.Controls["ucBarCode"]) as ucBarCode; } uc.generateCode(obj.Kod, obj.Nazwa); frmDashboard.Instance.MetroContainer.Controls["ucBarCode"].BringToFront(); frmDashboard.Instance.MetroBack.Visible = true; frmDashboard.Instance.setPage("ucProduct"); } }
private void mtBarCodes_Click(object sender, EventArgs e) { if (!frmDashboard.Instance.MetroContainer.Controls.ContainsKey("ucBarCode")) { ucBarCode uc = new ucBarCode(); uc.Dock = DockStyle.Fill; frmDashboard.Instance.MetroContainer.Controls.Add(uc); } frmDashboard.Instance.MetroContainer.Controls["ucBarCode"].BringToFront(); frmDashboard.Instance.MetroBack.Visible = true; frmDashboard.Instance.setPage("ucDashboard"); }