public Task StopAsync(CancellationToken cancellationToken) { _renderer?.Dispose(); _renderer = null; return(Task.CompletedTask); }
public async Task StartAsync(CancellationToken cancellationToken) { if (_blinFormsStartups != null) { await Task.WhenAll(_blinFormsStartups.Select(async startup => await startup.OnStartAsync().ConfigureAwait(false))).ConfigureAwait(false); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _renderer = new BlinFormsRenderer(_serviceProvider, _loggerFactory); await _renderer.Dispatcher.InvokeAsync(async() => { var rootForm = new RootForm(); rootForm.FormClosed += OnRootFormFormClosed; await _renderer.AddComponent(_blinFormsMainForm.RootFormContentType, new ControlWrapper(rootForm)).ConfigureAwait(false); Application.Run(rootForm); }).ConfigureAwait(false); }
protected virtual void Dispose(bool disposing) { _renderer?.Dispose(); _renderer = null; }