public QRCodeService(MainWindowViewModel viewModel, CameraService cameraService) { _viewModel = viewModel; _cameraService = cameraService; try { _orderService = new OrderService(); } catch (Exception e) { _logger.Error(e, "Exception while constructing QRCodeService"); _viewModel.ScanResult = e.ToString(); } }
public MainWindow() { InitializeComponent(); _viewModel = new MainWindowViewModel(); DataContext = _viewModel; _cameraService = new CameraService(_viewModel); _qrCodeService = new QRCodeService(_viewModel, _cameraService); _logger.Information("Application starting"); Closing += (s, e) => { _logger.Information("Application closing"); _serviceStopCts.Cancel(); }; _ = _cameraService.RunAsync(_serviceStopCts.Token); }