Пример #1
0
 private void OnSettingsChange_EventHandler()
 {
     // Perform requalification of file listings (Models) and refresh collection Views -
     // file qualifications may have changed after settings changed...
     MyProcessedFolderListing.ReQualifyListedFiles(RSSettingsModel.Instance.ProcessedExtensionSetting);
     MyRawFolderListing.ReQualifyListedFiles(RSSettingsModel.Instance.RawExtensionSetting);
     MyProcessedGridView.Refresh();
     HighlightDelta(CheckHighlightDelta);
     return;
 }
Пример #2
0
        private void RefreshProcessedFileList(object arg)
        {
            MyProcessedFolderFiles.Clear();
            MyProcessedFolderListing.RefreshFolderListing();
            MyProcessedFolderListing.ReQualifyListedFiles(RSSettingsModel.Instance.ProcessedExtensionSetting);

            foreach (FileDescriptorModel fd in MyProcessedFolderListing.FileList)
            {
                MyProcessedFolderFiles.Add(fd);
            }

            MyProcessedGridView.MoveCurrentTo(null);

            OnPropertyRaised("MyProcessedFolderFilesNo");
            OnPropertyRaised("MyProcessedFilesNo");
            OnPropertyRaised("MyProcessedFilesShownNo");
        }
Пример #3
0
        public ShellViewModel(FolderListingModel pfl, FolderListingModel rfl)
        {
            MyProcessedFolderListing = pfl;
            MyRawFolderListing       = rfl;
            ProcessedFolder          = MyProcessedFolderListing.FolderPath;
            RawFolder = MyRawFolderListing.FolderPath;

            // Build observable collections of file descriptors in view model
            MyProcessedFolderFiles = new ObservableCollection <FileDescriptorModel>();
            foreach (FileDescriptorModel fd in MyProcessedFolderListing.FileList)
            {
                MyProcessedFolderFiles.Add(fd);
            }

            MyRawFolderFiles = new ObservableCollection <FileDescriptorModel>();
            foreach (FileDescriptorModel fd in MyRawFolderListing.FileList)
            {
                MyRawFolderFiles.Add(fd);
            }

            // Build Views of the above collections, which can then be filtered
            ListCollectionView MyProcessedFolderFilesView = new ListCollectionView(MyProcessedFolderFiles);

            MyProcessedFolderFilesView.Filter = new Predicate <object>(ProcessedQualifyFilter);
            MyProcessedGridView = MyProcessedFolderFilesView;
            MyProcessedGridView.MoveCurrentTo(null);

            ListCollectionView MyRawFolderFilesView = new ListCollectionView(MyRawFolderFiles);

            MyRawFolderFilesView.Filter = new Predicate <object>(RawQualifyFilter);
            MyRawGridView = MyRawFolderFilesView;
            MyRawGridView.MoveCurrentTo(null);

            // Initiate button commands
            SelectProcessedFolderCommand    = new RelayCommand(SelectProcessedFolder);
            SelectRawFolderCommand          = new RelayCommand(SelectRawFolder);
            RefreshProcessedFileListCommand = new RelayCommand(RefreshProcessedFileList);
            RefreshRawFileListCommand       = new RelayCommand(RefreshRawFileList);
            RemoveProcessedItemCommand      = new RelayCommand(RemoveProcessedItem, RemoveProcessedItemCanUse);
            RemoveRawItemCommand            = new RelayCommand(RemoveRawItem, RemoveRawItemCanUse);
            GetDeltaCommand     = new RelayCommand(GetDelta, GetDeltaCanUse);
            OpenSettingsCommand = new RelayCommand(OpenSettings);
            ProgramExitCommand  = new RelayCommand(ProgramExit);
            ProgramHelpCommand  = new RelayCommand(ProgramHelp);
        }
Пример #4
0
 private void RemoveProcessedItem(object arg)
 {
     if (arg != null && (int)arg > -1)
     {
         // MyProcessedFolderFiles.RemoveAt((int)arg); Can't do this...
         // In order for us to properly remove Collection item, we have to precisely know,
         // what item is at this index of View (View may be filtered, thus index will be different)
         // FileDescriptorModel fdv = MyProcessedGridView.Cast<FileDescriptorModel>().ToArray()[(int)arg]; Although it works, this seems too complicated
         FileDescriptorModel fdv = (FileDescriptorModel)MyProcessedGridView.CurrentItem;
         if (fdv != null)
         {
             MyProcessedFolderFiles.Remove(fdv);
             MyProcessedFolderListing.FileList.Remove(fdv);
             MyProcessedGridView.MoveCurrentTo(null);
             OnPropertyRaised("MyProcessedFolderFilesNo");
             OnPropertyRaised("MyProcessedFilesNo");
             OnPropertyRaised("MyProcessedFilesShownNo");
         }
     }
 }