Example #1
0
 public ProjectRootNode(ProjectManager manager, ProjectInfo pi, FiledropsDirectory di, Binding showext)
     : base(di, showext)
 {
     this.pi = pi;
     this.manager = manager;
     Tag = "Project";
 }
Example #2
0
 public ProjectFolderNode(ProjectInfo pi, FiledropsDirectory di, Binding showext, FolderTreeNodeFilter filter = null)
     : base(di, showext, filter)
 {
     this.pi = pi;
     //this.ContextMenuOpening
     //pi.Manager
 }
Example #3
0
        public DynamicProjectForm(FiledropsFile fi, ProjectInfo pi)
        {
            this.FI = fi;
            this.Project = pi;
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, saveFile));
            this.ProjectSystem = pi.FileSystem;

            XmlDocument doc = new XmlDocument();
            doc.Load(fi.FullName);

            Setup(doc);
        }
Example #4
0
 public ProjectLayoutDocument(ProjectInfo pi, FiledropsFile fi, GetIcon iconfunction)
 {
     this._pi = pi;
     this._fi = fi;
     this.Title = fi.NameWithoutExtension;
     if (iconfunction != null)
         this.IconSource = iconfunction(fi, null, 32);
     if (this.IconSource == null)
         this.IconSource = fi.Icon32x32;
     this.Closed += CloseDoc;
     this.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(TryClose);
 }
Example #5
0
        public void ShowPreferences(ProjectInfo pi)
        {
            if (!pi.IsOpen(pi.ProjectFile.FullName))
            {
                // create new tab and add it to the documentContainer
                ProjectLayoutDocument layout = new ProjectLayoutDocument(pi, pi.ProjectFile, null);

                bool ok;
                if (IsFileEmpty(pi.ProjectFile))
                {
                    ok = XmlValidator.Validate(pi.ProjectFile, XmlSchemaUtilities.getXmlSchemaFromXml(pi.ProjectFile.FullName));
                }
                else
                {
                    ok = true;
                }
                if (ok)
                {
                    ScrollViewer scroller = new ScrollViewer();
                    scroller.Content = FormFactory.GetNewForm(pi.ProjectFile, pi);
                    layout.Content = scroller;
                }
                else
                {
                    string messageBoxText = "File invalid, see log files for more info.";
                    string caption = "Filedrops";
                    MessageBoxButton button = MessageBoxButton.OK;
                    MessageBoxImage icon = MessageBoxImage.Warning;
                    MessageBox.Show(messageBoxText, caption, button, icon);
                }

                if (layout.Content != null)
                {
                    layout.IsActive = true;															 // focus on tab
                    DocPane.Children.Add(layout);									 // add to documentContainer
                    pi.fileOpened(pi.ProjectFile.FullName, layout);
                }
            }
            else
            {
                pi.SetFocus(pi.ProjectFile.FullName);
            }
        }
Example #6
0
 public void RenameProject(string oldname, string newname, ProjectInfo pi)
 {
     this.projects.Remove(oldname);
     this.projects.Add(newname, pi);
 }
Example #7
0
        /// <summary>
        /// TODO: fix this dependency
        /// </summary>
        public virtual void createNewProject()
        {
            FiledropsFileSystem pfs = this.FileSystem.Clone<FiledropsFileSystem>();

            //filedrops folder dialog disabled because of necessary functionality improvements
            //ExplorerDialog dialog = new ExplorerDialog(true, FileSystem.WorkingDirectory, "Choose a destination folder");
            //bool? result = dialog.ShowDialog();
            //if (result == true)

            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //filedrops folder dialog disabled because of necessary functionality improvements
                //FiledropsDirectory dir = dialog.SelectedEntry as FiledropsDirectory;
                //FiledropsDirectory newdir = pfs.ConstructDirectoryRecursive(FileTools.Combine(dir.FullName, dir.Name));

                FiledropsDirectory newdir = pfs.ConstructDirectoryRecursive(Path.Combine(dialog.SelectedPath, "Project"));
                initTopDirs(newdir);

                FiledropsFile projectfile = pfs.ConstructFile(Path.Combine(newdir.FullName, newdir.Name + "." + ProjectManager.PXT));
                projectfile.Create();

                pfs.WorkingDirectory = projectfile.Parent;

                ProjectInfo pi = new ProjectInfo(projectfile, this, pfs);
                projects.Add(projectfile.FullName, pi);

                projectfile.Parent.FileSystem = pfs;
                projectfile.FileSystem = pfs;

                projectTree.AddRootAndRename(projectfile.Parent, pi);

                if (preferencesfile != null)
                    XmlSchemaUtilities.generateCleanXml(projectfile.FullName, Environment.CurrentDirectory + @"\Resources\DocUI\preferences.xsd", ".");
            }
        }
Example #8
0
 /// <summary>
 /// Closes the project.
 /// </summary>
 /// <param name="source">source</param>
 /// <param name="args">arguments</param>
 public virtual void closeProject(ProjectInfo pi)
 {
     FiledropsFile f = pi.ProjectFile;
     if (projects.ContainsKey(f.FullName) && pi.CloseProject())
     {
         projects.Remove(f.FullName);
         foreach (TreeViewItem item in projectTree.Items)
         {
             if ((item as ProjectRootNode).Entry == f.Parent)
             {
                 projectTree.Items.Remove(item);
                 if (item.Parent != null)
                 {
                     (item.Parent as TreeViewItem).Items.Remove(item);
                 }
                 break;
             }
         }
     }
 }
Example #9
0
 public void initProject(FiledropsFile f)
 {
     // add project
     FiledropsFileSystem pfs = this.FileSystem.Clone<FiledropsFileSystem>();
     pfs.WorkingDirectory = f.Parent;
     ProjectInfo pi = new ProjectInfo(f, this, pfs);
     f.Parent.FileSystem = pfs;
     f.FileSystem = pfs;
     projectTree.AddRoot(f.Parent, pi);
     projects.Add(f.FullName, pi);
 }
 public virtual DynamicProjectForm GetNewForm(FiledropsFile fi, ProjectInfo pi)
 {
     DynamicProjectForm form = new DynamicProjectForm(fi, pi);
     return form;
 }
Example #11
0
 public void AddRootAndRename(FiledropsDirectory dir, ProjectInfo pi)
 {
     FolderTreeNode node = new ProjectRootNode(Manager, pi, dir, showExtBinding);
     this.RootDirectories.Add(node.Entry);
     this.buildFolderRoot(node);
     this.Items.Add(node);
     node.RenameNode();
 }
Example #12
0
 public FolderTreeNode AddRoot(FiledropsDirectory dir, ProjectInfo pi)
 {
     FolderTreeNode node = new ProjectRootNode(Manager, pi, dir, showExtBinding);
     this.RootDirectories.Add(node.Entry);
     this.buildFolderRoot(node);
     if (ShowRoot)
     {
         this.Items.Add(node);
     }
     return node;
 }
Example #13
0
 public ProjectFileNode(ProjectInfo pi, FiledropsFile fi, Binding showext)
     : base(fi, showext)
 {
     this._pi = pi;
     this.MouseDoubleClick += (sender, args) => { pi.Open(fi); };
 }
Example #14
0
 public override void closeProject(ProjectInfo pi)
 {
     if (!(pi is SolutionProjectInfo)) return;
     SolutionProjectInfo solutionProject = pi as SolutionProjectInfo;
     solutionProject.solution.closeProject(solutionProject);
     this.solutionTree.Items.Remove(GetTreeNodeWithProject(solutionProject));
 }