private CVM.VideoWindow RunTheVideo (String VideoName, DataSet FormatierDataSet) { CVM.VideoWindow MediaVideoWindow = new VideoWindow (); MediaVideoWindow.m_CVM = m_CVM; MediaVideoWindow.TimeToStop = m_CVM.TimeToStop; double TargetPictureWidth = 1920; double TargetPictureHeight = 1080; Rectangle VideoGeometry = m_CVM.VideoRectangle; //System.Drawing.Rectangle [] ScreenParameter = CVM.CommonValues.GetPhysicalScreenBounds (); //double ScreenWidth = ScreenParameter [0].Width; //double ScreenHeight = ScreenParameter [0].Height; double ScreenWidth = VideoGeometry.Width; double ScreenHeight = VideoGeometry.Height; double ScreenAspectRatio = ScreenWidth / ScreenHeight; double TargetAspectRatio = TargetPictureWidth / TargetPictureHeight; double ScreenSizeFactor = 1; if (TargetAspectRatio >= ScreenAspectRatio) { ScreenSizeFactor = ScreenWidth / TargetPictureWidth; } else { ScreenSizeFactor = ScreenHeight / TargetPictureHeight; } double XCorrecturPosition = 0; double YCorrecturPosition = 0; if (Math.Abs (TargetAspectRatio - ScreenAspectRatio) > 0.0001) { if (TargetAspectRatio > ScreenAspectRatio) { YCorrecturPosition = ((ScreenHeight - (ScreenWidth / TargetAspectRatio)) / 2); } else { XCorrecturPosition = ((ScreenWidth - (ScreenHeight * TargetAspectRatio)) / 2); } } System.Drawing.Rectangle OverallVideoRectangle = m_CVM.VideoRectangle; Rect VideoRectangle = new Rect (400, 300, 700, 480); VideoRectangle.X *= ScreenSizeFactor; VideoRectangle.X += VideoGeometry.X; VideoRectangle.Y *= ScreenSizeFactor; VideoRectangle.Y += VideoGeometry.Y; VideoRectangle.Width *= ScreenSizeFactor; VideoRectangle.Height *= ScreenSizeFactor; VideoRectangle.X += (int)XCorrecturPosition; VideoRectangle.Y += (int)YCorrecturPosition; MediaVideoWindow.VideoRectangle = VideoRectangle; if (CVM.CommonValues.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "ScreenRectangle X = " + Convert.ToString (VideoGeometry.X) + "\r\n" + "ScreenParameter Y = " + Convert.ToString (VideoGeometry.Y) + "\r\n" + "ScreenParameter Width = " + Convert.ToString (VideoGeometry.Width) + "\r\n" + "ScreenParameter Height = " + Convert.ToString (VideoGeometry.Height) + "\r\n" ); if (CVM.CommonValues.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "VideoRectangle X = " + Convert.ToString (VideoRectangle.X) + "\r\n" + "VideoRectangle Y = " + Convert.ToString (VideoRectangle.Y) + "\r\n" + "VideoRectangle Width = " + Convert.ToString (VideoRectangle.Width) + "\r\n" + "VideoRectangle Height = " + Convert.ToString (VideoRectangle.Height) + "\r\n" ); if (CVM.CommonValues.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "VideoFileName = \"" + VideoName + "\"\r\n" + "StopTime = " + m_CVM.TimeToStop.ToString () ); MediaVideoWindow.VideoFileName = VideoName; MediaVideoWindow.TimeToStop = m_CVM.TimeToStop; MediaVideoWindow.Show (); return MediaVideoWindow; }
void StartLiveVideo (DataRow PageRow, DataRow FrameContentRow, DataRow VideoRow) { MediaVideoWindow = new VideoWindow (); MediaVideoWindow.Cursor = Cursors.None; MediaVideoWindow.m_CVM = m_HostCVM; MediaVideoWindow.VideoRectangle = ActuallGraphicsHandler.CreateScreenRectFromFrame (m_HostCVM.VideoRectangle, VideoRow); #if DEBUG String FileAccessor = ActuallGraphicsHandler.GetPacketVideoFileAccessor (PageRow, FrameContentRow, VideoRow); String Extension = String.Empty; MediaVideoWindow.VideoFileNameUri = ActuallGraphicsHandler.GetUriFromFileElement (FileAccessor, ref Extension); if (MediaVideoWindow.VideoFileNameUri != null) { FileStream FullPackage = null; String PackageName = MediaVideoWindow.VideoFileNameUri.Host.Substring (8).Replace (",", "\\"); if (File.Exists (PackageName)) { // ActuallGraphicsHandler.Close (); // FullPackage = new FileStream (PackageName, FileMode.Open, System.IO.FileAccess.Read, FileShare.Read); } else { MediaVideoWindow.VideoFileNameUri = null; MediaVideoWindow.VideoFileNames = ActuallGraphicsHandler.GetVideoMaterialFileNamesFromFrameRow (PageRow, FrameContentRow, VideoRow); } } else { MediaVideoWindow.VideoFileNames = ActuallGraphicsHandler.GetVideoMaterialFileNamesFromFrameRow (PageRow, FrameContentRow, VideoRow); } #else MediaVideoWindow.VideoFileNames = ActuallGraphicsHandler.GetVideoMaterialFileNamesFromFrameRow (PageRow, FrameContentRow, VideoRow); #endif MediaVideoWindow.TimeToStop = m_HostCVM.TimeToStop; if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "ScreenRectangle X = " + Convert.ToString (MediaVideoWindow.VideoRectangle.X) + "\r\n" + "ScreenParameter Y = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Y) + "\r\n" + "ScreenParameter Width = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Width) + "\r\n" + "ScreenParameter Height = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Height) + "\r\n" ); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "VideoRectangle X = " + Convert.ToString (MediaVideoWindow.VideoRectangle.X) + "\r\n" + "VideoRectangle Y = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Y) + "\r\n" + "VideoRectangle Width = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Width) + "\r\n" + "VideoRectangle Height = " + Convert.ToString (MediaVideoWindow.VideoRectangle.Height) + "\r\n" ); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaRunStandBildTV.RunTheVideo", "VideoFileName (Accessor) = \"" + MediaVideoWindow.VideoFileNames [0] + "\"\r\n" + "StopTime = " + m_HostCVM.TimeToStop.ToString () ); MediaVideoWindow.Show (); }