/// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <bool?> PostAsync(this IScrape operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PostWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CarStats> GetAsync(this IScrape operations, int?count = -1, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(count, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #3
0
        private void RunOnBackgroundWorker(IScrape scrape)
        {
            //  this.Invoke(new Action<IScrape>(UpdateLabel), scrape);
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += Worker_DoWork;
            worker.RunWorkerAsync(scrape);
        }
 /// <param name='operations'>
 /// Reference to the Offleaseonly.IScrape.
 /// </param>
 public static bool Post(this IScrape operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IScrape)s).PostAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <param name='operations'>
 /// Reference to the Offleaseonly.IScrape.
 /// </param>
 /// <param name='count'>
 /// Optional.
 /// </param>
 public static string Get(this IScrape operations, int?count = null)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IScrape)s).GetAsync(count);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the OffleaseonlyClient class.
 /// </summary>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public OffleaseonlyClient(params DelegatingHandler[] handlers)
     : base(handlers)
 {
     this._car     = new CarOperations(this);
     this._cars    = new Cars(this);
     this._scrape  = new Scrape(this);
     this._stats   = new Stats(this);
     this._baseUri = new Uri("http://offleaseonly.azurewebsites.net");
 }
 /// <summary>
 /// Initializes a new instance of the OffleaseonlyClient class.
 /// </summary>
 public OffleaseonlyClient()
     : base()
 {
     this._car     = new CarOperations(this);
     this._cars    = new Cars(this);
     this._scrape  = new Scrape(this);
     this._stats   = new Stats(this);
     this._baseUri = new Uri("http://offleaseonly.azurewebsites.net");
 }
예제 #8
0
 private void StartScrapping(IScrape scrape)
 {
     scrape.GetPages();
 }
예제 #9
0
 private void Worker_DoWork(object sender, DoWorkEventArgs e)
 {
     scrape = (IScrape)e.Argument;
     StartScrapping(scrape);
 }
        /// <param name='operations'>
        /// Reference to the Offleaseonly.IScrape.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <bool> PostAsync(this IScrape operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <bool> result = await operations.PostWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the Offleaseonly.IScrape.
        /// </param>
        /// <param name='count'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> GetAsync(this IScrape operations, int?count = null, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.GetWithOperationResponseAsync(count, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='count'>
 /// </param>
 public static CarStats Get(this IScrape operations, int?count = -1)
 {
     return(Task.Factory.StartNew(s => ((IScrape)s).GetAsync(count), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }