示例#1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     applicationOptionsBindingSource.DataSource = new ApplicationOptions();
     LoadApplicationOptions();
     applicationOptionsBindingSource.ResetBindings(false);
     _searchEngine = new SearchEngine(Options);
 }
        public ActionResult Index(string currentFilter, string searchString, int? page, string selectedFileName)
        {
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            var options = CreateOptions();
            var searchEngine = new SearchEngine(options);

            var allStandards = searchEngine.Find(searchString, null);

            int pageSize = 6;
            int pageNumber = (page ?? 1);

            ViewBag.PageNumber = page;
            selectedFileName = selectedFileName ?? allStandards.FirstOrDefault()?.FileName;
            ViewBag.SelectedFileName = selectedFileName;

            return View("Index", allStandards.ToPagedList(pageNumber, pageSize));
        }