private void AddProject(ProjectModel project)
        {
            bool res = projects.Add(project);

            if (res)
            {
                mainVM.Toast("添加成功", Types.ToastType.Success);
                mainVM.Uri = "IndexPage";
                app.Add(project);
            }
            else
            {
                mainVM.Toast("添加失败", Types.ToastType.Failed);
            }
        }
Esempio n. 2
0
        private bool ImportFromFile(string file)
        {
            ProjectModel model = JsonConvert.DeserializeObject <ProjectModel>(IOHelper.ReadFile(file, false));

            if (model != null)
            {
                //创建新的Id
                model.ID           = projects.GetCreateID();
                model.ProjectName += model.ID;
                if (group != null)
                {
                    model.GroupID = group.ID;
                }
                else
                {
                    model.GroupID = 0;
                }
                app.Add(model);
                return(projects.Add(model));
            }
            return(false);
        }