Beispiel #1
0
		private void ConvertToMMUnitsLoop(ButtonData parentButton, Object ParentObject, int level)
			{
			if (!EntriesPerLevel.ContainsKey(level))
				EntriesPerLevel[level] = 0;
			int sortOrder = 0;
			foreach (ButtonData buttonData in allOldButton
						.Where(whe => whe.ParentButton != null
						&& whe.ParentButton == parentButton).OrderBy(ord => ord.Row).ToArray())
				{
				MMUnit RootMMUnit = null;
				DbEntities.dbserver3.multimedia.rows.Page contentPage = null;
				if (level == 0)
					{
					RootMMUnit = Data.DbServer3.MultiMedia.MMUnits.FindOrLoad(buttonData.Id);
					if (RootMMUnit != null)
						{
						RootMMUnit.Delete();
						Data.DbServer3.MultiMedia.SaveKatabolic(new Object());
						Data.DbServer3.MultiMedia.AcceptChanges();
						}
					RootMMUnit = Data.DbServer3.MultiMedia.MMUnits.NewRow();
					RootMMUnit.Id = buttonData.Id;
					if (String.IsNullOrWhiteSpace(buttonData.NameId))
						buttonData.NameId = "Fahrplan";
					RootMMUnit.NameId = buttonData.NameId;
					RootMMUnit.Title = buttonData.Text;
					if (buttonData.EntryType == "Entry")
						RootMMUnit.MMUnitTyp = mmUnitTypForButtonData;
					if (buttonData.EntryType == "StaticEntry")
						RootMMUnit.MMUnitTyp = mmUnitTypForButtonDataStatic;
					RootMMUnit.Table.Rows.Add(RootMMUnit);
					RootMMUnit.PagingType = DirectPlayerPage;
					Data.DbServer3.MultiMedia.MMUnits.SaveChanges(new Object());
					Data.DbServer3.MultiMedia.MMUnits.AcceptChanges();
					}
				contentPage = Data.DbServer3.MultiMedia.Pages.NewRow();
				contentPage.Id = buttonData.Id;
				contentPage.SortOrder = ++sortOrder;
				contentPage.DiagnosticText = buttonData.NameId;
				if (level == 0)
					{
					contentPage.MMUnit = RootMMUnit;
					}
				else
					{
					contentPage.ParentPage = ParentObject as DbEntities.dbserver3.multimedia.rows.Page;
					}
				contentPage.Table.Rows.Add(contentPage);
				
				AddDrawingElements(buttonData, contentPage);
				Data.DbServer3.MultiMedia.SaveAnabolic(new Object());
				Data.DbServer3.MultiMedia.AcceptChanges();
				ConvertToMMUnitsLoop(buttonData, contentPage, level + 1);
				EntriesPerLevel[level]++;
				LoopCounter++;
				}

			}
