コード例 #1
0
 internal void AddTask(FileSystemItemModelBase item)
 {
     if (item.Checked != true)
     {
         return;
     }
     calcQueue.ProcessTask(item);
 }
コード例 #2
0
        public override ImageSource Select(DevExpress.Xpf.Grid.TreeList.TreeListRowData rowData)
        {
            FileSystemItemModelBase item = rowData.Row as FileSystemItemModelBase;

            if (item == null)
            {
                return(null);
            }
            return(GetImageByFileItemType(item.ItemType, rowData.Node.IsExpanded, item.HasChildren()));
        }
コード例 #3
0
 void view_NodeChanged(object sender, DevExpress.Xpf.Grid.TreeList.TreeListNodeChangedEventArgs e)
 {
     if (e.ChangeType == NodeChangeType.Add)
     {
         FileSystemItemModelBase item = e.Node.Content as FileSystemItemModelBase;
         if (item.ItemType == "File")
         {
             e.Node.IsExpandButtonVisible = DevExpress.Utils.DefaultBoolean.False;
         }
     }
 }
コード例 #4
0
        FileSystemItemModelBase GetItemFromQueue()
        {
            FileSystemItemModelBase item = null;

            lock (locker) {
                if (items.Count != 0)
                {
                    item = items.Dequeue();
                }
            }
            return(item);
        }
コード例 #5
0
 void Calc()
 {
     while (true)
     {
         FileSystemItemModelBase item = GetItemFromQueue();
         if (item != null)
         {
             SizeUpdater.Instance.RecursiveCalculator(item);
         }
         else
         {
             waitHandle.WaitOne();
         }
     }
 }
コード例 #6
0
        long RecursiveCalculatorHelper(FileSystemItemModelBase item)
        {
            long resSize = 0;
            DispatcherOperation op;
            Action <FileSystemItemModelBase> sizeCalculatingAction = delegate(FileSystemItemModelBase i) {
                i.Size.Change(FileSystemItemSize.Calculating);
            };
            Action <FileSystemItemModelBase> sizeCalculatedAction = delegate(FileSystemItemModelBase i) {
                i.Size.Change(resSize);
            };

            if (item.ItemType == "File")
            {
                return(item.Size.NumSize);
            }
            FolderSystemItemModel folderItem = item as FolderSystemItemModel;

            if (folderItem == null)
            {
                return(0);
            }
            if (item.Size.IsCalculated())
            {
                return(item.Size.NumSize);
            }
            op = WindowDispatcher.BeginInvoke(DispatcherPriority.Normal, sizeCalculatingAction, item);
            if (item.HasChildren())
            {
                foreach (FileSystemItemModelBase child in folderItem.Source)
                {
                    resSize += RecursiveCalculatorHelper(child);
                }
            }
            else
            {
                resSize = DataHelper.Instance.GetFolderSize(item.FullName);
            }
            op = WindowDispatcher.BeginInvoke(DispatcherPriority.Normal, sizeCalculatedAction, item);
            return(resSize);
        }
コード例 #7
0
 public void ProcessTask(FileSystemItemModelBase item)
 {
     lock (locker) items.Enqueue(item);
     waitHandle.Set();
 }
コード例 #8
0
 internal void RecursiveCalculator(FileSystemItemModelBase item)
 {
     RecursiveCalculatorHelper(item);
 }