예제 #1
0
        /// <summary>
        /// Creates a new project with complete file structure
        /// </summary>
        /// <param name="name"></param>
        /// <param name="rootdir"></param>
        /// <returns></returns>
        public static Project CreateProject(String name, String rootdir)
        {
            Project p = new Project();
            p.Title = name;
            p.Directory = FileHelper.CreateSecondDirectory(rootdir);
            p.Created = DateTime.Now;

            return p;
        }
예제 #2
0
 public NewProjectForm(Project p)
     : this()
 {
     this.Text = "Edit project";
     project = p;
     tbProjectName.Text = p.Title;
     foreach (String id in project.FieldIDs)
         active_fields.Add(id, true);
 }
예제 #3
0
 /// <summary>
 /// Removes all the project's contents from hdd
 /// </summary>
 /// <param name="project"></param>
 /// <param name="rootdir"></param>
 public static void DeleteProject(Project project, String rootdir)
 {
 }
예제 #4
0
 public static Boolean PhotoDownloaded(String root, Project project, Photo photo)
 {
     return File.Exists(PathToPhoto(root, project, photo));
 }
예제 #5
0
 public static String PathToProject(Project project)
 {
     return Path.Combine(ProjectsDir(), project.Directory);
 }
예제 #6
0
 public static String PathToPhoto(String root, Project project, Photo photo)
 {
     return Path.Combine(root, project.Directory, photo.MD5Hash);
 }
예제 #7
0
 /// <summary>
 /// Returns path to a photo file.
 /// </summary>
 /// <param name="proj"></param>
 /// <param name="photo"></param>
 /// <returns></returns>
 public static String PathToPhoto(Project proj, Photo photo)
 {
     return Path.Combine(PathToProject(proj), photo.MD5Hash);
 }
예제 #8
0
        private void LoadProject(Project p)
        {
            // remove all inputs relate to the previous project
            RemoveInputs();

            active_project = p;
            InitOpenProjectMenu();
            p.LastOpen = DateTime.Now;
            this.Text = "Shop processor: " + p.Title;
            slAppMode.Text = "Edit project";
            projectDeleteMenu.Enabled = true;
            projectEditMenu.Enabled = true;
            tabControl.SelectTab(0);
            btnTake.Enabled = true;
            exportMenu.Enabled = true;
            lbProducts.DataSource = active_project.Products;
            lbProducts.DisplayMember = "Name";
            lbProducts.SelectedIndex = -1;

            // generate inputs for a product's metadata according to the current project preferences
            MakeInputs();
        }
예제 #9
0
        /// <summary>
        /// Removes a project
        /// </summary>
        /// <param name="p"></param>
        private void DeleteProject(Project p)
        {
            tabControl.SelectTab(0);

            lbProducts.DataSource = null;

            deleted_project_id = active_project.ID;
            downloadWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(downloadWorker_RunWorkerCompleted);
            downloadWorker.CancelAsync();

            ProjectHelper.DeleteProject(p, FileHelper.ProjectsDir());
            projects.Remove(active_project);
            active_project = null;
            projectDeleteMenu.Enabled = false;
            projectEditMenu.Enabled = false;
            InitOpenProjectMenu();
            this.Text = "Shop processor";
            slAppMode.Text = "Ready";

            btnTake.Enabled = false;
            exportMenu.Enabled = false;
        }