示例#1
0
文件: MainForm.cs 项目: eperia35/C-
        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);
                }
            }
        }
示例#2
0
文件: MainForm.cs 项目: eperia35/C-
        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);
            }
        }