Exemplo n.º 1
0
 internal void AddTask(FileSystemItemModelBase item)
 {
     if (item.Checked != true)
     {
         return;
     }
     calcQueue.ProcessTask(item);
 }
Exemplo n.º 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()));
        }
Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 4
0
        FileSystemItemModelBase GetItemFromQueue()
        {
            FileSystemItemModelBase item = null;

            lock (locker) {
                if (items.Count != 0)
                {
                    item = items.Dequeue();
                }
            }
            return(item);
        }
Exemplo n.º 5
0
 void Calc()
 {
     while (true)
     {
         FileSystemItemModelBase item = GetItemFromQueue();
         if (item != null)
         {
             SizeUpdater.Instance.RecursiveCalculator(item);
         }
         else
         {
             waitHandle.WaitOne();
         }
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
 public void ProcessTask(FileSystemItemModelBase item)
 {
     lock (locker) items.Enqueue(item);
     waitHandle.Set();
 }
Exemplo n.º 8
0
 internal void RecursiveCalculator(FileSystemItemModelBase item)
 {
     RecursiveCalculatorHelper(item);
 }