Example #1
0
		public virtual Stream OnStreamRequested(Image image)
			{
			if (StreamRequested == null && FileRequested == null)
				return null;

			if (StreamRequested != null)
				{
				return StreamRequested(image);
				}
			return File.Open(FileRequested?.Invoke(image), FileMode.Open);
			}
Example #2
0
		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;
			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 void FillPlayerVisualFromMMLayoutConnector(Image newImage, MMPartsElementeLayoutConnector layoutConnector)
			{
			newImage.NameId = layoutConnector.MMElement.NameId;
			newImage.PositionLeft = layoutConnector.ConnectedElementLayout.PositionLeft;
			newImage.PositionTop = layoutConnector.ConnectedElementLayout.PositionTop;
			newImage.PositionRight = 100 - layoutConnector.ConnectedElementLayout.PositionRight;
			newImage.PositionBottom = 100 - layoutConnector.ConnectedElementLayout.PositionBottom;
			newImage.BorderColor = layoutConnector.ConnectedElementLayout.BackGround;
			newImage.Background = layoutConnector.ConnectedElementLayout.BackGround;
			newImage.ImageId = layoutConnector.MMElement.PictureId;
			FileInfo targetFileInfo = null;
			BitmapSource bitmapSource = null;
			Byte[] FileFormatedValue = null;
			switch (layoutConnector.MMElement.MMElementTyp.TypNameId)
				{
				case "JPGPicture":
					{
					targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid) layoutConnector.MMElement.PictureId,
						layoutConnector.MMElement.TextId, "jpg");
					if (!targetFileInfo.Exists)
						{
						layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo);
						}
					break;
					}
				case "PNGPicture":
					{
					targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid) layoutConnector.MMElement.PictureId,
						layoutConnector.MMElement.TextId, "png");
					if (!targetFileInfo.Exists)
						{
						layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo);
						}
					break;
					}
				case "BMPPicture":
					{
					targetFileInfo = VisualBasics.CreateImageCacheFileInfo((Guid) layoutConnector.MMElement.PictureId,
						layoutConnector.MMElement.TextId, "bmp");
					if (!targetFileInfo.Exists)
						{
						layoutConnector.MMElement.Get_Value().SaveTo_File(targetFileInfo);
						}
					break;
					}
				case "DynamicPicture":
					{
					targetFileInfo = VisualBasics.CreateImageCacheFileInfo($"{layoutConnector.MMElement.ValueFileReference}",
						layoutConnector.MMElement.TextId, "jpg");
					break;
					}
				case "DynamicOverlayPicture":
					{
					targetFileInfo = VisualBasics.CreateImageCacheFileInfo($"{layoutConnector.MMElement.ValueFileReference}",
						layoutConnector.MMElement.TextId, "png");
					break;
					}
				default:
					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;

			}
Example #4
0
		public virtual string OnFileRequested(Image image)
			{
			return FileRequested?.Invoke(image);
			}