Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrowserViewModel" /> class.
 /// </summary>
 /// <param name="scannerService">The scanner.</param>
 /// <param name="dispatcher">The dispatcher.</param>
 /// <param name="filteringService">The filtering service.</param>
 /// <param name="menuService">Blah</param>
 /// <param name="referenceAdapters">The reference adapters.</param>
 /// <param name="publicTransport"></param>
 public BrowserViewModel(IDirectoryScannerService <StorableTaggedFile> scannerService,
                         IDispatcher dispatcher,
                         IFilteringService filteringService,
                         IMenuService menuService,
                         IReferenceAdapters referenceAdapters,
                         IPublicTransport publicTransport)
 {
     this.publicTransport = Guard.IsNull(() => publicTransport);
     scannerService.Guard("scannerService");
     dispatcher.Guard("dispatcher");
     filteringService.Guard("filteringService");
     menuService.Guard("menuService");
     referenceAdapters.Guard("referenceAdapters");
     // TODO: Localize
     menuService.Register(new CallbackMenuItem(null, "Library", new CallbackMenuItem(OnAddFiles, "Add Files")));
     this.scannerService                = Guard.IsNull(() => scannerService);
     this.dispatcher                    = Guard.IsNull(() => dispatcher);
     this.filteringService              = Guard.IsNull(() => filteringService);
     this.scannerService.ScanCompleted += ScannerServiceOnScanCompleted;
     this.scannerService.ScanProgress  += ScannerServiceOnScanProgress;
     localizedMemberPaths               = filteringService.FilterColumns.Select(x => new Alias <string>(x, x)).ToList(); // TODO: Localize
     searchTimer = new DispatcherTimer {
         Interval = TimeSpan.FromMilliseconds(500)
     };
     searchTimer.Tick += SearchTimerOnTick;
     FirstColumn       = new DynamicColumnViewModel(dispatcher);
     SecondColumn      = new DynamicColumnViewModel(dispatcher);
     ThirdColumn       = new DynamicColumnViewModel(dispatcher);
     InitViewModels();
     BuildColumns();
     InitFirstColumn();
 }