public void ItemScannedAction(QrMessage message)
        {
            try
            {
                var qrId = message.ParseQrCode();

                var activeScanningMethod = appStorage.GetScanningAction();

                if (activeScanningMethod == ScanningAction.RelocateItem)
                {
                    Boolean done = false;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await NavigateFromMenu((int)MenuItemType.RelocateItems);
                        done = true;
                    });
                    while (!done)
                    {
                        // Wait for the navigate to complete.
                    }
                }
                if (Detail.GetType() == typeof(NavigationPage))
                {
                    var currentPage = ((NavigationPage)Detail).CurrentPage;
                    if (currentPage.GetType() == typeof(UpdateMdAssignedItemPage))
                    {
                        ((UpdateMdAssignedItemPage)currentPage).UpdatedScannedItem(qrId);
                        return;
                    }

                    var root = ((NavigationPage)Detail).RootPage;
                    if (root.GetType() == typeof(MultiItemUpdatePage))
                    {
                        ((MultiItemUpdatePage)root).AddQrId(qrId);
                        return;
                    }
                }


                var detailsModel = new ItemDetailViewModel();
                detailsModel.loadFromQrId(qrId);
                var detailsPage = ItemDetailPage.CreateItemDetailPage(detailsModel);
                var newPage     = new NavigationPage(detailsPage);
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await NavigateToNewPageFromApp(newPage);
                });
            }
            catch (Exception ex)
            {
                var exMessage = CdbApiFactory.ParseApiException(ex);
                Debug.WriteLine(exMessage);
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await DisplayAlert(exMessage.SimpleName, exMessage.Message, "OK");
                });
            }
        }
        public CdbConfigurationViewModel()
        {
            Title           = "Configuration";
            ActiveHosts     = new ObservableCollection <string>();
            ScanningActions = new List <ScanningActionItem>
            {
                new ScanningActionItem {
                    ScanningAction = ScanningAction.DetailsPage, DisplayText = "Show Item Details"
                },
                new ScanningActionItem {
                    ScanningAction = ScanningAction.RelocateItem, DisplayText = "Start Relocate Item"
                }
            };

            CatalogBrowseModes = new List <BrowseModeItem>
            {
                new BrowseModeItem {
                    BrowseMode = BrowseMode.All, DisplayText = "Show All"
                },
                new BrowseModeItem {
                    BrowseMode = BrowseMode.Favorites, DisplayText = "Show Favorites"
                }
            };

            AppStorage = CdbMobileAppStorage.Instance;

            var activeScanningAction = AppStorage.GetScanningAction();

            _ActiveScanningActionItem = ScanningActions[(int)activeScanningAction];
            // Browse modes is generic and can contain different options per domain.
            var selectedCatalogBrowseMode = AppStorage.GetCatalogBrowseMode();

            foreach (var browseItem in CatalogBrowseModes)
            {
                if (browseItem.BrowseMode == selectedCatalogBrowseMode)
                {
                    _SelectedCatalogBrowseMode = browseItem;
                    break;
                }
            }
        }