Ejemplo n.º 1
0
 /// <summary>Constructs the <see cref="RootItem"/> as a Computer.</summary>
 ///
 /// <param name="scanning">The service used for scanning the file tree.</param>
 public RootItem(ScanningService scanning)
     : base(StringConstants.ComputerName, FileItemType.Computer,
            FileItemFlags.ContainerType | FileItemFlags.AbsoluteRootType)
 {
     this.scanning          = scanning;
     scanning.SpaceChanged += UpdateSpace;
     SetupRoot();
 }
        /// <summary>Constructs the <see cref="ExtensionItems"/> list.</summary>
        public ExtensionItems(ScanningService scanning,
                              SettingsService settings)
        {
            this.scanning    = scanning;
            this.settings    = settings;
            extensions       = new Dictionary <string, ExtensionItem>();
            unusedExtensions = new Dictionary <string, ExtensionItem>();
            sortedExtensions = new List <ExtensionItem>();

            scanning.PropertyChanged += OnScanningPropertyChanged;
            settings.PropertyChanged += OnSettingsPropertyChanged;
        }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(SettingsService settings,
                             ScanningService scanning,
                             IIconCacheService iconCache,
                             IUIService ui,
                             IBitmapFactory bitmapFactory,
                             ImagesServiceBase images,
                             IClipboardService clipboard,
                             IOSService os,
                             IWindowDialogService dialogs,
                             TreemapRendererFactory treemapFactory,
                             IShortcutsService shortcuts,
                             RelayCommandService relayFactory)
        {
            Settings      = settings;
            Scanning      = scanning;
            IconCache     = iconCache;
            UI            = ui;
            BitmapFactory = bitmapFactory;
            Images        = images;
            Clipboard     = clipboard;
            OS            = os;
            Dialogs       = dialogs;
            Shortcuts     = shortcuts;
            Treemap       = treemapFactory.Create();

            Settings.PropertyChanged += OnSettingsPropertyChanged;
            Scanning.PropertyChanged += OnScanningPropertyChanged;

            Extensions = new ExtensionItemViewModelCollection(this);

            SelectedFiles = new ObservableCollection <FileItemViewModel>();
            SelectedFiles.CollectionChanged += OnSelectedFilesChanged;

            FileComparer      = new FileComparer();
            ExtensionComparer = new ExtensionComparer();
            UpdateEmptyRecycleBin();

            GCRAMUsage = GC.GetTotalMemory(false);
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                // Code runs "for real"
                ramTimer    = UI.StartTimer(Settings.RAMInterval, true, OnRAMUsageTick);
                statusTimer = UI.CreateTimer(Settings.StatusInterval, true, OnStatusTick);
            }
        }
Ejemplo n.º 4
0
 /// <summary>Constructs the <see cref="RootItem"/> with a <see cref="DirectoryInfo"/>.</summary>
 ///
 /// <param name="scanning">The service used for scanning the file tree.</param>
 /// <param name="info">The file information.</param>
 /// <param name="isAbsoluteRoot">True if there is no <see cref="RootItem"/> containing this.</param>
 public RootItem(ScanningService scanning, DirectoryInfo info, bool isAbsoluteRoot)
     : base(info, GetType(info.FullName), GetFlags(isAbsoluteRoot))
 {
     this.scanning = scanning;
     if (isAbsoluteRoot)
     {
         scanning.SpaceChanged += UpdateSpace;
     }
     RootPath = Path.GetFullPath(info.FullName);
     if (Type == FileItemType.Volume)
     {
         RootPath = PathUtils.AddDirectorySeparator(RootPath);
     }
     SetupRoot();
 }
 /// <summary>Constructs the <see cref="DriveSelectResult"/>.</summary>
 public DriveSelectResult(ScanningService scanning,
                          DriveSelectMode mode,
                          string[] selectedDrives,
                          string folderPath)
 {
     this.scanning = scanning;
     Mode          = mode;
     if (mode == DriveSelectMode.Individual)
     {
         if (selectedDrives == null)
         {
             throw new ArgumentNullException(nameof(selectedDrives));
         }
         selectedPaths = selectedDrives;
     }
     else if (mode == DriveSelectMode.Folder)
     {
         selectedPaths = new[] {
        /// <summary>Constructrs the <see cref="DriveSelectViewModel"/>.</summary>
        public DriveSelectViewModel(SettingsService settings,
                                    IUIService ui,
                                    IWindowDialogService dialog,
                                    IIconCacheService iconCache,
                                    ScanningService scanning)
        {
            Settings  = settings;
            UI        = ui;
            Dialogs   = dialog;
            IconCache = iconCache;
            Scanning  = scanning;

            Drives        = new DriveItemViewModelCollection(this);
            DriveComparer = new DriveComparer();

            SelectedDrives = new ObservableCollection <DriveItemViewModel>();
            SelectedDrives.CollectionChanged += OnSelectedDrivesChanged;
        }
        /// <summary>Constructrs the <see cref="DriveSelectViewModel"/>.</summary>
        public DriveSelectViewModel(SettingsService settings,
                                    UIService ui,
                                    IMyDialogService dialog,
                                    IconCacheService iconCache,
                                    ScanningService scanning,
                                    RelayCommandFactory relayFactory)
            : base(relayFactory)
        {
            Settings  = settings;
            UI        = ui;
            Dialogs   = dialog;
            IconCache = iconCache;
            Scanning  = scanning;

            Drives        = new DriveItemViewModelCollection(this);
            DriveComparer = new DriveComparer();

            SelectedDrives = new ObservableCollection <DriveItemViewModel>();
            SelectedDrives.CollectionChanged += OnSelectedDrivesChanged;
        }
Ejemplo n.º 8
0
 /// <summary>Constructs the <see cref="DriveItems"/> list.</summary>
 public DriveItems(ScanningService scanning)
 {
     this.scanning = scanning;
     drives        = new List <DriveItem>();
 }