public void SetUp()
        {
            this.iconCacheService = new IconCacheService();
            this.serviceLocator   = new Mock <IServiceLocator>();
            this.serviceLocator.Setup(x => x.GetInstance <IIconCacheService>()).Returns(this.iconCacheService);
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);

            var ensurePackSchemeIsKnown = System.IO.Packaging.PackUriHelper.UriSchemePack;

            this.converter = new ThingToIconUriConverter();
        }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(SettingsService settings,
                             ScanningService scanning,
                             IconCacheService iconCache,
                             UIService ui,
                             BitmapFactory bitmapFactory,
                             ImagesServiceBase images,
                             ClipboardService clipboard,
                             OSService os,
                             IMyDialogService dialogs,
                             TreemapRendererFactory treemapFactory,
                             RelayCommandFactory relayFactory)
            : base(relayFactory)
        {
            Settings      = settings;
            Scanning      = scanning;
            IconCache     = iconCache;
            UI            = ui;
            BitmapFactory = bitmapFactory;
            Images        = images;
            Clipboard     = clipboard;
            OS            = os;
            Dialogs       = dialogs;
            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);
            }
        }
        /// <summary>Constructrs the <see cref="DriveSelectViewModel"/>.</summary>
        public DriveSelectViewModel(SettingsService settings,
                                    UIService ui,
                                    IMyDialogService dialog,
                                    IconCacheService 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;
        }
示例#4
0
        public void SetUp()
        {
            var ensurePackSchemeIsKnown = System.IO.Packaging.PackUriHelper.UriSchemePack;

            this.iconCacheService = new IconCacheService();
        }