private async void mainPage_Loaded(object sender, RoutedEventArgs e) { _console = Console.GetInstance(); _console.ConsoleBox = _textBoxConsole; _console.Init(); SerialRaspberry raspberrySerial = SerialRaspberry.GetInstance(); await raspberrySerial.Init("UART0"); _camera = Camera.GetInstance(); _tcpIpManager = TcpIpManager.GetInstance(); while (true) { try { _captureElement.Source = _camera.CameraCapture; break; } catch (COMException exception) { await Task.Delay(1); } } _camera.StartSendingServiceAsync(); }
private async void Init() { _tcpIpManager = TcpIpManager.GetInstance(); _sendPhotoTimer = new DispatcherTimer(); _sendPhotoTimer.Interval = TimeSpan.FromMilliseconds(500); _sendPhotoTimer.Tick += TimerTick; _camera = new MediaCapture(); await _camera.InitializeAsync(); }