Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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);
        }