コード例 #1
0
        /// <summary>
        /// Returns a media source created from a URI that is contained in value.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        /// <returns>MediaSource</returns>
        public override object ConvertFromInvariantString(string value)
        {
            if (value != null)
            {
                return(Uri.TryCreate(value, UriKind.Absolute, out Uri uri) && uri.Scheme != "file" ? MediaSource.FromUri(uri) : MediaSource.FromFile(value));
            }

            throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(MediaSource)));
        }