This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyBackgroundService : BackgroundService | |
| { | |
| protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
| { | |
| while (!stoppingToken.IsCancellationRequested) | |
| { | |
| await DoWorkAsync(stoppingToken); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyBackgroundService : BackgroundService | |
| { | |
| protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
| { | |
| using var disposer = messageQueue.Subscribe(async (msg) => | |
| { | |
| await ProcessMessageAsync(msg, stoppingToken); | |
| }); | |
| // Nasty! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel; | |
| using System.Runtime.CompilerServices; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace Core | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| One cannot use multisampling directly in a UWP application because | |
| of reasons stipulated here: | |
| https://docs.microsoft.com/tr-tr/windows/uwp/gaming/multisampling--multi-sample-anti-aliasing--in-windows-store-apps | |
| The workaround is to create a render target with multisampling, render to that | |
| and then render the render target as a sprite | |
| */ | |
| using System; | |
| using System.Collections.Generic; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' .Net 1.1 and Later | |
| Imports System.Threading | |
| Public NotInheritable Class MessageSequencer | |
| Implements IDisposable | |
| Private _disposed As Integer = 0 | |
| ReadOnly _waitThread As Thread | |
| ReadOnly _mre As New ManualResetEvent(False) |
OlderNewer