Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
 public override void TearDown()
 {
     fDialog.Dispose();
 }