public ReportsViewModel(ReportModel reportModel, SimpleContainer simpleContainer, SearchAggregator searchAggregator)
 {
     _sa        = searchAggregator;
     _rm        = reportModel;
     _container = simpleContainer;
     BeginDate  = DateTime.Now.AddMonths(-1);
     EndDate    = DateTime.Now;
 }
示例#2
0
 public SearchResultsFrontPageViewModel(SearchAggregator searchAggregator, IEventAggregator eventAggregator, SimpleContainer container)
 {
     _container       = container;
     _eventAggregator = eventAggregator;
     _sa       = searchAggregator;
     _entities = new BindableCollection <ReturnedEntity>(_sa.GetAllByNoActions());
     _eventAggregator.Subscribe(this);
 }
示例#3
0
        public RecentActionReportViewModel(ReportModel reportModel, SearchAggregator searchAggregator, SimpleContainer simpleContainer)
        {
            _container = simpleContainer;
            _sa        = searchAggregator;
            GetRecords();


            _rm = reportModel;
        }
示例#4
0
        public override async void Execute(object parameter)
        {
            string query           = m_FindTextViewModel.QueryText;
            string rootPath        = m_FindTextViewModel.RootPathText;
            string extensionFilter = m_FindTextViewModel.FilterText;
            bool   recursive       = m_FindTextViewModel.RecursiveChecked;
            bool   fuzzySearch     = m_FindTextViewModel.FuzzySearchChecked;
            bool   matchCase       = m_FindTextViewModel.MatchCaseChecked;
            bool   copyToClipboard = m_FindTextViewModel.CopyToClipboardChecked;

            //debuggerDataStatusStrip.DropDownItems.Clear();
            m_FindTextViewModel.UpdateStatusBar("Searching...");
            try
            {
                var searchAggregator = new SearchAggregator(query, fuzzySearch, matchCase, copyToClipboard);
                var filepaths        = DirectoryExplorer.GetFilePaths(rootPath, recursive, extensionFilter).ToList();
                var matches          = await searchAggregator.SearchFileSetAsync(filepaths);

                if (UseRelativeFilePaths)
                {
                    foreach (var m in matches)
                    {
                        m.ShortenedPath = m.ShortenedPath.Replace(rootPath, "..");
                    }
                }

                m_FindTextViewModel.MatchList = new ObservableCollection <SearchMatch>(matches);
            }
            catch (DirectoryNotFoundException)
            {
                //There was an issue with the root directory string i.e. the location doesnt exist
                m_FindTextViewModel.UpdateStatusBar("The provided folder path does not exist.", "Red");
                return;
            }
            catch (Exception ex)
            {
#if DEBUG
                //debuggerDataStatusStrip.DropDownItems.Add("Exception: " + ex);
#endif
            }
            finally
            {
#if DEBUG
                //debuggerDataStatusStrip.DropDownItems.Add("Number of files retrieved in all directories: " + m_SearchAggregator.GetFileCount());
#endif
                if (m_FindTextViewModel.MatchList.Count > 0)
                {
                    m_FindTextViewModel.UpdateStatusBar(m_FindTextViewModel.MatchList.Count + " match(es) found.");
                }
                else
                {
                    m_FindTextViewModel.UpdateStatusBar("No matches found.", "Red");
                }
            }
        }
示例#5
0
        public MainViewModel(SimpleContainer container, SearchAggregator searchAggregator, IEventAggregator eventAggregator,
                             UserCredentials userCredentials, IWindowManager windowManager, SettingsHelper settings)
        {
            _wm = windowManager;
            _userCredentials = userCredentials;
            _events          = eventAggregator;
            _events.Subscribe(this);
            _sa        = searchAggregator;
            _container = container;
            ActivateItem(_container.GetInstance <FrontPageViewModel>());
            _settings = settings;
            settings.Read();

            Activated += OnActivate;
            if ((_userCredentials.UserAccessOptions & UserAccessOptions.UserControl) == UserAccessOptions.UserControl)
            {
                AdminVisibility = Visibility.Visible;
            }
            else
            {
                AdminVisibility = Visibility.Collapsed;
            }
        }