示例#1
0
        public void Disable()
        {
            MagicLaboratory.Blur(Contents);

            _pBar.Visibility = Visibility.Visible;

            _pBar.IsIndeterminate = true;
        }
示例#2
0
 public ContentsBrowser()
 {
     Style = FindResource("ContentsBrowser") as Style;
     _item.MouseDoubleClick += _item_MouseDoubleClick;
     Item.Container          = this;
     Loaded += (s, e) =>
     {
         ApplyTemplate();
         Item.Items.CollectionChanged += Items_CollectionChanged;
         FoldersTree                      = Template.FindName("FoldersTree", this) as TreeView;
         Contents                         = Template.FindName("Contents", this) as ListView;
         Contents.ContextMenu             = contentsMenu();
         FoldersTree.SelectedItemChanged += FoldersTree_SelectedItemChanged;
         _import     = (Border)Template.FindName("Import", this);
         _prev       = (Border)Template.FindName("Prev", this);
         _next       = (Border)Template.FindName("Next", this);
         _pBar       = (ProgressBar)Template.FindName("pBar", this);
         Item.Parent = Item;
         if (Hub.WorkSpace[Hub.WorkSpace.Length - 1] == '\\')
         {
             Hub.WorkSpace = Hub.WorkSpace.Remove(Hub.WorkSpace.Length - 1);
         }
         Item.Load(Hub.WorkSpace);
         ListDirectory(FoldersTree, Hub.WorkSpace);
         _next.IsEnabled = false;
         MagicLaboratory.Blur(_next);
         //Import item
         _import.PreviewMouseLeftButtonUp += _import_PreviewMouseLeftButtonUp;
         //Previous folder
         _prev.PreviewMouseLeftButtonUp += (ps, pe) =>
         {
             if (Item.Path != "")
             {
                 var di = new DirectoryInfo(Item.Path);
                 if (di.Parent != null && Item.Path != Hub.WorkSpace)
                 {
                     Item.NextPath = Item.Path;
                     Item.Load(di.Parent.FullName);
                     Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>
                     {
                         _next.IsEnabled = true;
                         MagicLaboratory.UnBlur(_next);
                     }));
                 }
             }
         };
         KeyDown += ContentsBrowser_KeyDown;
         //Next folder
         _next.PreviewMouseLeftButtonUp += (ns, ne) =>
         {
             if (Item.Path != "")
             {
                 if (Item.NextPath != "")
                 {
                     Item.Load(Item.NextPath);
                 }
             }
             _next.IsEnabled = false;
             MagicLaboratory.Blur(_next);
         };
         _selectedItems.CollectionChanged += (c, ch) =>
         {
             foreach (var item in _selectedItems)
             {
                 var explorerItem = item;
                 if (explorerItem != null)
                 {
                     explorerItem.IsSelected        = true;
                     explorerItem.MouseDoubleClick += ExplorerItem_MouseDoubleClick;
                 }
             }
         };
         if (Contents != null)
         {
             Contents.ItemsSource       = Item.Items;
             Contents.SelectionChanged += Contents_SelectionChanged;
             Contents.PreviewKeyDown   += Contents_PreviewKeyDown;
         }
         var DTimer = new DispatcherTimer();
         DTimer.Interval  = new TimeSpan(0, 0, 3);
         DTimer.IsEnabled = true;
         DTimer.Tick     += (ss, ee) =>
         {
             var numOfElement = Directory.GetDirectories(Item.Path).Length +
                                Directory.GetFiles(Item.Path).Length;
             if (numOfElement != Item.Items.Count)
             {
                 Refresh();
             }
         };
     };
 }
示例#3
0
 private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     _next.IsEnabled = false;
     MagicLaboratory.Blur(_next);
 }