Exemplo n.º 1
0
        public void SetDirDetails(IDescriptorBase descr)
        {
            lstCurDir.BeginUpdate();

            try
            {
                lstCurDir.Items.Clear();

                if (descr == null)
                {
                    lblCurDir.Text = string.Empty;
                    return;
                }
                currentSelectedDetailsPath = descr.Path;

                foreach (FileSysItem item in descr)
                {
                    addDetail(item);
                }
                lstCurDir.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
            }
            finally
            {
                lstCurDir.EndUpdate();
            }

            subscribeForUpdates(descr);
        }
Exemplo n.º 2
0
        TreeNode findParentNode(IDescriptorBase descr)
        {
            TreeNode n = _ndLastExpanded;

            _ndLastExpanded = null;
            if (n != null)
            {
                return(n);
            }

            if (descr.Path == ".")
            {
                return(null);
            }

            n = null;
            TreeNodeCollection coll = treeDirs.Nodes;

            foreach (string s in descr.Path.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries))
            {
                n = coll.Find(s, false).FirstOrDefault();
                if (n == null)
                {
                    throw new Exception(string.Format("Path '{0}' can't be found in the Tree", descr.Path));
                }
                coll = n.Nodes;
            }
            return(n);
        }
Exemplo n.º 3
0
 void subscribeForUpdates(IDescriptorBase descr)
 {
     if (!_requestedDirDescriptors.Contains(descr))
     {
         descr.Activatewatching(true);
         descr.CollectionChanged += descr_CollectionChanged;
         _requestedDirDescriptors.Add(descr);
     }
 }
Exemplo n.º 4
0
        public FileSysItem(IDescriptorBase parent, string sysName)
        {
            Sysname     = sysName;
            DisplayName = null;
            _parent     = parent;

            string path = Path.Combine(_parent.Path, sysName);

            ItemType = Directory.Exists(path) ? ItemType.Dir : ItemType.File;
        }
Exemplo n.º 5
0
        protected DescriptorBase(Authentication authentication, object target, IDescriptorBase referenceTarget, bool isSubscriptable)
        {
            this.authentication  = authentication;
            this.referenceTarget = referenceTarget;
            this.target          = target;
            this.descriptorTypes = isSubscriptable == true ? DescriptorTypes.IsSubscriptable : DescriptorTypes.None;
            this.Initialize();

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
            {
                this.notifier = new DescriptorPropertyNotifier(this);
                this.Dispatcher.InvokeAsync(this.notifier.Save);
                this.referenceTarget.PropertyChanged += ReferenceTarget_PropertyChanged;
                this.referenceTarget.Disposed        += ReferenceTarget_Disposed;
            }
        }
Exemplo n.º 6
0
        public void SetDirDescriptor(IDescriptorBase descr)
        {
            TreeNode nd = findParentNode(descr);

            treeDirs.BeginUpdate();
            TreeNodeCollection nodes = nd == null ? treeDirs.Nodes : nd.Nodes;

            try {
                clearTree(nodes);
                foreach (FileSysItem item in descr)
                {
                    addTreeDir(nodes, item);
                }
            }
            finally {
                treeDirs.EndUpdate();
            }

            subscribeForUpdates(descr);
        }