public object Execute()

in src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Media/PlaySoundAction.cs [88:120]


		public object Execute(object sender, object parameter)
		{
			if (string.IsNullOrEmpty(this.Source))
			{
				return false;
			}

			Uri sourceUri;
			if (!Uri.TryCreate(this.Source, UriKind.Absolute, out sourceUri))
			{
				// Impose ms-appx:// scheme if user has specified a relative URI
				string absoluteSource = string.Format(CultureInfo.InvariantCulture, PlaySoundAction.MsAppXSchemeFormatString, this.Source);
				if (!Uri.TryCreate(absoluteSource, UriKind.Absolute, out sourceUri))
				{
					return false;
				}
			}

			this._popup = new Popup();
			MediaElement mediaElement = new MediaElement();
			_popup.Child = mediaElement;

			// It is legal (although not advisable) to provide a video file. By setting visibility to collapsed, only the sound track should play.
			mediaElement.Visibility = Visibility.Collapsed;
			mediaElement.Source = sourceUri;
			mediaElement.Volume = this.Volume;

			mediaElement.MediaEnded += this.MediaElement_MediaEnded;
			mediaElement.MediaFailed += this.MediaElement_MediaFailed;

			this._popup.IsOpen = true;
			return true;
		}