/// <summary> /// Initializes a new instance of the <see cref="DocumentAddedEventContext"/> class. /// </summary> /// <param name="documentOperation">The operation.</param> /// <param name="destinationFolderPath">The destination folder path.</param> /// <param name="documentPathList">The list of documents added.</param> /// <param name="rootProperties">The properties of the root object.</param> public DocumentAddedEventContext(DocumentOperation documentOperation, IFolderPath destinationFolderPath, IList <IDocumentPath> documentPathList, IRootProperties rootProperties) { DocumentOperation = documentOperation; DestinationFolderPath = destinationFolderPath; DocumentPathList = documentPathList; RootProperties = rootProperties; }
public SaveSystem(IFolderPath _pathToSaveFolder, ISaveTextCreator _saveTextCreator, List <string> _saveText, StreamWriter _writer) { pathToSaveFolder = _pathToSaveFolder; saveTextCreator = _saveTextCreator; saveText = _saveText; writer = _writer; }
/// <summary> /// Initializes a new instance of the <see cref="PathGroup"/> class. /// </summary> /// <param name="pathTable">The table of items in the group.</param> /// <param name="groupParentPath">The specified parent path.</param> public PathGroup(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable, IFolderPath groupParentPath) { if (groupParentPath == null) { throw new ArgumentNullException(nameof(groupParentPath)); } if (pathTable == null) { throw new ArgumentNullException(nameof(pathTable)); } Debug.Assert(HasNullCommonParent(pathTable)); Dictionary <ITreeNodePath, IPathConnection> PathTable = new Dictionary <ITreeNodePath, IPathConnection>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { ITreeNodePath Path = Entry.Key; IPathConnection PathConnection = Entry.Value; IFolderPath? ParentPath = PathConnection.ParentPath; ITreeNodeProperties Properties = PathConnection.Properties; bool IsExpanded = PathConnection.IsExpanded; if (ParentPath == null) { ParentPath = GroupParentPath; } PathTable.Add(Path, new PathConnection(ParentPath, Properties, IsExpanded)); } this.PathTable = PathTable; GroupParentPath = groupParentPath; }
public int Compare(ITreeNodePath x, ITreeNodePath y) { if (x != null && y != null) { IFolderPath xFolder = x as IFolderPath; IFolderPath yFolder = y as IFolderPath; if (xFolder != null && yFolder == null) { return(-1); } else if (xFolder == null && yFolder != null) { return(+1); } else { return(string.Compare(x.FriendlyName, y.FriendlyName, false, CultureInfo.CurrentCulture)); } } else { return(0); } }
protected AddSingleOperation(ISolutionRoot root, IFolderPath destinationFolderPath, ITreeNodePath newPath, ITreeNodeProperties newProperties) : base(root, destinationFolderPath, newPath, newProperties) { Assert.ValidateReference(destinationFolderPath); this.DestinationFolderPath = destinationFolderPath; }
public PathGroup(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable, IFolderPath groupParentPath) { Assert.ValidateReference(pathTable); Assert.ValidateReference(groupParentPath); Assert.CheckCondition(HasNullCommonParent(pathTable)); Dictionary <ITreeNodePath, IPathConnection> PathTable = new Dictionary <ITreeNodePath, IPathConnection>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { ITreeNodePath Path = Entry.Key; IPathConnection PathConnection = Entry.Value; IFolderPath ParentPath = PathConnection.ParentPath; ITreeNodeProperties Properties = PathConnection.Properties; bool IsExpanded = PathConnection.IsExpanded; if (ParentPath == null) { ParentPath = GroupParentPath; } PathTable.Add(Path, new PathConnection(ParentPath, Properties, IsExpanded)); } this.PathTable = PathTable; this.GroupParentPath = GroupParentPath; }
/// <summary> /// Initializes a new instance of the <see cref="NodeMovedEventContext"/> class. /// </summary> /// <param name="path">The moved node path.</param> /// <param name="newParentPath">The path to the new parent.</param> /// <param name="isUndoRedo">True if the operation can be undone.</param> /// <param name="rootProperties">The properties of the root object.</param> public NodeMovedEventContext(ITreeNodePath path, IFolderPath newParentPath, bool isUndoRedo, IRootProperties rootProperties) { Path = path; NewParentPath = newParentPath; IsUndoRedo = isUndoRedo; RootProperties = rootProperties; }
public ScopeItemViewModel(ScopeItemViewModel parent, IFolderItem folderItem, IFolderPath folderPath) { // parent can be null. _parent = parent; if (folderItem == null) throw new ArgumentNullException("folderItem"); _folderItem = folderItem; if (folderPath == null) throw new ArgumentNullException("folderPath"); _folderPath = folderPath; // TODO: Use the WeakPropertyChangedEventHandler (in CLINQ) to bind to some interesting properties on the IFolderItem? _realChildren = _folderItem.Children.Select(x => new ScopeItemViewModel(this, x, folderPath)); //_folderItem.Children.CollectionChanged += (sender, e) => { Children = _realChildren; }; //_realChildren.CollectionChanged += (sender, e) => { Children = _realChildren; }; // If it can contain folders, but we don't know what they are yet, put a fake child in. if (_folderItem.CanContainFolders && _realChildren.Count == 0) Children = DeferredChildren; else Children = _realChildren; }
/// <summary> /// Initializes a new instance of the <see cref="DocumentOpenedEventContext"/> class. /// </summary> /// <param name="documentOperation">The document operation.</param> /// <param name="destinationFolderPath">The destination folder path.</param> /// <param name="openedDocumentPathList">The list of opened documents.</param> /// <param name="documentPathList">The list of documents to open.</param> /// <param name="errorLocation">The location of the error, if any.</param> public DocumentOpenedEventContext(DocumentOperation documentOperation, IFolderPath destinationFolderPath, IList <IDocumentPath> openedDocumentPathList, IList <IDocumentPath> documentPathList, object?errorLocation) { DocumentOperation = documentOperation; DestinationFolderPath = destinationFolderPath; OpenedDocumentPathList = openedDocumentPathList; DocumentPathList = documentPathList; ErrorLocation = errorLocation; }
/// <summary> /// Initializes a new instance of the <see cref="FolderEnumeratedEventContext"/> class. /// </summary> /// <param name="parentPath">The parent path.</param> /// <param name="parentPathList">The list of parents of enumerated folders.</param> /// <param name="rootProperties">The properties of the root object.</param> /// <param name="expandedFolderList">The list of expanded folders in the enumeration.</param> /// <param name="context">The enumeration context.</param> public FolderEnumeratedEventContext(IFolderPath parentPath, ICollection <IFolderPath> parentPathList, IRootProperties rootProperties, ICollection <IFolderPath> expandedFolderList, object context) { ParentPath = parentPath; ParentPathList = parentPathList; RootProperties = rootProperties; ExpandedFolderList = expandedFolderList; Context = context; }
public DocumentOpenedEventContext(DocumentOperation documentOperation, IFolderPath destinationFolderPath, IList <IDocumentPath> openedDocumentPathList, IList <IDocumentPath> documentPathList, object errorLocation) { this.DocumentOperation = documentOperation; this.DestinationFolderPath = destinationFolderPath; this.OpenedDocumentPathList = openedDocumentPathList; this.DocumentPathList = documentPathList; this.ErrorLocation = errorLocation; }
/// <summary> /// Initializes a new instance of the <see cref="NodePastedEventContext"/> class. /// </summary> /// <param name="path">The path to the pasted node.</param> /// <param name="parentPath">The path to the parent.</param> /// <param name="pathTable">The table of children.</param> /// <param name="updatedParentTable">The table of updated parent in children.</param> /// <param name="rootProperties">The properties of the root object.</param> /// <param name="isUndoRedo">True if the operation can be undone.</param> public NodePastedEventContext(ITreeNodePath path, IFolderPath parentPath, IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable, Dictionary <ITreeNodePath, IFolderPath> updatedParentTable, IRootProperties rootProperties, bool isUndoRedo) { Path = path; ParentPath = parentPath; PathTable = pathTable; UpdatedParentTable = updatedParentTable; RootProperties = rootProperties; IsUndoRedo = isUndoRedo; }
/// <summary> /// Initializes a new instance of the <see cref="ImportedEventArgs"/> class. /// </summary> /// <param name="routedEvent">The event that occured.</param> /// <param name="package">The solution package.</param> /// <param name="rootPath">The root path.</param> /// <param name="currentFolderPath">The current folder path.</param> /// <param name="itemName">The item name.</param> /// <param name="content">The item content.</param> public ImportedEventArgs(RoutedEvent routedEvent, SolutionPackage package, IRootPath rootPath, IFolderPath currentFolderPath, string itemName, byte[] content) : base(routedEvent) { Package = package; RootPath = rootPath; CurrentFolderPath = currentFolderPath; Name = itemName; Content = content; }
/// <summary> /// Initializes a new instance of the <see cref="ImportedEventArgs"/> class. /// </summary> /// <param name="routedEvent">The event that occured.</param> /// <param name="package">The solution package.</param> /// <param name="rootPath">The root path.</param> /// <param name="currentFolderPath">The current folder path.</param> /// <param name="folderName">The folder name.</param> public ImportedEventArgs(RoutedEvent routedEvent, SolutionPackage package, IRootPath rootPath, IFolderPath currentFolderPath, string folderName) : base(routedEvent) { Package = package; RootPath = rootPath; CurrentFolderPath = currentFolderPath; Name = folderName; Content = Array.Empty <byte>(); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionFolder"/> class. /// </summary> /// <param name="parent">The parent folder path.</param> /// <param name="path">The folder path.</param> /// <param name="properties">The folder properties.</param> public SolutionFolder(ISolutionFolder parent, IFolderPath path, IFolderProperties properties) : base(parent, path, properties) { if (parent == null) { return; } ChildrenInternal = new SolutionTreeNodeCollection(this, parent.NodeComparer); }
/// <summary> /// Initializes a new instance of the <see cref="AddSingleOperation"/> class. /// </summary> /// <param name="root">The root path.</param> /// <param name="destinationFolderPath">The destination folder path.</param> /// <param name="newPath">The path of the added item.</param> /// <param name="newProperties">The properties of the added item.</param> protected AddSingleOperation(ISolutionRoot root, IFolderPath destinationFolderPath, ITreeNodePath newPath, ITreeNodeProperties newProperties) : base(root, destinationFolderPath, newPath, newProperties) { if (destinationFolderPath == null) { throw new ArgumentNullException(nameof(destinationFolderPath)); } this.DestinationFolderPath = destinationFolderPath; }
public MovedEventArgs(RoutedEvent routedEvent, ITreeNodePath path, IFolderPath oldParentPath, IFolderPath newParentPath, bool isUndoRedo) : base(routedEvent) { Assert.ValidateReference(path); Assert.ValidateReference(oldParentPath); Assert.ValidateReference(newParentPath); this.Path = path; this.OldParentPath = oldParentPath; this.NewParentPath = newParentPath; this.IsUndoRedo = isUndoRedo; }
public PathGroup(ITreeNodePath path, IFolderPath parentPath, ITreeNodeProperties properties) { Assert.ValidateReference(path); Assert.ValidateReference(parentPath); Assert.ValidateReference(properties); Dictionary <ITreeNodePath, IPathConnection> SinglePathTable = new Dictionary <ITreeNodePath, IPathConnection>(); SinglePathTable.Add(path, new PathConnection(parentPath, properties, false)); PathTable = SinglePathTable; GroupParentPath = parentPath; }
public static bool HasNullCommonParent(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { IPathConnection PathConnection = Entry.Value; IFolderPath ParentPath = PathConnection.ParentPath; if (ParentPath != null && !pathTable.ContainsKey(ParentPath)) { return(false); } } return(true); }
public static bool HasCommonParent(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); IFolderPath GroupParentPath = null; bool? IsNullParent = null; foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { IPathConnection PathConnection = Entry.Value; IFolderPath ParentPath = PathConnection.ParentPath; if (ParentPath != null && pathTable.ContainsKey(ParentPath)) { continue; } if (!IsNullParent.HasValue) { IsNullParent = (ParentPath == null); } else if (IsNullParent.Value != (ParentPath == null)) { return(false); } if (ParentPath != null) { if (GroupParentPath == null) { GroupParentPath = ParentPath; } else if (GroupParentPath != ParentPath) { return(false); } } } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="MovedEventArgs"/> class. /// </summary> /// <param name="routedEvent">The event that occured.</param> /// <param name="path">The moved item path.</param> /// <param name="oldParentPath">Path to the old parent.</param> /// <param name="newParentPath">Path to the new parent.</param> /// <param name="isUndoRedo">True if the operation is part of a undo or redo operation.</param> public MovedEventArgs(RoutedEvent routedEvent, ITreeNodePath path, IFolderPath oldParentPath, IFolderPath newParentPath, bool isUndoRedo) : base(routedEvent) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (oldParentPath == null) { throw new ArgumentNullException(nameof(oldParentPath)); } if (newParentPath == null) { throw new ArgumentNullException(nameof(newParentPath)); } Path = path; OldParentPath = oldParentPath; NewParentPath = newParentPath; IsUndoRedo = isUndoRedo; }
/// <summary> /// Initializes a new instance of the <see cref="PathGroup"/> class. /// </summary> /// <param name="path">The single member of the group.</param> /// <param name="parentPath">The parent path.</param> /// <param name="properties">Properties of the associated item.</param> public PathGroup(ITreeNodePath path, IFolderPath parentPath, ITreeNodeProperties properties) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (parentPath == null) { throw new ArgumentNullException(nameof(parentPath)); } if (properties == null) { throw new ArgumentNullException(nameof(properties)); } Dictionary <ITreeNodePath, IPathConnection> SinglePathTable = new Dictionary <ITreeNodePath, IPathConnection>(); SinglePathTable.Add(path, new PathConnection(parentPath, properties, false)); PathTable = SinglePathTable; GroupParentPath = parentPath; }
protected virtual void Remove(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { ITreeNodePath Path = Entry.Key; IPathConnection Connection = Entry.Value; IFolderPath ParentPath = Connection.ParentPath; ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; foreach (ISolutionTreeNode Child in ChildrenCollection) { if (Child.Path.IsEqual(Path)) { ChildrenCollection.Remove(Child); break; } } if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
public FolderPackage(IFolderPath key, IFolderPath value) { this.Key = key; this.Value = value; }
public AddFolderOperation(ISolutionRoot root, IFolderPath destinationFolderPath, IFolderPath newPath, IFolderProperties newProperties) : base(root, destinationFolderPath, newPath, newProperties) { }
public void UpdateFolderPath(IFolderPath currentFolderPath) { this.CurrentFolderPath = currentFolderPath; }
public ImportedEventArgs(RoutedEvent routedEvent, SolutionPackage package, IRootPath rootPath, IFolderPath currentFolderPath, string itemName, byte[] content) : base(routedEvent) { Assert.ValidateReference(rootPath); Assert.ValidateReference(currentFolderPath); Assert.ValidateReference(itemName); Assert.ValidateReference(content); this.Package = package; this.RootPath = rootPath; this.CurrentFolderPath = currentFolderPath; this.Name = itemName; this.Content = content; }
public ImportedEventArgs(RoutedEvent routedEvent, SolutionPackage package, IRootPath rootPath, IFolderPath currentFolderPath, string folderName) : base(routedEvent) { Assert.ValidateReference(rootPath); Assert.ValidateReference(folderName); this.Package = package; this.RootPath = rootPath; this.CurrentFolderPath = currentFolderPath; this.Name = folderName; this.Content = null; }
/// <summary> /// Initializes a new instance of the <see cref="AddNewItemsRequestedEventContext"/> class. /// </summary> /// <param name="destinationFolderPath">The destination folder path.</param> public AddNewItemsRequestedEventContext(IFolderPath destinationFolderPath) { DestinationFolderPath = destinationFolderPath; }
public FolderCreatedEventContext(IFolderPath parentPath, string folderName, IRootProperties rootProperties) { this.ParentPath = parentPath; this.FolderName = folderName; this.RootProperties = rootProperties; }
protected virtual void Add(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); ClearExpandedFolders(); List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); List <ITreeNodePath> PathList = new List <ITreeNodePath>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { PathList.Add(Entry.Key); } while (PathList.Count > 0) { IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; int i = 0; while (i < PathList.Count) { ITreeNodePath Path = PathList[i]; IPathConnection Connection = pathTable[Path]; IFolderPath ParentPath = Connection.ParentPath; if (FlatFolderTable.ContainsKey(ParentPath)) { PathList.RemoveAt(i); ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; IFolderPath AsFolderPath; IItemPath AsItemPath; if ((AsFolderPath = Path as IFolderPath) != null) { IFolderProperties Properties = (IFolderProperties)Connection.Properties; ISolutionFolder NewFolder = CreateSolutionFolder(ParentFolder, AsFolderPath, Properties); ChildrenCollection.Add(NewFolder); if (Connection.IsExpanded) { AddExpandedFolder(NewFolder); } } else if ((AsItemPath = Path as IItemPath) != null) { IItemProperties Properties = (IItemProperties)Connection.Properties; ISolutionItem NewItem = CreateSolutionItem(ParentFolder, AsItemPath, Properties); ChildrenCollection.Add(NewItem); } else { Assert.InvalidExecutionPath(); } if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } else { i++; } } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
public ShellViewModel(IEventAggregator eventAggregator, IFolderPath folderPath) { folderPath.Changed += (sender, e) => eventAggregator.GetEvent<FolderItemSelectedEvent>().Publish(e.Top); }