public ClientsTablePage(IPageHandler pageHandler)
        {
            InitializeComponent();
            this.pageHandler = pageHandler;

            DataContext = this;
        }
Пример #2
0
 public static IPageResult <TResult> Result <TQuery, TResult>(
     this IPageHandler <TQuery, TResult> handler,
     int count,
     IEnumerable <TResult> page)
     where TQuery : IPageQuery <TResult>
 {
     return(new PageResult <TResult>(count, page));
 }
Пример #3
0
        public MainPage(IPageHandler pageHandler)
        {
            InitializeComponent();

            OpenWorkersAddFormCommand = new RelayCommand(OpenAddForm);

            DataContext      = this;
            this.pageHandler = pageHandler;
        }
Пример #4
0
 public static void MapBackground(IPageHandler handler, IContentView page)
 {
     handler.UpdateValue(nameof(handler.ContainerView));
     if (page.Background != null && handler.PlatformView.BackgroundColor != EColor.Transparent)
     {
         handler.PlatformView.BackgroundColor = EColor.Transparent;
     }
     handler.ToPlatform()?.UpdateBackground(page);
 }
Пример #5
0
 public static void MapTitle(IPageHandler handler, IContentView page)
 {
     if (handler is IPlatformViewHandler invh && invh.ViewController != null)
     {
         if (page is ITitledElement titled)
         {
             invh.ViewController.Title = titled.Title;
         }
     }
 }
Пример #6
0
        public PageCachingHandler(IPageHandler inner, string rootPath)
        {
            this.inner = inner ?? throw new ArgumentNullException(nameof(inner));

            if (string.IsNullOrWhiteSpace(rootPath))
            {
                throw new ArgumentException(nameof(rootPath));
            }
            this.rootPath = rootPath;
        }
        public ViewOrderPage(IPageHandler pageHandler)
        {
            InitializeComponent();

            AddOrderCommand    = new RelayCommand(AddOrder);
            ChangeOrderCommand = new RelayCommand(ChangeOrder, () => SelectedOrder != null);

            DateFirst  = DateTime.Now.Date;
            DateSecond = DateTime.Now.Date;

            DataContext      = this;
            this.pageHandler = pageHandler;
        }
Пример #8
0
        public void Can_Crawl_Blog()
        {
            var dbSettings           = new SqlSettings();
            var database             = new AsgardDatabase(dbSettings);
            var queueService         = new SqlQueueService(database, new QueueItemMapper());
            var documentStateService = new SqlDocumentStateService(database, new DocumentStateMapper());

            var linkScrapers    = new ILinkScraper[] { new AgilityPackHrefLinkScraper() };
            var pageConverters  = new IPageConverter[] { new WebPageConverter() };
            var downloadHandler = new HttpClientDownloadHandler();
            var pageHandlers    = new IPageHandler[]
            {
                new BinaryPageHandler(), new NotAuthorizedPageHandler(), new NotFoundPageHandler(), new WebPageHandler()
            };
            var pageService = new ParallelPageService(linkScrapers, pageConverters, downloadHandler, pageHandlers);

            var stateService = new SqlStateService(new StateDatabase(new CommonDatabaseSettings()
            {
                CommonConnection = dbSettings.BifrostConnection
            }));
            var connector = new WebCrawlerConnector(queueService, documentStateService, pageService, stateService);


            var fetched = connector.ExecuteFetch(new WebConnectorJobConfiguration()
            {
                StartUrl = "http://blog.cwa.me.uk",
                JobName  = "Test_cwablog",
                NumberOfPagesPerExecution = 10,
                Credential             = null,
                DefaultVerifyFrequency = new Frequency()
                {
                    Days = 1
                },
                Depth      = 2,
                LinkFilter = new LinkFilter()
                {
                    StayOnHost = true
                },
                PageFilter = new PageFilter()
                {
                    ExcludeBinaryPages = true
                }
            });
        }
Пример #9
0
 public TimelineController(ILoggingService logger, IPageHandler handler)
     : base(logger)
 {
     _handler = handler;
 }
 public LoginController(ILoggingService logger, IPageHandler handler)
     : base(logger)
 {
     _handler = handler;
 }
Пример #11
0
 public static void MapTitle(IPageHandler handler, IContentView page)
 {
 }
Пример #12
0
 public PageNotFoundController(ILoggingService logger, IPageHandler handler)
     : base(logger)
 {
     _handler = handler;
 }
 public VantageCrawler(IPageGetter getter, IPageHandler pageHandler, IDocHandler docHandler = null)
 {
     this.getter      = getter ?? throw new ArgumentNullException(nameof(getter));
     this.docHandler  = docHandler;
     this.pageHandler = pageHandler;
 }
Пример #14
0
 public ArticleController(ILoggingService logger, IPageHandler handler)
     : base(logger)
 {
     _handler = handler;
 }
Пример #15
0
        public void Run()
        {
            MyFile myfile   = null;
            String HtmlPage = null;

            try
            {
                socket_in  = socket;
                socket_out = socket;

                request = new Request(socket_in, remoteIpEndPoint.ToString());

                string       actualPath   = request.path;
                IPageHandler _pageHandler = _pageHandlerFactory.Create(actualPath);

                if (_pageHandler != null)
                {
                    // Map and parse the relative path to get the actual file info
                    string requestedFile = ConfigurationManager.AppSettings.Get("configpath") + actualPath;

                    switch (request.command)
                    {
                    case "GET":
                        HtmlPage = _pageHandler.HandleGet(request, requestedFile);
                        break;

                    case "POST":
                        _pageHandler.HandlePost(request, requestedFile);
                        break;
                    }
                }
                else
                {
                    myfile = new MyFile(AppConfigProcessor.Get().WebRoot + request.getPath());
                }

                //System.Console.WriteLine(myfile.indexPageExists());

                if (AppConfigProcessor.Get().DirectoryBrowsing == true && (myfile != null && myfile.indexPageExists() == true))
                {
                    HtmlPage directoryList = new DirectoryList(AppConfigProcessor.Get().WebRoot,
                                                               request.getPath().Substring(0, request.getPath().LastIndexOf('/')));
                    writeString(directoryList.getHtmlPage());
                }
                else
                {
                    if (HtmlPage is string)
                    {
                        writeString(HtmlPage);
                    }
                    else
                    {
                        writeFile(myfile);
                    }
                }
            }
            catch (RedirectException e)
            {
                Console.WriteLine(e);
                writeRedirectString(e.getPath(), 302);
            }
            catch (BadRequestException e)
            {
                Console.WriteLine(e);
                myfile = new MyFile((new Error(400)).getHtmlPath(ConfigurationManager.AppSettings.Get("configpath")));
                writeFile(myfile, 400);
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine(e);
                myfile = new MyFile((new Error(404)).getHtmlPath(ConfigurationManager.AppSettings.Get("configpath")));
                writeFile(myfile, 404);
            }
            catch (IOException e)
            {
                Console.WriteLine(e);
                myfile = new MyFile((new Error(500)).getHtmlPath(ConfigurationManager.AppSettings.Get("configpath")));
                writeFile(myfile, 500);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (myfile != null)
            {
                myfile.Close();
            }
        }
 public PageNotFoundController(ILoggingService logger, IPageHandler handler)
     : base(logger)
 {
     _handler = handler;
 }