private void btnGetAll_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms[GlobalConstants.GetAllForm] != null)
     {
         _form = Application.OpenForms["getAllForm"];
         _form.Focus();
     }
     else
     {
         if (_todoService.Count() > 0)
         {
             if (Application.OpenForms[GlobalConstants.NewTodoForm] != null)
             {
                 Application.OpenForms[GlobalConstants.NewTodoForm].Close();
             }
             getAllForm form = new getAllForm
             {
                 MdiParent     = this,
                 StartPosition = FormStartPosition.CenterScreen
             };
             form.Show();
         }
         else
         {
             MessageBox.Show(GlobalConstants.EmptyList, GlobalConstants.CaptionInfo, MessageBoxButtons.OK, MessageBoxIcon.Information);
             DialogResult result = MessageBox.Show(GlobalConstants.AddTodoQuestion, GlobalConstants.CaptionQuestion, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             if (result == DialogResult.Yes)
             {
                 if (Application.OpenForms[GlobalConstants.NewTodoForm] == null)
                 {
                     NewTodoForm newTodoForm = new NewTodoForm
                     {
                         MdiParent     = this,
                         StartPosition = FormStartPosition.CenterScreen
                     };
                     newTodoForm.Show();
                 }
                 else
                 {
                     Form form = Application.OpenForms[GlobalConstants.NewTodoForm];
                     form.Focus();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void btnGetAll_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms["GetAllForm"] != null)
     {
         _form = Application.OpenForms["GetAllForm"];
         _form.Focus();
     }
     else
     {
         if (_todoService.Count() > 0)
         {
             GetAllForm getAllForm = new GetAllForm();
             getAllForm.MdiParent     = Application.OpenForms["ToDoListForm"];
             getAllForm.StartPosition = FormStartPosition.CenterScreen;
             getAllForm.Show();
         }
         else
         {
             MessageBox.Show(GlobalConstants.EmptyList, GlobalConstants.CaptionInfo, MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
     }
 }
Ejemplo n.º 3
0
 private void getAllForm_Load(object sender, EventArgs e)
 {
     dataGridView.DataSource            = _todoService.GetAll();
     dataGridView.Columns["Id"].Visible = false;
     lblCount.Text = _todoService.Count().ToString();
 }