Пример #1
0
        private void ExpandCheckedDataSourceAddParents(Dictionary <string, BackupPlanTreeNodeData> expandedDict, string path)
        {
            PathNodes nodes      = new PathNodes(path);
            PathNode  nodeParent = nodes.ParentNode;

            while (nodeParent != null)
            {
                EntryTreeNodeData newTag = null;
                switch (nodeParent.Type)
                {
                default: throw new ArgumentException("Unhandled TypeEnum", "nodeParent.Type");

                case PathNode.TypeEnum.FILE:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.FILE, nodeParent.Name, nodeParent.Path);
                    newTag       = new BackupPlanTreeNodeData(StorageAccount, info);
                    newTag.State = CheckState.Mixed;
                    break;
                }

                case PathNode.TypeEnum.FOLDER:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.FOLDER, nodeParent.Name, nodeParent.Path);
                    newTag       = new BackupPlanTreeNodeData(StorageAccount, info);
                    newTag.State = CheckState.Mixed;
                    break;
                }

                case PathNode.TypeEnum.DRIVE:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.DRIVE, nodeParent.Name, nodeParent.Path);
                    newTag       = new BackupPlanTreeNodeData(StorageAccount, info);
                    newTag.State = CheckState.Mixed;
                    break;
                }
                }

                if (newTag != null)
                {
                    if (!expandedDict.ContainsKey(nodeParent.Path))
                    {
                        expandedDict.Add(nodeParent.Path, newTag as BackupPlanTreeNodeData);
                    }
                }

                nodeParent = nodeParent.Parent;
            }
        }
Пример #2
0
        private void ExpandCheckedDataSourceAddParents(Dictionary <string, FileSystemTreeNodeData> expandedDict, string path)
        {
            PathNodes nodes      = new PathNodes(path);
            PathNode  nodeParent = nodes.ParentNode;

            while (nodeParent != null)
            {
                EntryTreeNodeData newTag = null;
                switch (nodeParent.Type)
                {
                case PathNode.TypeEnum.FILE:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.FILE, nodeParent.Name, nodeParent.Path);
                    newTag       = new FileSystemTreeNodeData(info);
                    newTag.State = CheckState.Mixed;
                    break;
                }

                case PathNode.TypeEnum.FOLDER:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.FOLDER, nodeParent.Name, nodeParent.Path);
                    newTag       = new FileSystemTreeNodeData(info);
                    newTag.State = CheckState.Mixed;
                    break;
                }

                case PathNode.TypeEnum.DRIVE:
                {
                    EntryInfo info = new EntryInfo(TypeEnum.DRIVE, nodeParent.Name, nodeParent.Path);
                    newTag       = new FileSystemTreeNodeData(info);
                    newTag.State = CheckState.Mixed;
                    break;
                }
                }

                if (newTag != null)
                {
                    if (!expandedDict.ContainsKey(nodeParent.Path))
                    {
                        expandedDict.Add(nodeParent.Path, newTag as FileSystemTreeNodeData);
                    }
                }

                nodeParent = nodeParent.Parent;
            }
        }