Esempio n. 1
0
        /// <summary>
        /// Opens the URL.
        /// </summary>
        private void OpenURL()
        {
            switch (URLType)
            {
            case URIType.Map:
            {
                try
                {
                    MapLaunchOptions mapOptions = new MapLaunchOptions
                    {
                        Name = DefaultText,
                    };

                    MapLocation.OpenMapsAsync(mapOptions);
                }
                catch (Exception ex)
                {
                    DataStore.CN.NotifyException("No map application available to open", ex);

                    throw ex;
                }

                break;
            }

            case URIType.URL:
            {
                if (GHRef is null)
                {
                    DataStore.CN.NotifyError("Bad URI for URL Model");
                    break;
                }

                if (GHRef.IsWellFormedOriginalString())
                {
                    Launcher.OpenAsync(GHRef);
                }
                break;
            }

            default:
            {
                Contract.Assert(false, "Bad URI Type");
                break;
            }
            }
        }