private void CreateImage(Page parentPage, MMPartsElementeLayoutConnector layoutConnector) { Image newImage = TargetPlayerDb.Images.NewRow(); newImage.Id = Guid.NewGuid(); newImage.Page = parentPage; ApplyLayout(newImage, layoutConnector); newImage.Table.Rows.Add(newImage); }
private void ApplyLayout(Video newVideo, MMPartsElementeLayoutConnector layoutConnector) { newVideo.MarginThickness = layoutConnector.MarginThickness.ToString(); //newVideo.PositionLeft = (double)layoutConnector.ConnectedElementLayout.PositionLeft; //newVideo.PositionTop = (double)layoutConnector.ConnectedElementLayout.PositionTop; //newVideo.PositionRight = (double)(100 - layoutConnector.ConnectedElementLayout.PositionRight); //newVideo.PositionBottom = (double)(100 - layoutConnector.ConnectedElementLayout.PositionBottom); newVideo.SortOrder = layoutConnector.MMElement.DefaultedSortOrder; newVideo.BorderColor = layoutConnector.ConnectedElementLayout.BackGround; newVideo.Background = layoutConnector.ConnectedElementLayout.BackGround; }
private void ApplyLayout(Image newImage, MMPartsElementeLayoutConnector layoutConnector) { newImage.DiagnosticText = layoutConnector.MMElement.NameId; newImage.MarginThickness = layoutConnector.MarginThickness.ToString(); //newImage.PositionLeft = (double)layoutConnector.ConnectedElementLayout.PositionLeft; //newImage.PositionTop = (double)layoutConnector.ConnectedElementLayout.PositionTop; //newImage.PositionRight = (double)(100 - layoutConnector.ConnectedElementLayout.PositionRight); //newImage.PositionBottom = (double)(100 - layoutConnector.ConnectedElementLayout.PositionBottom); newImage.BorderColor = layoutConnector.ConnectedElementLayout.BackGround; newImage.Background = layoutConnector.ConnectedElementLayout.BackGround; newImage.FileIdentifier = (Guid)layoutConnector.MMElement.PictureId; newImage.Extension = layoutConnector.MMElement.MMPicture.PlayerFileNameReference.IsNullOrEmpty() ? ".unknown" : layoutConnector.MMElement.MMPicture.PlayerFileNameReference.Substring( layoutConnector.MMElement.MMPicture.PlayerFileNameReference.LastIndexOf(".")+1); //FileInfo targetFileInfo = // VisualBasics.GetCentralCacheFileInfo(layoutConnector.MMElement.MMPicture.PlayerFileNameReference); //BitmapSource bitmapSource = null; //Byte[] FileFormatedValue = null; //if (layoutConnector.MMElement.MMElementTyp.TypNameId == "JPGPicture") // { // targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid)layoutConnector.MMElement.PictureId, // layoutConnector.MMElement.TextId, "jpg"); // if (!targetFileInfo.Exists) // { // layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo); // } // } //else if (layoutConnector.MMElement.MMElementTyp.TypNameId == "PNGPicture") // { // targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid)layoutConnector.MMElement.PictureId, // layoutConnector.MMElement.TextId, "png"); // if (!targetFileInfo.Exists) // { // layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo); // } // } //else if (layoutConnector.MMElement.MMElementTyp.TypNameId == "BMPPicture") // { // targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid)layoutConnector.MMElement.PictureId, // layoutConnector.MMElement.TextId, "bmp"); // if (!targetFileInfo.Exists) // { // layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo); // } // } //else if (layoutConnector.MMElement.MMElementTyp.TypNameId == "DynamicPicture") // { // targetFileInfo = VisualBasics.CreateImageCacheFileInfo($"{layoutConnector.MMElement.ValueFileReference}", // layoutConnector.MMElement.TextId, "jpg"); // } //else if (layoutConnector.MMElement.MMElementTyp.TypNameId == "DynamicOverlayPicture") // { // targetFileInfo = VisualBasics.CreateImageCacheFileInfo($"{layoutConnector.MMElement.ValueFileReference}", // layoutConnector.MMElement.TextId, "png"); // } //else // throw new Exception($"falscher layoutConnector.MMElement.MMElementTyp.TypNameId " + // $"({layoutConnector.MMElement.MMElementTyp.TypNameId})"); //newImage.Extension = Path.GetExtension(targetFileInfo.FullName).Replace(".", "").ToLower(); newImage.SortOrder = layoutConnector.MMElement.DefaultedSortOrder; }
private bool ApplyLayout(Text newText, MMPartsElementeLayoutConnector layoutConnector) { newText.DiagnosticText = layoutConnector.MMElement.NameId; newText.MarginThickness = layoutConnector.MarginThickness.ToString(); if (!String.IsNullOrEmpty(layoutConnector.TextToProcess)) newText.TextColumn = layoutConnector.TextToProcess; else { newText.TextColumn = layoutConnector.MMElement.LocalText; //newText.TextColumn = "Find the source of this exception and see the following Line."; //throw new Exception("Find the source of this exception and see the following Line. " + // "The following line needs connection to other databases then Multimedia" + // "This is Subject to change and should be prevent in first place."); } //Could be letal, CS 16.28 if ((newText.TextColumn == "") || (newText.TextColumn == " ") || (newText.TextColumn == " ")) return false; if (String.IsNullOrEmpty(layoutConnector.ConnectedElementLayout.FontColor)) newText.Foreground = "Black"; else newText.Foreground = layoutConnector.ConnectedElementLayout.FontColor; if (String.IsNullOrEmpty(layoutConnector.ConnectedElementLayout.FontDescription)) newText.FontFamily = "Arial"; else newText.FontFamily = layoutConnector.ConnectedElementLayout.FontDescription; if (String.IsNullOrEmpty(layoutConnector.ConnectedElementLayout.FontStyle)) newText.FontWeight = "Normal"; else newText.FontWeight = layoutConnector.ConnectedElementLayout.FontStyle; if (String.IsNullOrEmpty(layoutConnector.ConnectedElementLayout.BackGround)) newText.Background = "Transparent"; else newText.Background = layoutConnector.ConnectedElementLayout.BackGround; newText.FontStyle = "Normal"; newText.SortOrder = layoutConnector.MMElement.DefaultedSortOrder; return true; }
private void CreateText(Page parentPage, MMPartsElementeLayoutConnector layoutConnector) { Text newText = TargetPlayerDb.Texts.NewRow(); newText.Id = Guid.NewGuid(); newText.Page = parentPage; if (ApplyLayout(newText, layoutConnector)) newText.Table.Rows.Add(newText); }
private void CreateVideo(Page parentPage, MMPartsElementeLayoutConnector layoutConnector) { Video newVideo = TargetPlayerDb.Videos.NewRow(); newVideo.Id = Guid.NewGuid(); newVideo.Page = parentPage; if (layoutConnector.MMElement.MMVideo == null) { throw new Exception($"Falsch generiertes {nameof(MMElement)}[{layoutConnector.MMElement.Id}]."); } if (layoutConnector.MMElement.MMVideo != null) { if (String.IsNullOrWhiteSpace(layoutConnector.MMElement.MMVideo.PlayerFileNameReference)) throw new FileNotFoundException ($"Bei der MMUnit {layoutConnector.MMElement.MMUnit.NameId} " + $"({layoutConnector.MMElement.MMUnit.Id}) beim VideoFile " + $"{layoutConnector.MMElement.MMVideo.OriginalDirectoryNameReference} ist keine " + $"PlayerFileNameReference eingetragen"); //FileInfo videoTargetFileName = // VisualBasics.GetPlayerCacheFileInfo(layoutConnector.MMElement.MMVideo.PlayerFileNameReference); FileInfo videoTargetFileName = VisualBasics.GetPlayerArchiveFileInfo (layoutConnector.MMElement.MMVideo.OriginalDirectoryNameReference, layoutConnector.MMElement.MMVideo.PlayerBestFittingSourceReference); newVideo.FileIdentifier = layoutConnector.MMElement.MMVideo.Id; newVideo.DiagnosticText = Path.GetFileNameWithoutExtension(videoTargetFileName.FullName); newVideo.Extension = Path.GetExtension(videoTargetFileName.FullName).Replace(".", ""); } ApplyLayout(newVideo, layoutConnector); newVideo.Table.Add(newVideo); }