ArcGISPortalViewer.App.LaunchMapByID C# (CSharp) Method

LaunchMapByID() private method

private LaunchMapByID ( Uri uri ) : void
uri Uri
return void
        private void LaunchMapByID(Uri uri)
        {
            //arcgis://www.arcgis.com/sharing/rest/content/items/6929c43e567647fb85e261beee7f5774/data
            string uriLP = uri.LocalPath.ToLower();
            if (!string.IsNullOrEmpty(uriLP) && uriLP.IndexOf(OrganizationUrl.ToLower()) != -1) 
            {
                string[] strArray = uriLP.Split(new string[]{ "/", "\\" }, StringSplitOptions.None);
                if (strArray != null && strArray.Count() > 5) 
                {
                    // get the item id located before the last string i.e. "/data" 
                    string itemID = strArray[strArray.Count() - 2];                                
                    Action loadMap = async () =>
                    {
                        var portal = PortalService.CurrentPortalService.Portal;
                        if (portal == null)
                            return;

                        var result = await portal.SearchItemsAsync(new Esri.ArcGISRuntime.Portal.SearchParameters() { QueryString = "id: " + itemID });
                        if (result.Results != null && result.Results.Any())
                        {
                            AppViewModel.CurrentAppViewModel.SelectedPortalItem = result.Results.FirstOrDefault();
                            (new NavigationService()).Navigate(typeof (MapPage));
                        }
                    };
                    loadMap();
                }
            }
        }
    }