Example #1
0
        public async Task <ActionResult> SearchResults(string searchTerms)
        {
            if (string.IsNullOrWhiteSpace(searchTerms))
            {
                return(new EmptyResult());
            }

            if (!SearchDataProvider.IsUsable)
            {
                return(View("SearchUnavailable_Results"));
            }

            using (SearchResultDataProvider searchResDP = new SearchResultDataProvider()) {
                SearchResultDataProvider.SearchResultsInfo list = await searchResDP.GetSearchResultsAsync(searchTerms, Module.MaxResults, MultiString.ActiveLanguage, Manager.HaveUser);

                Model model = new Model()
                {
                    SearchTerms   = searchTerms,
                    SearchResults = list.Data,
                    MoreResults   = list.HaveMore,
                    NewWindow     = Module.NewWindow,
                    MaxResults    = Module.MaxResults,
                    ShowUrl       = Module.ShowUrl,
                    ShowSummary   = Module.ShowSummary,
                    QSArgs        = searchResDP.GetQueryArgsFromKeywords(searchTerms),
                };
                return(View(model));
            }
        }
        /// <summary>
        /// creates the resource providers that are used throughout the extensions lifetime
        /// to retrieve images and other resource files from disk.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="customization"></param>
        private void InitializeResourceProviders(DynamoModel model, LibraryViewCustomization customization)
        {
            var dllProvider = new DllResourceProvider("http://localhost/dist", "Dynamo.LibraryViewExtensionMSWebBrowser.web.library");

            iconProvider             = new IconResourceProvider(model.PathManager, dllProvider, customization);
            nodeProvider             = new NodeItemDataProvider(model.SearchModel, iconProvider);
            searchResultDataProvider = new SearchResultDataProvider(model.SearchModel, iconProvider);
            layoutProvider           = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionMSWebBrowser.web.library.layoutSpecs.json");
        }