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; }
private bool CheckAndDoPictureImportIfRequired (DataRow CreatedTableRow, List<String> MaterialElementeForThisInformation) { GraphicsHandling LayoutHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ()); LayoutHandler.RemoteWPMediaRoot = Basics.GetRemoteWPMediaRoot (); LayoutHandler.DoSQLBatchCall += new DoSQLBatchEvent (LayoutHandler_DoSQLBatchCall); WCFStandards DataBase = new WCFStandards (); DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; String TableName = CreatedTableRow.Table.TableName; String ID = CreatedTableRow ["ID"].ToString (); LayoutHandler.GetInstatiatedPackage (DataBase, TableName, ID); foreach (String MaterialEntry in MaterialElementeForThisInformation) { if (MaterialEntry.IndexOf ("StandBildPicture") == 0) { String MaterialLink = MaterialEntry.Replace ("StandBildPicture", "").Trim ('(').Trim (')'); Byte [] PictureContent = GetMaterialElementContent (MaterialLink); if ((PictureContent == null) || (PictureContent.Length == 0)) continue; String[] Controller = MaterialLink.Split (','); String PackageElementName = Controller [(int) WMB.DataWrapper.MaterialElementIndex.UsedSubEntryID]; LayoutHandler.AddFileFromStream (new MemoryStream (PictureContent), PackageElementName); } if (MaterialEntry.IndexOf ("_Bild1") != -1) { String MaterialLink = MaterialEntry.Replace ("BackGround", "").Trim ('(').Trim (')'); Byte [] PictureContent = GetMaterialElementContent (MaterialLink); if ((PictureContent == null) || (PictureContent.Length == 0)) continue; String [] Controller = MaterialLink.Split (','); String PackageElementName = Controller [(int) WMB.DataWrapper.MaterialElementIndex.UsedSubEntryID]; LayoutHandler.AddFileFromStream (new MemoryStream (PictureContent), PackageElementName + "." + Controller [(int)WMB.DataWrapper.MaterialElementIndex.UsedType]); } } LayoutHandler.CheckPackageConsistence (); String CreatedPackageFileName = LayoutHandler.Close (); return true; }