public void ShowMedia(GDMMultimediaRecord mediaRec, bool modal) { if (mediaRec == null) { throw new ArgumentNullException("mediaRec"); } GDMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0]; MultimediaKind mmKind = GKUtils.GetMultimediaKind(fileRef.MultimediaFormat); if (mmKind == MultimediaKind.mkNone) { return; } bool externalViewer = !GlobalOptions.Instance.EmbeddedMediaPlayer && ((mmKind == MultimediaKind.mkAudio || mmKind == MultimediaKind.mkVideo)); if (externalViewer) { string targetFile = fContext.MediaLoad(fileRef); GKUtils.LoadExtFile(targetFile); } else { //var mediaViewer = AppHost.Container.Resolve<IMediaViewerWin>(this); MediaViewerWin mediaViewer = new MediaViewerWin(this); try { try { mediaViewer.FileRef = fileRef; if (modal) { mediaViewer.Show(); } else { mediaViewer.ShowInTaskbar = true; mediaViewer.Show(); } } finally { if (modal) { mediaViewer.Dispose(); } } } catch (Exception ex) { if (mediaViewer != null) { mediaViewer.Dispose(); } Logger.LogWrite("BaseWinSDI.ShowMedia(): " + ex.Message); } } }
public void ShowMedia(GDMMultimediaRecord mediaRec, bool modal) { if (mediaRec == null) { throw new ArgumentNullException("mediaRec"); } GDMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0]; if (fileRef == null) { return; } if (!GKUtils.UseEmbeddedViewer(fileRef.MultimediaFormat)) { string targetFile = fContext.MediaLoad(fileRef); GKUtils.LoadExtFile(targetFile); } else { //var mediaViewer = AppHost.Container.Resolve<IMediaViewerWin>(this); MediaViewerWin mediaViewer = new MediaViewerWin(this); try { try { mediaViewer.Multimedia = mediaRec; mediaViewer.FileRef = fileRef; if (modal) { mediaViewer.ShowDialog(); } else { mediaViewer.ShowInTaskbar = true; mediaViewer.Show(); } } finally { if (modal) { mediaViewer.Dispose(); } } } catch (Exception ex) { if (mediaViewer != null) { mediaViewer.Dispose(); } Logger.WriteError("BaseWinSDI.ShowMedia()", ex); } } }
public override void Setup() { fBase = new BaseWindowStub(); GDMMultimediaRecord mmRec = fBase.Context.Tree.CreateMultimedia(); mmRec.FileReferences.Add(new GDMFileReferenceWithTitle(mmRec)); fileRef = mmRec.FileReferences[0]; fileRef.Title = "File Title 2"; fileRef.LinkFile("shaytan_plant.jpg"); fileRef.MediaType = GDMMediaType.mtPhoto; fDialog = new MediaViewerWin(fBase); fDialog.Show(); }
public override void Setup() { base.Setup(); fBase = new BaseWindowStub(); GEDCOMMultimediaRecord mmRec = fBase.Context.Tree.CreateMultimedia(); mmRec.AddTag("FILE", "", null); fileRef = mmRec.FileReferences[0]; fileRef.Title = "File Title 2"; fileRef.LinkFile("shaytan_plant.jpg"); fileRef.MediaType = GEDCOMMediaType.mtPhoto; fDialog = new MediaViewerWin(fBase); fDialog.Show(); }