private void AddExistingItem(ProjectDirectory root) { var dialog = ServiceProvider.Get <IOpenFileDialog>(); dialog.AllowMultiple = false; dialog.Filter = new FileDialogFilter("All files", "*"); if (dialog.Show()) { var newPath = Path.Combine(root.RelativePath, dialog.FileName); var absPath = Path.Combine(DirectoryPath, newPath); if (dialog.FilePath != absPath) { File.Copy(dialog.FilePath, absPath, true); } if (!root.Children.Any(f => f.FullName == dialog.FileName)) { new ProjectFile(this, root, dialog.FileName); } } }
private async void CreateAndOpenGraphFile <T>(ProjectDirectory root) where T : Graph { var dialog = ServiceProvider.Get <IDialogManager>(); var name = await dialog.ShowInputAsync("New graph", "Enter file name"); if (!string.IsNullOrWhiteSpace(name)) { var factory = ServiceProvider.Get <IGraphFactory>(); var archive = ServiceProvider.Get <IArchive>(); var graph = factory.Create <T>(); graph.Name = name; archive.Write(nameof(System.Type), typeof(T)); graph.Save(archive); var unique = GetUniqueFileName(root, graph.Name, Extension.Graph); var newFile = new ProjectFile(this, root, unique); archive.Save(newFile.AbsolutePath); OpenFile(newFile); } }
public ProjectDirectory(Project project, ProjectDirectory root, string name) : base(project, root, name) { Children = new ObservableCollection <ProjectEntry>(); }
private void AddImageGraph(ProjectDirectory root) { CreateAndOpenGraphFile <ImageGraph>(root); }
private void AddFunctionGraph(ProjectDirectory root) { CreateAndOpenGraphFile <FunctionGraph>(root); }
private void AddTextGraph(ProjectDirectory root) { CreateAndOpenGraphFile <TextGraph>(root); }
public ProjectFile(Project project, ProjectDirectory root, string name) : base(project, root, name) { Id = Guid.NewGuid(); Type = name.GetFileType(); Extension = System.IO.Path.GetExtension(name); }