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(); } } } } }
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); } } }
private void getAllForm_Load(object sender, EventArgs e) { dataGridView.DataSource = _todoService.GetAll(); dataGridView.Columns["Id"].Visible = false; lblCount.Text = _todoService.Count().ToString(); }