Пример #1
0
 public void RemoveProject(int index)
 {
     SelectedIndex = null;
     SelectedProject = null;
     pnlList.Controls.Remove(ProjectSummaries[index]);
     ProjectSummaries.Remove(index);
 }
Пример #2
0
        private void OnProjectClick(object sender, EventArgs e)
        {
            ProjectSummary pjs = sender as ProjectSummary;
            if (pjs == null) return;

            if (!pjs.Selected)
            {
                var kvp = ProjectSummaries.SingleOrDefault(p => p.Value == pjs);

                if (kvp.Value == null) return;

                if (SelectedIndex.HasValue && SelectedIndex != kvp.Key)
                    ProjectSummaries[SelectedIndex.Value].Select(false);

                pjs.Select();
                SelectedIndex = kvp.Key;
                SelectedProject = kvp.Value;
            }
            else
            {
                pjs.Select(false);
                SelectedIndex = null;
                SelectedProject = null;

            }

        }
Пример #3
0
        public ProjectList()
        {
            InitializeComponent();
            try
            {
                foreach (Project project in Program.Db.Projects)
                {
                    var summary = new ProjectSummary(project) {Dock = DockStyle.Top};
                    summary.RegisterClick(OnProjectClick);
                    pnlList.Controls.Add(summary);
                    ProjectSummaries.Add(ProjectSummaries.Count, summary);

                }
            }
            catch
            {
                // Ignored
            }
        }