/// <summary>
        ///     Lookup a URL.
        /// </summary>
        /// <param name="this">
        ///     A <see cref="IBrowsingService" />.
        /// </param>
        /// <param name="url">
        ///     A <see cref="Url" /> to lookup.
        /// </param>
        /// <returns>
        ///     A <see cref="UrlLookupResult" /> indicating whether <paramref name="url" /> is
        ///     <see cref="UrlLookupResultCode.Safe" /> or <see cref="UrlLookupResultCode.Unsafe" />.
        /// </returns>
        /// <exception cref="Gee.External.Browsing.Cache.BrowsingCacheException">
        ///     Thrown if a caching error occurs. If you're not interested in handling this exception, catch
        ///     <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException">
        ///     Thrown if an error communicating with the Google Safe Browsing API occurs. If you're not interested
        ///     in handling this exception, catch <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="Gee.External.Browsing.Databases.BrowsingDatabaseException">
        ///     Thrown if a database error occurs. If you're not interested in handling this exception, catch
        ///     <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="url" /> is a null reference.
        /// </exception>
        /// <exception cref="System.ObjectDisposedException">
        ///     Thrown if <paramref name="this" /> is disposed.
        /// </exception>
        public static Task <UrlLookupResult> LookupAsync(this IBrowsingService @this, Url url)
        {
            Guard.ThrowIf(nameof(@this), @this).Null();

            var lookupTask = @this.LookupAsync(url, CancellationToken.None);

            return(lookupTask);
        }
        /// <summary>
        ///     Lookup a URL.
        /// </summary>
        /// <param name="this">
        ///     A <see cref="IBrowsingService" />.
        /// </param>
        /// <param name="url">
        ///     A <see cref="Url" /> to lookup.
        /// </param>
        /// <param name="cancellationToken">
        ///     A cancellation token to cancel the asynchronous operation with.
        /// </param>
        /// <returns>
        ///     A <see cref="UrlLookupResult" /> indicating whether <paramref name="url" /> is
        ///     <see cref="UrlLookupResultCode.Safe" /> or <see cref="UrlLookupResultCode.Unsafe" />.
        /// </returns>
        /// <exception cref="Gee.External.Browsing.Cache.BrowsingCacheException">
        ///     Thrown if a caching error occurs. If you're not interested in handling this exception, catch
        ///     <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException">
        ///     Thrown if an error communicating with the Google Safe Browsing API occurs. If you're not interested
        ///     in handling this exception, catch <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="Gee.External.Browsing.Databases.BrowsingDatabaseException">
        ///     Thrown if a database error occurs. If you're not interested in handling this exception, catch
        ///     <see cref="BrowsingException" /> instead.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="url" /> is a null reference.
        /// </exception>
        /// <exception cref="System.ObjectDisposedException">
        ///     Thrown if <paramref name="this" /> is disposed.
        /// </exception>
        /// <exception cref="System.OperationCanceledException">
        ///     Thrown if the asynchronous operation is cancelled.
        /// </exception>
        public static Task <UrlLookupResult> LookupAsync(this IBrowsingService @this, string url, CancellationToken cancellationToken)
        {
            Guard.ThrowIf(nameof(@this), @this).Null();

            var canonicalizedUrl = new Url(url);
            var lookupTask       = @this.LookupAsync(canonicalizedUrl, cancellationToken);

            return(lookupTask);
        }
Exemple #3
0
        public void Register(INavigationService navigationService, INotificationService notificationService,
                             IBrowsingService browsingService, IApiConfiguration apiConfiguration)
        {
            // Luvi services
            this.container.RegisterInstance(navigationService, new ContainerControlledLifetimeManager());
            this.container.RegisterInstance(notificationService, new ContainerControlledLifetimeManager());
            this.container.RegisterInstance(browsingService, new ContainerControlledLifetimeManager());

            // Repositories
            var repositories = RepositoryFactory.CreateRepositories(apiConfiguration);

            this.container.RegisterInstance(repositories.Item1, new ContainerControlledLifetimeManager());
            this.container.RegisterInstance(repositories.Item2, new ContainerControlledLifetimeManager());
        }
Exemple #4
0
        public MainWindowViewModel(IUnityContainer container, IBrowsingService browsingService,
                                   SearchCustomersViewModel searchCustomersViewModel, SearchInvoicesViewModel searchInvoicesViewModel)
        {
            this.browsingService = browsingService;

            this.searchCustomersViewModel = searchCustomersViewModel;
            this.searchInvoicesViewModel  = searchInvoicesViewModel;

            this.customerCommandsViewModel =
                container.Resolve <CustomerCommandsViewModel>(new ParameterOverride("searchCustomersViewModel",
                                                                                    this.searchCustomersViewModel));
            this.invoiceCommandsViewModel =
                container.Resolve <InvoiceCommandsViewModel>(new ParameterOverride("searchInvoicesViewModel",
                                                                                   this.searchInvoicesViewModel));

            this.RepositoryCommand = new RelayCommand(onRepositoryExecuted);
        }
 public static Task <UrlLookupResult> LookupAsync(this IBrowsingService @this, string url) => @this.LookupAsync(url, CancellationToken.None);
Exemple #6
0
 public InvoiceService(IInvoiceRepository invoiceRepository, IBrowsingService browsingService)
 {
     this.invoiceRepository = invoiceRepository;
     this.browsingService   = browsingService;
 }