Пример #1
0
        /// <summary>
        /// The ExecuteLoadCamerasCommand
        /// </summary>
        /// <returns>The <see cref="Task"/></returns>
        private async Task ExecuteLoadCamerasCommand()
        {
            try
            {
                App.AddLog("Loading camera list");
                var items = await App.ApiService.GetCameras();

                if (items?.result != null && items.result.Length > 0)
                {
                    foreach (var item in items.result)
                    {
                        item.ImageBytes = await App.ApiService.GetCameraStream(item.idx);
                    }

                    if (Cameras == null)
                    {
                        Cameras = new ObservableRangeCollection <Camera>();
                    }
                    Cameras.ReplaceRange(items.result);
                }
            }
            catch (Exception ex)
            {
                App.AddLog(ex.Message);
                if (!OverviewTabbedPage.EmptyDialogShown)
                {
                    OverviewTabbedPage.EmptyDialogShown = true;
                    App.ShowToast(AppResources.error_notConnected);
                }
            }
        }