/*private void OnRootFormFormClosed(object sender, FormClosedEventArgs e) * { * // When the main form closes, request for the application to stop * _hostApplicationLifetime.StopApplication(); * }*/ public Task StopAsync(CancellationToken cancellationToken) { _renderer?.Dispose(); _renderer = null; return(Task.CompletedTask); }
public async Task StartAsync(CancellationToken cancellationToken) { if (_bluwperStartups != null) { await Task.WhenAll(_bluwperStartups.Select(async startup => await startup.OnStartAsync().ConfigureAwait(false))).ConfigureAwait(false); } //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); _renderer = new BluwperRenderer(_serviceProvider, _loggerFactory); await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { //var rootForm = new RootForm(); //rootForm.FormClosed += OnRootFormFormClosed; await _renderer.AddComponent(_bluwperMainForm.RootFormContentType, new ControlWrapper((Grid)((Page)((Frame)Window.Current.Content).Content).Content)).ConfigureAwait(false); //Application.Run(rootForm); }).AsTask().ConfigureAwait(false); }
protected virtual void Dispose(bool disposing) { _renderer?.Dispose(); _renderer = null; }