/// <summary> /// Change the visibility status on the media control in the page. /// </summary> /// <param name="status">Control visibiliyu status.</param> private void ChangeMediaControlVisibility(Visibility status) { foreach (object ctl in pnlRoot.Children) { if (ctl.GetType().ToString() == "Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl") { Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl mediaPage = null; mediaPage = (Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl)ctl; mediaPage.Visibility = status; } else if (ctl.GetType().ToString() == "Microsoft.Cui.ShowcaseControls.DownloadMediaControl") { Microsoft.Cui.ShowcaseControls.DownloadMediaControl downloadPage = null; downloadPage = (Microsoft.Cui.ShowcaseControls.DownloadMediaControl)ctl; downloadPage.Visibility = status; } else if (ctl.GetType().ToString() == "Microsoft.Cui.ShowcaseControls.ViewVideo") { Microsoft.Cui.ShowcaseControls.ViewVideo viewDemo = null; viewDemo = (Microsoft.Cui.ShowcaseControls.ViewVideo)ctl; viewDemo.Visibility = status; } else if (ctl.GetType().ToString() == "System.Windows.Shapes.Rectangle") { Rectangle fillerRect = (Rectangle)ctl; if (fillerRect.Name.Contains("filler")) { fillerRect.Visibility = status; } } } }
/// <summary> /// Event handling closing all the media controls. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private void CloseAllMedia(object sender, RoutedEventArgs e) { if (this.lstShowcaseMediaControl == null) { this.lstShowcaseMediaControl = new List <ShowcaseMediaControl>(); foreach (object ctl in pnlRoot.Children) { if (ctl.GetType().ToString() == "Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl") { this.lstShowcaseMediaControl.Add((Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl)ctl); } } } // Cast the sender object to showcase media control this.mediaControl = (Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl)sender; StringBuilder mediaSource; foreach (ShowcaseMediaControl mediaPage in this.lstShowcaseMediaControl) { if (mediaPage.IsOpen && mediaPage.Name != this.mediaControl.Name) { mediaPage.CloseMediaControl(); } else if (mediaPage.Name == this.mediaControl.Name) { mediaSource = new StringBuilder(App.ApplicationPath); // Set the media source mediaSource.Append(mediaPage.MediaSource); this.media.Source = new Uri(mediaSource.ToString()); this.media.Volume = mediaPage.Volume; media.AutoPlay = true; media.IsMuted = true; } } }
/// <summary> /// Event handling closing all the media controls. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private void CloseAllMedia(object sender, RoutedEventArgs e) { if (this.lstShowcaseMediaControl == null) { this.lstShowcaseMediaControl = new List<ShowcaseMediaControl>(); foreach (object ctl in this.pnlRoot.Children) { if (ctl.GetType().ToString() == "Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl") { this.lstShowcaseMediaControl.Add((Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl)ctl); } } } // Cast the sender object to showcase media control this.mediaControl = (Microsoft.Cui.ShowcaseControls.ShowcaseMediaControl)sender; StringBuilder mediaSource; foreach (ShowcaseMediaControl mediaPage in this.lstShowcaseMediaControl) { if (mediaPage.IsOpen && mediaPage.Name != this.mediaControl.Name) { mediaPage.CloseMediaControl(); } else if (mediaPage.Name == this.mediaControl.Name) { mediaSource = new StringBuilder(App.ApplicationPath); // Set the media source mediaSource.Append(mediaPage.MediaSource); this.media.Source = new Uri(mediaSource.ToString()); this.media.Volume = mediaPage.Volume; this.media.AutoPlay = true; this.media.IsMuted = true; } } }