Example #1
0
        public MainWindowViewModel()
        {
            // Only one argument is supported - the path in which to search.
            var args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
            {
                var dir = args[1].Trim(new char[] { '"', '\\' }) + "\\";
                if (Directory.Exists(dir))
                {
                    _searchPath = dir;
                }
            }

            FoundFiles             = new ObservableCollection <FoundFileViewModel>();
            TextContentViewModel   = new TextContentViewModel();
            BinaryContentViewModel = new BinaryContentViewModel();
            SearchCommand          = new ActionCommand(RunSearch);
            mSelectedFiles         = new List <FoundFileViewModel>();
            _executor = new SearchExecutor(this);
            _worker   = new BackgroundWorker {
                WorkerSupportsCancellation = true
            };
            _worker.DoWork             += worker_DoWork;
            _worker.RunWorkerCompleted += worker_RunWorkerCompleted;
        }
Example #2
0
        private void UpdateBinaryContent()
        {
            if (SelectedFiles.Count == 1)
            {
                var file = SelectedFiles.First();
                BinaryContentViewModel.LoadFile(file.FilePath);
            }
            else
            {
                BinaryContentViewModel.CloseFile();
            }

            BinaryContentViewModel.SelectedFileCount = SelectedFiles.Count;
        }