Exemplo n.º 1
0
        private void ImportProjects()
        {
            Projects.Clear();
            var projectsData = group == null?projects.GetProjects() : projects.GetProjects(group.ID);

            foreach (var project in projectsData)
            {
                string gpName = string.Empty;
                if (group == null)
                {
                    var gp = project.GroupID > 0 ? groupService.GetGroup(project.GroupID) : null;
                    if (gp != null)
                    {
                        gpName = gp.Name;
                    }
                }
                Projects.Add(new Controls.ItemSelect.Models.ItemModel
                {
                    ID          = project.ID,
                    Title       = project.ProjectName,
                    Description = project.ProjectDescription,
                    Icon        = project.Icon,
                    Tag         = gpName
                });
            }
        }
        private void OnDeleteGroupCommand(object obj)
        {
            Toast("分组已被移除", ToastType.Success);
            var groups      = group.GetGroups();
            var group_      = group.GetGroup(selectedNavigationItem.ID);
            int removeIndex = groups.IndexOf(group_);

            group.Delete(selectedNavigationItem.ID);
            Items.Remove(selectedNavigationItem);
            groups = group.GetGroups();
            if (NavSelectedItem.ID != -1)
            {
                if (groups.Count > 0)
                {
                    SelectGroup(groups[removeIndex == 0 ? 0 : removeIndex - 1].ID);
                }
                else
                {
                    SelectGroup(-1);
                }
            }
            //将分组内的项目转移
            var groupProjects = projects.GetProjects(selectedNavigationItem.ID);

            foreach (var project in groupProjects)
            {
                project.GroupID = 0;
                projects.Update(project);
            }
        }
Exemplo n.º 3
0
        public bool Execute(IEnumerable <string> arguments, IOptionParser options)
        {
            foreach (var project in _projects.GetProjects())
            {
                FormatProject(project);
            }

            return(true);
        }
Exemplo n.º 4
0
        private void LoadProject()
        {
            //查找并加载方案数据
            projects.LoadProjects();

            foreach (var project in projects.GetProjects())
            {
                if (project != null && project.EventID > 0)
                {
                    Add(project);
                }
            }
        }
Exemplo n.º 5
0
        public bool Execute(IEnumerable <string> arguments, IOptionParser options)
        {
            var project = arguments.First();

            if (_projects.GetProjects().Contains(project))
            {
                _settings[DB.Constants.ProjectDatabaseKey] = project;
                _consoleWriter.WriteLine($"You switched to project '{project}'");
                return(true);
            }

            _consoleWriter.WriteLine($"There is no project with the name '{project}' please create it first.");
            return(false);
        }
        private void OnAddCommand(object obj)
        {
            var container = obj as ActionContainer;

            if (mainVM.Data == null)
            {
                if (projects.GetProjects().Where(m => m.ProjectName == ProjectName).Any())
                {
                    mainVM.Toast("方案名称已存在,请更换", Types.ToastType.Failed);
                }
                else
                {
                    AddProject(GenerateModel(container));
                }
            }
            else
            {
                UpdateProject(GenerateModel(container));
            }
        }