private void OpenSelectedProject() { if (this.LST_Projects.SelectedItem is Project) { Project project = (Project)this.LST_Projects.SelectedItem; ProjectForm form = new ProjectForm(project); form.StartPosition = FormStartPosition.CenterParent; if (form.ShowDialog(this) == DialogResult.OK) { LST_Projects.Items.Remove(project); LST_Projects.Items.Add(project); } } }
private void AddProject() { Project addedProject = new Project(); addedProject.Name = "Nouveau"; addedProject.Deadline = DateTime.Now.Date.AddMonths(1); addedProject.IsEnded = false; ProjectForm form = new ProjectForm(addedProject); form.StartPosition = FormStartPosition.CenterParent; if (form.ShowDialog(this) == DialogResult.OK) { LST_Projects.Items.Add(addedProject); DataContext.Projects.Add(addedProject); } }