private void frmMain_Load(object sender, EventArgs e) { voltar.Visible = false; _instance = this; uc = new ucDashboard(); uc.Dock = DockStyle.Fill; mPanel.Controls.Add(uc); }
private void voltar_Click(object sender, EventArgs e) { var result = MessageBox.Show(this, "", "Você tem certeza que deseja voltar ao painel principal?", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (frmMain.Instance.MetroContainer.Controls["ucMusicas"] != null) { frmMain.Instance.MetroContainer.Controls["ucMusicas"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucPartitura"] != null) { frmMain.Instance.MetroContainer.Controls["ucPartitura"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucSifras"] != null) { frmMain.Instance.MetroContainer.Controls["ucSifras"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucPartiturasSalvas"] != null) { frmMain.Instance.MetroContainer.Controls["ucPartiturasSalvas"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucAuxPartituraSalva"] != null) { frmMain.Instance.MetroContainer.Controls["ucAuxPartituraSalva"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucLetraPartitura"] != null) { frmMain.Instance.MetroContainer.Controls["ucLetraPartitura"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucImprimir"] != null) { frmMain.Instance.MetroContainer.Controls["ucImprimir"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucDeletarPartitura"] != null) { frmMain.Instance.MetroContainer.Controls["ucDeletarPartitura"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucSelecionarPartituraInserirLetra"] != null) { frmMain.Instance.MetroContainer.Controls["ucSelecionarPartituraInserirLetra"].Dispose(); } if (frmMain.Instance.MetroContainer.Controls["ucInfo"] != null) { frmMain.Instance.MetroContainer.Controls["ucInfo"].Dispose(); } uc = new ucDashboard(); uc.Dock = DockStyle.Fill; mPanel.Controls.Add(uc); voltar.Visible = false; } }