public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHubContext <ChatHub> chatHubContext) { app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseMigrationsEndPoint(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapBlazorHub(); endpoints.MapHub <ChatHub>("/chathub"); endpoints.MapFallbackToPage("/_Host"); }); MyAsyncTask mytask = new MyAsyncTask(chatHubContext); mytask.startTask(); }
public void OnBitmapReady(Bitmap saveBitmap, SaveType type) { try { MyAsyncTask task = new MyAsyncTask(this, ImagePath, ParentView, OnSaveListener, SaveSettings, saveBitmap, type); task.Execute(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnBitmapReady(Bitmap saveBitmap, SaveType type) { try { MyAsyncTask task = new MyAsyncTask(this, ImagePath, ParentView, OnSaveListener, SaveSettings, saveBitmap, type); task.Execute(); } catch (Exception e) { Console.WriteLine(e); } }
public async Task CancelAsyncTask() { using (var runner = new BackgroundTaskRunner <IBackgroundTask>(new BackgroundTaskRunnerOptions(), _logger)) { var task = new MyAsyncTask(4000); runner.Add(task); Assert.IsTrue(runner.IsRunning); await Task.Delay(1000); // ensure the task *has* started else cannot cancel runner.CancelCurrentBackgroundTask(); await runner.StoppedAwaitable; // wait for the entire runner operation to complete Assert.AreEqual(default(DateTime), task.Ended); } }