public List<BitmapSource> GetPicturesFromPackage (String originalPackageFileName, Size TargetSize, bool FullAndThumbMixed = false) { String packageFileName = GetCorrectPackageFileName(originalPackageFileName); if (String.IsNullOrEmpty(packageFileName)) { return new List<BitmapSource>() ; } GraphicsHandling GraphicsHandler = new GraphicsHandling(); GraphicsHandler.GetInstatiatedPackage(packageFileName, false); GraphicsHandler.CreateAndStoreFinalPictures(); List<BitmapSource> Result = GraphicsHandler.GetResizedPictures(GraphicsHandler.FinalPictures, TargetSize, FullAndThumbMixed); GraphicsHandler.Close(); return Result; }
private GraphicsHandling LoadAndInstatiatePkgData () { String ControlFileName = Path.Combine (WPMediaRoot, m_StandBildPlayingData.NameOfActiveDescription () ); GraphicsHandling GraphicsHandler = null; if (String.Compare (Path.GetExtension (ControlFileName).ToUpper (), ".PKG") != 0) { ControlFileName = Path.Combine (Path.GetDirectoryName (ControlFileName), Path.GetFileNameWithoutExtension (ControlFileName) + ".pkg"); } if (IsDoubleClickRunMethode ()) { ControlFileName = GetDoubleClickRunMethodeControlFile (); } if (!File.Exists (ControlFileName)) { WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".LoadAndInstatiatePkgData", "Der File \"" + ControlFileName + "\" aus der Tabelle \"" + m_StandBildPlayingData.TableName + "\" fehlt"); return null; } try { GraphicsHandler = new GraphicsHandling (WPMediaRoot); String IDToProcess = Path.GetFileNameWithoutExtension (ControlFileName); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("StandBildTV.LoadAndInstatiatePkgData", "NewPackageID = " + IDToProcess + "\r\nwird gestartet"); if (GraphicsHandler.GetInstatiatedPackage (ControlFileName) == null) { if (IsDoubleClickRunMethode()) MessageBox.Show ("Fehler in der Definition der Tabelle\r\n\"" + m_StandBildPlayingData.TableName + "\"\r\nes konnte kein Package erzeugt werden - Abbruch"); CloseRequestedCall (this, "Format Fehler bei \"" + m_StandBildPlayingData.TableName + "\""); return null; } if (GraphicsHandler.CheckPackageConsistence () != true) { if (IsDoubleClickRunMethode()) MessageBox.Show("Fehler in der zugeordneten ID der Tabelle\r\nbei Filename \"" + ControlFileName + "\"bei der Tabelle \"" + m_StandBildPlayingData.TableName + "\"\r\nund der ID \"" + GraphicsHandler.ActuallReadableContentRow ["ID"].ToString () + "\"\r\nwar der Filename ungleich der internen ID - Abbruch"); else { WMB.Basics.ReportErrorToEventViewer("Fehler in der zugeordneten ID der Tabelle\r\nbei Filename \"" + ControlFileName + "\"bei der Tabelle \"" + m_StandBildPlayingData.TableName + "\"\r\nund der ID \"" + GraphicsHandler.ActuallReadableContentRow["ID"].ToString() + "\"\r\nwar der Filename ungleich der internen ID - Abbruch"); } return null; } GraphicsHandler.CreateAndStoreFinalPictures (); //GraphicsHandler.Close (); List<String> DisplayHelpList = new List<String> (); foreach (double PlayLength in GraphicsHandler.PageDurations) DisplayHelpList.Add (Convert.ToString (PlayLength)); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("StandBildTV.LoadAndInstatiatePkgData", "NewPackageID = " + IDToProcess + " ist gestartet worden\r\n" + "NameID = " + GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString () + "\r\nDurations per Page = " + String.Join (", ",DisplayHelpList.ToArray ())); this.Width = m_HostCVM.VideoWidth; this.Height = m_HostCVM.VideoHeight; } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".FillData", "Folgender Fehler trat beim ControlFile \"" + ControlFileName + "\":\r\n" + Excp.ToString()); return null; } return GraphicsHandler; }