//User section for bussines logic //Your code should be inserted here protected async Task UserSection() { _screenView = Screen.CreateElement("Design.ScreenView"); _screenList = Screen.CreateElement("Design.ScreenList"); _screenInfo = Screen.CreateElement("Design.ScreenInfo"); _state = AppState.List; #region init // load Screen List controls screenList_List = _screenList.GetChildByName("MainList") as ListBox; screenList_List.Clickable = true; screenList_List.Clicked += screenList_List_Clicked; screenList_BtAdd = _screenList.GetChildByName("BtAdd") as SelectableArea; screenList_BtAdd.Clicked += screenList_BtAdd_Clicked; // load screen info controls _screenInfo_Caption = _screenInfo.GetChildByName("tbCaption") as TextBlock; _screenInfo_MainText = _screenInfo.GetChildByName("tbMainText") as TextBlock; _screenInfo_BtBack = _screenInfo.GetChildByName("BtBack") as SelectableArea; _screenInfo_BtBack.Clicked += BackToSCreenList; // load screen view controls _screenView_Image = _screenView.GetChildByName("MainImage") as ImageBlock; _screenView_CameraName = _screenView.GetChildByName("TlName") as TextBlock; _screenView_BtBack = _screenView.GetChildByName("BtBack") as SelectableArea; _screenView_BtBack.Clicked += BackToSCreenList; // qrcode reader _barcodeReader = new BarcodeReader(this); _barcodeReader.BarcodeReady += (s, be) => { if (_barcodeReader.RC == FunctionRC.OK) { AddCamera(_barcodeReader.MainData); } else { // todo error reporting //barcodeState = TPositioningState.ErrorReceived; } }; #endregion _cameras = new List<string>(); _state = AppState.List; AddCamera("100-066e23cd012e8f79afc37722e07bf694"); AddCamera("100-f0a176294a5c51a822ee6f4c0ae89a2c"); AddCamera("100-2033519638a3a4abb9b41d3a04bdb666"); #if false // можно включить AddCamera("100-2fbb74c566c49f4cfb6e2ea2ce1c9b4d"); AddCamera("100-40580f419398b68e0a18fa0fc319101b"); AddCamera("100-1bb9cf88076de6341a294182a49c6cf5"); #endif for (; ; ) { switch (_state) { case AppState.List: Screen.Content = _screenList; break; case AppState.StartingView: // start timer Schedule(1000, GetPicture); _screenInfo_Caption.Text = "Подключение"; _screenInfo_MainText.Text = "Пожалуйста, подождите. Идет подключение..."; Screen.Content = _screenInfo; break; case AppState.View: _screenView_Image.Image = _lastImage; _screenView_CameraName.Text = _cameras[_activeCamera]; Screen.Content = _screenView; break; case AppState.Error: Screen.Content = _screenInfo; break; } await Wait(); } }