Esempio n. 1
0
		private void PrepareAllForPage(MMPart mmPart)
			{
			foreach (MMPartsElementeLayoutConnector layoutConnector in mmPart.MMPartsElementeLayoutConnectoren
				.OrderBy(ord => ord.DefaultedProcessingOrder))
				{
				if ((layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Logo")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "DynamicPicture")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Programm")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Bild"))
					{
					PrepareAllForImage(layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Video")
					{
					PrepareAllForVideo(layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Text")
					{
					PrepareAllForText(layoutConnector);
					}
				else
					{
					throw new Exception($"{layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId} nicht implementiert");
					}
				}
			}
Esempio n. 2
0
		public static BitmapSource FullSizePagePicture(MMPart mMPart)
			{
			MMUnit unit = mMPart.MMUnit;
			Rect fullPageDrawingRect = new Rect(new Size((double)mMPart.MMUnit.MMUnitTyp.TargetPictureWidth.GetValueOrDefault(),
							(double)mMPart.MMUnit.MMUnitTyp.TargetPictureHeight.GetValueOrDefault()));
			RenderTargetBitmap finalDrawingBitmap = new RenderTargetBitmap((int)fullPageDrawingRect.Width,
							(int)fullPageDrawingRect.Height, 96, 96, PixelFormats.Pbgra32);
			DrawingVisual DrawingBoard = new DrawingVisual();
			DrawingContext BoardContext = DrawingBoard.RenderOpen();
			BoardContext.DrawRectangle(Brushes.Red, null, fullPageDrawingRect);
			FormattedText FormattedTextToDisplay = null;
			Typeface DefaultTypeface = new Typeface(new FontFamily("Verdana"), FontStyles.Normal,
				 FontWeights.Bold, FontStretches.Normal, new FontFamily("Arial"));
			BrushConverter BRConverter = new BrushConverter();
			Brush TextBrush = Brushes.Red;
			foreach (MMPartsElementeLayoutConnector mmPartsElementeLayoutConnector
				in mMPart.MMPartsElementeLayoutConnectoren.OrderBy(ord => ord.ProcessingOrder))
				{
				MMElementLayout mMElementLayout = mmPartsElementeLayoutConnector.ConnectedElementLayout;
				if (mMElementLayout == null)
					continue;
				Rect partElementRect = CreateDrawingRectFromElementLayout(fullPageDrawingRect, mMElementLayout);
				if (mMElementLayout.MMElementLayoutTyp.TypNameId == "Video")
					{
//					InsertVideoFrame(BoardContext, ElementToDraw);
					}
				if (mMElementLayout.MMElementLayoutTyp.TypNameId == "Programm")
					{
//					InsertProgrammFrame(BoardContext, ElementToDraw);
					}
				if (mMElementLayout.MMElementLayoutTyp.TypNameId == "Bild")
					{
					InsertBildFrame(BoardContext, finalDrawingBitmap, partElementRect, mMElementLayout);
					}
				if (mMElementLayout.MMElementLayoutTyp.TypNameId == "Logo")
					{
					InsertBildFrame(BoardContext, finalDrawingBitmap, partElementRect, mMElementLayout);
					}
				if (mMElementLayout.MMElementLayoutTyp.TypNameId == "Text")
					{
					InsertTextFrame(BoardContext, finalDrawingBitmap, partElementRect, mMElementLayout);
					}

				}
			BoardContext.Close();           // by sac
			DrawingGroup drawing = DrawingBoard.Drawing;
			DrawingCollection collection = drawing.Children;
			finalDrawingBitmap.Render(DrawingBoard);
			return (BitmapSource)BitmapFrame.Create(finalDrawingBitmap);

			}
		private bool CreatePlayerPage(MMPart mmPart, PageGroup parentGroup)
			{
			Page newPage = ActuallPlayerDb.Pages.NewRow();
			newPage.Id = mmPart.Id;
			newPage.NameId = mmPart.NameId;
			newPage.ExpectedDuration = mmPart.PlayingDuration;
			newPage.PageGroup = parentGroup;
			newPage.SortOrder = mmPart.SortOrder;
			newPage.BorderColor = String.Empty;
			newPage.Background = String.Empty;
			newPage.Background = "White";
			newPage.HasFixedRatio = true;
			newPage.RatioX = 16;
			newPage.RatioY = 9;
			newPage.Table.Rows.Add(newPage);


			foreach (MMPartsElementeLayoutConnector layoutConnector in mmPart.MMPartsElementeLayoutConnectoren
				.OrderBy(ord => ord.DefaultedProcessingOrder))
				{
				if ((layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Logo")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "DynamicPicture")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Programm")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Bild"))
					{
					CreatePlayerImage(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Video")
					{
					CreatePlayerVideo(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Text")
					{
					CreatePlayerText(newPage, layoutConnector);
					}
				else
					{
					throw new Exception($"{layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId} nicht implementiert");
					}
				}

			return true;
			}
Esempio n. 4
0
		private void CreatePlayerPage(MMPart mmPart)
			{
			Page newPage = TargetPlayerDb.Pages.NewRow();
			newPage.Id = mmPart.Id;
			newPage.DiagnosticText = mmPart.NameId;
			newPage.ExpectedDuration = (double)mmPart.PlayingDuration;
			newPage.PageGroup = TargetPageGroup;
			newPage.SortOrder = (int)mmPart.SortOrder;
			newPage.BorderColor = string.Empty;
			newPage.Background = string.Empty;
			newPage.Background = "White";
			newPage.HasFixedRatio = true;
			newPage.RatioX = 16;
			newPage.RatioY = 9;
			newPage.Table.Rows.Add(newPage);


			foreach (MMPartsElementeLayoutConnector layoutConnector in mmPart.MMPartsElementeLayoutConnectoren
				.OrderBy(ord => ord.DefaultedProcessingOrder))
				{
				if ((layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Logo")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "DynamicPicture")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Programm")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Bild"))
					{
					CreateImage(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Video")
					{
					CreateVideo(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Text")
					{
					CreateText(newPage, layoutConnector);
					}
				else
					{
					throw new Exception($"{layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId} nicht implementiert");
					}
				}
			}
Esempio n. 5
0
		private void CreatePlayerPage(MMPart mmPart)
			{
			HsCentralServiceWebInterfacesServer._dbs.hsserver.ringplayerdb.rows.Page newPage = TargetPlayerDb.Pages.NewRow();
			newPage.Id = mmPart.Id;
#if DEBUG
			if (String.IsNullOrWhiteSpace(mmPart.NameId))
				newPage.DiagnosticText = $"{mmPart.MMUnit.MMUnitTyp.TypNameId} {mmPart.MMUnit.NameId} Seite {mmPart.SortOrder}";
			else
				newPage.DiagnosticText = mmPart.NameId;
#endif
			newPage.ExpectedDuration = (double)mmPart.PlayingDuration;
			newPage.PageGroup = TargetPageGroup;
			newPage.SortOrder = (int)mmPart.SortOrder;
			newPage.BorderColor = string.Empty;
			newPage.Background = string.Empty;
			newPage.Background = "White";
			newPage.HasFixedRatio = true;
			newPage.RatioX = 16;
			newPage.RatioY = 9;
			newPage.Table.Rows.Add(newPage);


			foreach (MMPartsElementeLayoutConnector layoutConnector in mmPart.MMPartsElementeLayoutConnectoren
				.OrderBy(ord => ord.DefaultedProcessingOrder))
				{
				if ((layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Logo")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "DynamicPicture")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Programm")
					|| (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Bild"))
					{
					CreateImage(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Video")
					{
					CreateVideo(newPage, layoutConnector);
					}
				else
				if (layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId == "Text")
					{
					CreateText(newPage, layoutConnector);
					}
				else
					{
					throw new Exception($"{layoutConnector.MMPartsElementeLayoutConnectorTyp.TypNameId} nicht implementiert");
					}
				}
			}
Esempio n. 6
0
		private MMPartsElementeLayoutConnector InsertTextMMElement(MMPart mMPart,
			int pageIndex, DataRow frameRow, DataRow frameContentRow)
			{
			if ((String.IsNullOrEmpty(frameRow["Text"].ToString()))
				&& (String.IsNullOrEmpty(frameContentRow["ItemName"].ToString()))
				&& (String.IsNullOrEmpty(frameRow["ItemName"].ToString())))
				return null;

			if (!String.IsNullOrEmpty(frameRow["Text"].ToString()))
				{
				MMElementLayout StoredLayout = ConvertFrameToMMElementeLayout(frameRow);
				MMPartsElementeLayoutConnector[] Result = Data.DbServer3.MultiMedia.MMPartsElementeLayoutConnectoren
					.Find_By_MMPartId(mMPart.Id)
					.Where(sel => sel.MMLayoutId == StoredLayout.Id).ToArray();
				MMPartsElementeLayoutConnector NewConnector;
				if (Result.Length > 0)
					{
					NewConnector = Result[0];
					}
				else
					NewConnector = Parent.AddNewLayoutConnector(mMPart.Id,
						null, StoredLayout.Id, "Text");
				NewConnector.TextToProcess = StoredLayout.Text;
				StoredLayout.MMPartsElementeLayoutConnectorId = NewConnector.Id;
				return NewConnector;
				}

			if (!String.IsNullOrEmpty(frameContentRow["ItemName"].ToString()))
				{
				String FrameContentItemName = frameContentRow["ItemName"].ToString();
				MMElement ExistingTextElement = CheckForExistingTextMMElement
					((Guid)mMPart.MMUnitId, "DynamicText", FrameContentItemName);
				if (ExistingTextElement != null)
					{
					if (String.IsNullOrEmpty(ExistingTextElement.DynamicText))
						return null;
					MMElementLayout StoredLayout = ConvertFrameToMMElementeLayout(frameRow);
					MMPartsElementeLayoutConnector[] Result = Data.DbServer3.MultiMedia.MMPartsElementeLayoutConnectoren
						.Find_By_MMPartId(mMPart.Id)
						.Where(sel => sel.MMLayoutId == StoredLayout.Id).ToArray();
					MMPartsElementeLayoutConnector NewConnector;
					if (Result.Length > 0)
						NewConnector = Result[0];
					else
						NewConnector = Parent.AddNewLayoutConnector(mMPart.Id,
							ExistingTextElement.Id, StoredLayout.Id, "Text");
					NewConnector.TextToProcess = ExistingTextElement.DynamicText;
					StoredLayout.MMPartsElementeLayoutConnectorId = NewConnector.Id;
					return NewConnector;
					}
				}

			if (!String.IsNullOrEmpty(frameRow["ItemName"].ToString()))
				{
				String frameItemName = frameRow["ItemName"].ToString();
				MMElement ExistingTextElement = CheckForExistingTextMMElement
					((Guid)mMPart.MMUnitId, "DynamicText", frameItemName);
				if (ExistingTextElement != null)
					{
					if (String.IsNullOrEmpty(ExistingTextElement.DynamicText))
						return null;
					MMElementLayout StoredLayout = ConvertFrameToMMElementeLayout(frameRow);
					MMPartsElementeLayoutConnector[] Result = Data.DbServer3.MultiMedia.MMPartsElementeLayoutConnectoren
						.Find_By_MMPartId(mMPart.Id)
						.Where(sel => sel.MMLayoutId == StoredLayout.Id).ToArray();
					MMPartsElementeLayoutConnector NewConnector;
					if (Result.Length > 0)
						NewConnector = Result[0];
					else
						NewConnector = Parent.AddNewLayoutConnector(mMPart.Id,
							ExistingTextElement.Id, StoredLayout.Id, "Text");
					NewConnector.TextToProcess = ExistingTextElement.DynamicText;
					StoredLayout.MMPartsElementeLayoutConnectorId = NewConnector.Id;
					return NewConnector;
					}
				}
			return null;
			}
Esempio n. 7
0
		private MMPartsElementeLayoutConnector InsertBildMMElement(MMPart mMPart, int pageIndex,
			DataRow frameRow, DataRow frameContentRow)
			{
			String Extension;
			String PictureName;
			byte[] bildPixelAsByteArray = Graphics.GetBildPixelFromContentRow(frameContentRow, frameRow, pageIndex.ToString(),
				out PictureName, out Extension);
			if (bildPixelAsByteArray == null)
				return null;
			MMPicture mmPicture = Data.DbServer3.MultiMedia.MMPictures
				.LoadOrCreate(bildPixelAsByteArray, PictureName, Extension);
			if (mmPicture == null)
				throw new Exception("mmPicture == null");
			String ElementTyp = Extension.ToUpper() + "Picture";
			MMElement NewElement = CheckForExistingPictureMMElement(mMPart.MMUnit.Id, ElementTyp, PictureName + "." + Extension);
			if (NewElement == null)
				{
				NewElement = Parent.AddNewElement(mMPart.MMUnit.Id, ElementTyp);
				NewElement.TextId = PictureName;
				NewElement.NameId = PictureName + "." + Extension;
				NewElement.PictureId = mmPicture.Id;
				//NewElement.Value = bildPixelAsByteArray;
				//NewElement.HashCode = NewElement.Value.Sha1Hash().ConvertTo_Hex();
				//NewElement.ValueThumb = NewElement.Value.ConvertTo_Image()
				//	.ResizeToMaximum(300, 200).ConvertTo_JpgByteArray(80);
				}
			MMElementLayout StoredLayout = ConvertFrameToMMElementeLayout(frameRow);
			MMPartsElementeLayoutConnector NewConnector = Parent.CheckForExistingMMPartsElementeLayoutConnector
				(mMPart.Id, NewElement.Id, StoredLayout.Id);
			if (NewConnector == null)
				{
				NewConnector = Parent.AddNewLayoutConnector(mMPart.Id, NewElement.Id, StoredLayout.Id, "Bild");
				}
			StoredLayout.MMPartsElementeLayoutConnectorId = NewConnector.Id;
			return NewConnector;
			}
Esempio n. 8
0
		private MMPartsElementeLayoutConnector InsertProgrammMMElement(MMPart mMPart, int pageIndex,
			DataRow frameRow, DataRow frameContentRow)
			{
			String ProgrammType = GetMaterialTypeFromFrameRow(frameContentRow, frameRow);
			String ControlAdressing = frameRow["ConverterParameter"].ToString();
			if (String.IsNullOrEmpty(ControlAdressing))
				return null;
			MMElementLayout StoredLayout = ConvertFrameToMMElementeLayout(frameRow);
			MMElement NewElement = CheckForExistingPictureMMElement(mMPart.MMUnit.Id, "DynamicPicture",
				frameRow["NameId"].ToString());
			if (NewElement == null)
				{
				NewElement = Parent.AddNewElement(mMPart.MMUnit.Id, "DynamicPicture",
					frameContentRow["TableName"].ToString(), mMPart.MMUnit.Id);
				NewElement.TextId = frameRow["NameId"].ToString();
				}
			MMPartsElementeLayoutConnector NewConnector = Parent.CheckForExistingMMPartsElementeLayoutConnector
				(mMPart.Id, NewElement.Id, StoredLayout.Id);
			if (NewConnector == null)
				{
				NewConnector = Parent.AddNewLayoutConnector(mMPart.Id, NewElement.Id, StoredLayout.Id, "DynamicPicture");
				}
			StoredLayout.MMPartsElementeLayoutConnectorId = NewConnector.Id;
			return NewConnector;
			}
Esempio n. 9
0
		private MMPartsElementeLayoutConnector InsertVideoMMElement(MMPart mMPart, int pageIndex, DataRow frameRow, DataRow frameContentRow)
			{
			return null;
			}
Esempio n. 10
0
		private MMPartsElementeLayoutConnector InsertOrSkipMMElement(MMPart mMPart, int pageIndex, DataRow frameContentRow, DataRow frameRow)
			{
			if (frameRow["Typ"].ToString() == "Video")
				{
				return InsertVideoMMElement(mMPart, pageIndex, frameRow, frameContentRow);
				}
			if (frameRow["Typ"].ToString() == "Programm")
				{
				return InsertProgrammMMElement(mMPart, pageIndex, frameRow, frameContentRow);
				}
			if (frameRow["Typ"].ToString() == "Bild")
				{
				return InsertBildMMElement(mMPart, pageIndex, frameRow, frameContentRow);
				}
			if (frameRow["Typ"].ToString() == "Logo")
				{
				return InsertBildMMElement(mMPart, pageIndex, frameRow, frameContentRow);
				}
			if (frameRow["Typ"].ToString() == "Text")
				{
				return InsertTextMMElement(mMPart, pageIndex, frameRow, frameContentRow);
				}
			return null;
			}
Esempio n. 11
0
		private static BitmapSource CreateEmptyDefaultPagePicture(MMPart part)
			{
			BitmapSource value = null;
			Rect DrawingRect = new Rect(new Size((double)part.MMUnit.MMUnitTyp.TargetPictureWidth.GetValueOrDefault(),
							(double)part.MMUnit.MMUnitTyp.TargetPictureHeight.GetValueOrDefault()));
			int stride = (int) DrawingRect.Width * 4;
			byte[] baseArray = new byte[(int) DrawingRect.Height * stride];
			for (int i = 0; i < baseArray.Length; i += 4)
				{
				baseArray[i] = 0x00;
				baseArray[i + 1] = (byte)(i % 256);
				baseArray[i + 2] = (byte)(i % 64);
				baseArray[i + 3] = (byte)(256 - (i % 256));
				}
			value = BitmapSource.Create((int)DrawingRect.Width, (int)DrawingRect.Height, 96, 96,
				PixelFormats.Bgra32, null, baseArray, stride);
			return value;
			}