コード例 #1
0
ファイル: Project.cs プロジェクト: Needix/Helper_SortProjects
 /// <summary>
 /// Copy constructor, copies prevProjects data and creates a new Project with this data
 /// </summary>
 /// <param name="prevProject">The Project to copy</param>
 public Project(Project prevProject)
 {
     ProjectName = prevProject.ProjectName;
     ProjectPath = prevProject.ProjectPath;
     Finished = prevProject.Finished;
     List<ProjectCategory> oldList = prevProject.ProjectCategories;
     ProjectCategory[] cats = new ProjectCategory[oldList.Count];
     oldList.CopyTo(cats);
     ProjectCategories = cats.ToList();
 }
コード例 #2
0
        public GUIModel()
        {
            AllProjects = new List<Project>();
            AllCategories = new List<ProjectCategory>();

            CurrentProject = new Project();
            LastSelectedObject = CurrentProject;
            CurrentSelectedProjectIndex = -1;
            CurrentSelectedCategory  = new ProjectCategory("Category Name");
        }
コード例 #3
0
        public void SelectedListEntryChanged(object sender, EventArgs e)
        {
            ListBox listBox = (ListBox) sender;
            String name = listBox.Name;
            int selectedIndex = listBox.SelectedIndex;

            if(name.Equals("listBox_projects")) {
                Model.CurrentSelectedProjectIndex = selectedIndex;
                if(selectedIndex == -1) return;

                Project selectedProject = new Project(Model.AllProjects[selectedIndex]);
                Model.CurrentProject = selectedProject;
                Model.LastSelectedObject = selectedProject;
                View.UpdateProjectCategoryList(Model);

            } else if(name.Equals("listBox_categories")) {
                Model.CurrentSelectedCategoryIndex = selectedIndex;
                if (selectedIndex == -1) return;

                ProjectCategory selectedCategory = Model.AllCategories[selectedIndex];
                Model.CurrentSelectedCategory = selectedCategory;

            } else if(name.Equals("listBox_editProject_projectCategories")) {
                Model.CurrentSelectedProjectCategoryIndex = selectedIndex;
                if(selectedIndex == -1) return;

                Model.CurrentSelectedProjectCategory = Model.CurrentProject.ProjectCategories[selectedIndex];

            } else Debug.WriteLine("Warning: Could not find action for listbox: " + name);

            View.UpdateEdits(Model);
        }