public Boolean LogicalIdentical(ProjectCategory project)
        {
            if(project == null) return false;
            if(project == this) return true;

            return project.CategoryName == this.CategoryName;
        }
Beispiel #2
0
 /// <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();
 }
Beispiel #3
0
        public GUIModel()
        {
            AllProjects = new List<Project>();
            AllCategories = new List<ProjectCategory>();

            CurrentProject = new Project();
            LastSelectedObject = CurrentProject;
            CurrentSelectedProjectIndex = -1;
            CurrentSelectedCategory  = new ProjectCategory("Category Name");
        }
        public Boolean LogicalIdentical(ProjectCategory project)
        {
            if (project == null)
            {
                return(false);
            }
            if (project == this)
            {
                return(true);
            }

            return(project.CategoryName == this.CategoryName);
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj == this)
            {
                return(true);
            }

            ProjectCategory newObj = obj as ProjectCategory;

            if (newObj == null)
            {
                return(false);
            }

            return(newObj.CategoryName == this.CategoryName);
        }
        private void EditCategory(string name)
        {
            ProjectCategory cat = new ProjectCategory(View.GetCategoryName());
            if (Model.CurrentSelectedCategory != null) cat = new ProjectCategory(Model.CurrentSelectedCategory.CategoryName);

            if (name.Contains("add")) {
                if (Model.AllCategories.Contains(cat)) {
                    MessageBox.Show("Equal category already exists!");
                    return;
                }
                Model.AllCategories.Add(cat);
            } else if (name.Contains("save")) {
                if (Model.AllCategories.Contains(cat)) {
                    MessageBox.Show("Equal category already exists!");
                    return;
                }
                Model.AllCategories[Model.CurrentSelectedCategoryIndex] = cat;
            } else if (name.Contains("delete")) {
                if (!Model.AllCategories.Contains(cat)) return;
                Model.AllCategories.Remove(Model.CurrentSelectedCategory);
                Model.CurrentSelectedCategory = null;
            }
        }