Beispiel #2
0
		/*
										private void ConvertToMMUnitsLoop(ButtonData parentButton, Object ParentObject, int level)
											{
											if (!EntriesPerLevel.ContainsKey(level))
												EntriesPerLevel[level] = 0;
											int sortOrder = 0;
											foreach (ButtonData buttonData in allOldButton
														.Where(whe => whe.ParentButton != null
														&& whe.ParentButton == parentButton).OrderBy(ord => ord.Row).ToArray())
												{
												MMUnit RootMMUnit = null;
												DbEntities.dbserver3.multimedia.rows.Page contentPage = null;
												if (level == 0)
													{
													RootMMUnit = Data.DbServer3.MultiMedia.MMUnits.FindOrLoad(buttonData.Id);
													if (RootMMUnit != null)
														{
														RootMMUnit.Delete();
														Data.DbServer3.MultiMedia.SaveKatabolic(new Object());
														Data.DbServer3.MultiMedia.AcceptChanges();
														}
													RootMMUnit = Data.DbServer3.MultiMedia.MMUnits.NewRow();
													RootMMUnit.Id = buttonData.Id;
													if (String.IsNullOrWhiteSpace(buttonData.NameId))
														buttonData.NameId = "Fahrplan";
													RootMMUnit.NameId = buttonData.NameId;
													RootMMUnit.Title = buttonData.Text;
													if (buttonData.EntryType == "Entry")
														RootMMUnit.MMUnitTyp = mmUnitTypForButtonData;
													if (buttonData.EntryType == "StaticEntry")
														RootMMUnit.MMUnitTyp = mmUnitTypForButtonDataStatic;
													RootMMUnit.Table.Rows.Add(RootMMUnit);
													RootMMUnit.PagingType = DirectPlayerPage;
													Data.DbServer3.MultiMedia.MMUnits.SaveChanges(new Object());
													Data.DbServer3.MultiMedia.MMUnits.AcceptChanges();
													}
												contentPage = Data.DbServer3.MultiMedia.Pages.NewRow();
												contentPage.Id = buttonData.Id;
												contentPage.SortOrder = ++sortOrder;
												contentPage.DiagnosticText = buttonData.NameId;
												if (level == 0)
													{
													contentPage.MMUnit = RootMMUnit;
													}
												else
													{
													contentPage.ParentPage = ParentObject as DbEntities.dbserver3.multimedia.rows.Page;
													}
												contentPage.Table.Rows.Add(contentPage);

												AddDrawingElements(buttonData, contentPage);
												Data.DbServer3.MultiMedia.SaveAnabolic(new Object());
												Data.DbServer3.MultiMedia.AcceptChanges();
												ConvertToMMUnitsLoop(buttonData, contentPage, level + 1);
												EntriesPerLevel[level]++;
												LoopCounter++;
												}

											}
								*/
		private void AddDrawingElements(ButtonData buttonData, DbEntities.dbserver3.multimedia.rows.Page page)
			{
			XmlDocument FileContent = null;
			if (!String.IsNullOrWhiteSpace(buttonData.FileName))
				{
				FileInfo fileInfo = new FileInfo(Path.Combine(@"\\webserver2\WPMediaSender\Haus\ButtonData",
					buttonData.FileName));
				if (fileInfo.Exists)
					{
					FileContent = new XmlDocument();
					FileContent.Load(fileInfo.FullName);
					}
				}
			if (!String.IsNullOrWhiteSpace(buttonData.ImageAfter))
				{
				String OldButtonRootDirectory = @"D:\WPMediaSender\AutoContent\ButtonData";
				FileInfo imageFileInfo = new FileInfo(Path.Combine(OldButtonRootDirectory, buttonData.ImageAfter));
				if (imageFileInfo.Exists)
					{
					Byte[] pictureBytes = imageFileInfo.LoadAs_ByteArray();
					String extension = Path.GetExtension(imageFileInfo.Name).Replace(".", "").ToLower();
					MMPicture picture = Data.DbServer3.MultiMedia.MMPictures.LoadOrCreate(pictureBytes,
						Path.GetFileNameWithoutExtension(imageFileInfo.Name), extension);
					Image newImage = Data.DbServer3.MultiMedia.Images.NewRow();
					newImage.Id = Guid.NewGuid();
					newImage.Page = page;
					newImage.DiagnosticText = $"Image zu {buttonData.NameId}";
					newImage.Extension = extension;
					newImage.SortOrder = 1;
					newImage.MMPicture = picture;
					newImage.Background = Colors.Transparent.ToString();
					newImage.BorderThickness = new Thickness(0).ToString();
					newImage.MarginThickness = new Thickness(0).ToString();
					newImage.Rotation = 0D;
					newImage.Table.Rows.Add(newImage);

					}
				}
			if (buttonData.LinkType == "ButtonPage")
				return;
			if ((buttonData.LinkType == "Internet")
				&& (!String.IsNullOrWhiteSpace(buttonData.LinkData)))
				{
				Link newLink = Data.DbServer3.MultiMedia.Links.NewRow();
				newLink.Id = Guid.NewGuid();
				newLink.Page = page;
				newLink.DiagnosticText = $"Link zu {buttonData.NameId}";
				newLink.SortOrder = 1;
				newLink.LinkColumn = buttonData.LinkData;
				newLink.FontWeight = FontWeights.ExtraLight.ToString();
				newLink.Foreground = Colors.Black.ToString();
				newLink.MarginThickness = new Thickness(0).ToString();
				newLink.Table.Rows.Add(newLink);
				}

			if ((buttonData.LinkType == "Content")
				&& (!String.IsNullOrWhiteSpace(buttonData.LinkData)))
				{
				Text newText = Data.DbServer3.MultiMedia.Texts.NewRow();
				newText.Id = Guid.NewGuid();
				newText.Page = page;
				newText.DiagnosticText = $"Text zu {buttonData.NameId}";
				newText.SortOrder = 1;
				newText.TextColumn = buttonData.LinkData;
				newText.FontWeight = FontWeights.ExtraLight.ToString();
				newText.Foreground = Colors.Black.ToString();
				newText.MarginThickness = new Thickness(0).ToString();
				newText.Table.Rows.Add(newText);
				}

			}