private void pesquisarEventoToolStripMenuItem_Click(object sender, EventArgs e) { var peq = new frmPesqEventos("", ""); if (Application.OpenForms.OfType <frmPesqEventos>().Count() > 0) { Application.OpenForms[peq.Name].Focus(); } else { peq.Show(); } }
private void button4_Click(object sender, EventArgs e) { var cad = new frmPesqEventos("", ""); if (Application.OpenForms.OfType <frmPesqEventos>().Count() > 0) { Application.OpenForms[cad.Name].Focus(); } else { cad.Show(); } }
private void Principal_Load(object sender, EventArgs e) { int i = 0; int data = 0; int cont = co.Evento().Rows.Count - 1; int cont1 = cs.Usuario().Rows.Count - 1; Version appVersion; d = co.Evento().Rows.Count - 2; Data(); Copias(); timer2.Enabled = true; timer2.Start(); seg = 180; Atualizar(); toolStripLabel5.Text = DateTime.Now.ToShortDateString(); if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { appVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion; } else { appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; } toolStripLabel7.Text = Convert.ToString(appVersion); if (nt == "Ok") { notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(10000, "Atenção", "Agenda Etec já está em uso, para restaurar clique duas vezes sobre o ícone", ToolTipIcon.Info); } if (aux1 == "aux") { } else { while (i <= cont) { if (Convert.ToDateTime(co.BuscaDataServidor()).ToString("dd/MM/yyyy") == Convert.ToDateTime(co.Evento().Rows[i]["data"].ToString()).ToString("dd/MM/yyyy")) { data = data + 1; } i = i + 1; } if (nt == "Ok") { } else { if (data >= 1) { string message = "Temos " + data + " eventos hoje, deseja ver?"; string caption = "Aviso"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.No) { } else { var peq = new frmPesqEventos(co.BuscaDataServidor(), visualizar); if (Application.OpenForms.OfType <frmPesqEventos>().Count() > 0) { Application.OpenForms[peq.Name].Focus(); } else { peq.Show(); peq.TopMost = true; } } } } } }