public TaskNodeViewModel CloneFor_CopyTask(TaskNodeViewModel newParent, int newID) { // Parent, ID TaskNodeViewModel clone = new TaskNodeViewModel(newParent, newID, taskViewType, basePath, OrgFileAttributes); // general data clone.Name = String.Copy(Name); //clone.Show = Show; //clone.Children = Children; // without children clone.basePath = String.Copy(basePath); clone.bUpdatedFile = bUpdatedFile; clone.bManuallyModified = bManuallyModified; // Duplicate Info Incorrect beim Clonen für Copy //clone.DuplicatesSourceSourceOrTT = DuplicatesSourceSourceOrTT; //clone.DuplicatesSourceTarget = DuplicatesSourceTarget; if (HashCode != null) { clone.HashCode = String.Copy(HashCode); } if (Info != null) { clone.Info = String.Copy(Info); } return(clone); }
/// <summary> /// Called by base class Collection<T> when an item is set in list; /// raises a CollectionChanged event to any listeners. /// </summary> protected override void SetItem(int index, t item) { TaskNodeViewModel oldvm = null; if (typeof(t) == typeof(TaskNodeViewModel)) { oldvm = (TaskNodeViewModel)((object)this[index]); } base.SetItem(index, item); if (typeof(t) == typeof(TaskNodeViewModel)) { TaskNodeViewModel newvm = (TaskNodeViewModel)((object)this[index]); if (newvm.Parent != null) { newvm.Parent.childrensNames.Remove(oldvm.Name); newvm.Parent.childrensNames.Add(newvm.Name, new List <TaskNodeViewModel>() { newvm }); } } }
public string GetPathFromNode() { string pathFromNode = ""; List <string> strFolderAndFileNames = new List <string>(); TaskNodeViewModel curNode = this; while (true) { strFolderAndFileNames.Add(curNode.Name); curNode = curNode.Parent; if (curNode == null) { break; } } for (int i = strFolderAndFileNames.Count - 2; i >= 0; i--) { pathFromNode += "\\" + strFolderAndFileNames[i]; } return(pathFromNode); }
/// <summary> /// Called by base class Collection<T> when an item is removed from list; /// raises a CollectionChanged event to any listeners. /// </summary> protected override void RemoveItem(int index) { if (typeof(t) == typeof(TaskNodeViewModel)) { TaskNodeViewModel vm = (TaskNodeViewModel)((object)this[index]); if (vm.Parent != null) { vm.Parent.childrensNames.Remove(vm.Name); } } base.RemoveItem(index); }
public void ActivateParentsOfThisNode() { int_bActivated = true; OnPropertyChanged("bActivated"); TaskNodeViewModel curNode = this; curNode = curNode.Parent; if (curNode == null) { return; } curNode.ActivateParentsOfThisNode(); }
//----------------------------------------------------- // // Protected Methods // //----------------------------------------------------- /// <summary> /// Called by base class Collection<T> when the list is being cleared; /// raises a CollectionChanged event to any listeners. /// </summary> protected override void ClearItems() { if (typeof(t) == typeof(TaskNodeViewModel)) { if (this.Count > 0) { TaskNodeViewModel vm = (TaskNodeViewModel)((object)this[0]); if (vm.Parent != null) { vm.Parent.childrensNames = new Dictionary <string, List <TaskNodeViewModel> >(); } } } base.ClearItems(); }
public TaskNodeViewModel Clone(TaskNodeViewModel newParent, int newID) { // Parent, ID TaskNodeViewModel clone = CloneFor_CopyTask(newParent, newID); clone.DuplicatesSourceSourceOrTT = DuplicatesSourceSourceOrTT; clone.DuplicatesSourceTarget = DuplicatesSourceTarget; //clone.Show = Show; clone.Children = Children; // Tasks if (Path_1_Original != null) { clone.Path_1_Original = String.Copy(Path_1_Original); } if (Path_2_Copy != null) { clone.Path_2_Copy = String.Copy(Path_2_Copy); } if (Path_3_Move != null) { clone.Path_3_Move = String.Copy(Path_3_Move); } if (Path_4_Rename != null) { clone.Path_4_Rename = String.Copy(Path_4_Rename); } if (Path_5_Delete != null) { clone.Path_5_Delete = String.Copy(Path_5_Delete); } clone.task1 = task1; // Create Folder clone.task2 = task2; // Copy clone.task3 = task3; // Move clone.task4 = task4; // Rename clone.task5 = task5; // Delete return(clone); }
public TaskNodeViewModel CloneFor_AfterView(TaskNodeViewModel newParent, int newID) { // Parent, ID TaskNodeViewModel clone = CloneFor_CopyTask(newParent, newID); //clone.task1 = task1; // Create Folder - tasks are set in EditAfterViewsFromActionsBeforeList //clone.task2 = task2; // Copy - dont put in after view - can be different Base Path //clone.task3 = task3; // Move - tasks are set in EditAfterViewsFromActionsBeforeList //clone.task4 = task4; // Rename - tasks are set in EditAfterViewsFromActionsBeforeList //clone.task5 = task5; // Delete - tasks are set in EditAfterViewsFromActionsBeforeList //if (task1 != enTasks.Org || task3 != enTasks.Org || task4 != enTasks.Org || task5 != enTasks.Org) // clone.bActivated = bActivated; clone.DuplicatesSourceSourceOrTT = DuplicatesSourceSourceOrTT; clone.DuplicatesSourceTarget = DuplicatesSourceTarget; return(clone); }
// The Observable Collection only means that added and removed items from it are noticed public TaskNodeViewModel(TaskNodeViewModel parent, int ID, TaskViewType taskViewType, string BasePath, cAttributes OrgFileAttributes) { //Show = true; this.taskViewType = taskViewType; this.basePath = BasePath; this.OrgFileAttributes = OrgFileAttributes; this.SetFileAttributes = null; ParentOfThis = parent; IdOfThis = ID; DuplicatesSourceSourceOrTT = new List <string>(); DuplicatesSourceTarget = new List <string>(); DuplicatesSourceSourceOrTTNodes = new List <TaskNodeViewModel>(); DuplicatesSourceTargetNodes = new System.Collections.Generic.List <TaskNodeViewModel>(); Path_1_Original = ""; Path_2_Copy = ""; Path_3_Move = ""; Path_4_Rename = ""; Path_5_Delete = ""; Path_CreateShortcutAt = ""; Path_CreateShortcutTo = ""; IsExpanded = false; bUpdatedFile = false; bManuallyModified = false; bActivated = true; childrensNames = new Dictionary <string, List <TaskNodeViewModel> >(); }
/// <summary> /// Called by base class Collection<T> when an item is added to list; /// raises a CollectionChanged event to any listeners. /// </summary> protected override void InsertItem(int index, t item) { base.InsertItem(index, item); if (typeof(t) == typeof(TaskNodeViewModel)) { TaskNodeViewModel vm = (TaskNodeViewModel)((object)this[index]); if (vm.Parent != null) { if (vm.Parent.childrensNames.ContainsKey(vm.Name)) { vm.Parent.childrensNames[vm.Name].Add(vm); } else { vm.Parent.childrensNames.Add(vm.Name, new List <TaskNodeViewModel>() { vm }); } } } }
public void RemoveChild(TaskNodeViewModel child) { Children.Remove(child); }