public static bool CreateOrModifyAsStandBildLayout (String FileNameToImport)
			{
			CVM.GraphicsHandling GraphicsHandler = new GraphicsHandling(Basics.GetLocalWPMediaRoot ());
			Object Pkg = GraphicsHandler.GetInstatiatedPackage (FileNameToImport);
			String TableName = GraphicsHandler.ActuallTableName;
			System.Guid ID = System.Guid.Parse (GraphicsHandler.ActuallReadableContentRow ["ID"].ToString ());
			String NameID = GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString ();
			GraphicsHandler.Close ();
			return CreateOrModifyAsStandBildLayout (TableName, ID, NameID);
			}
		private void FillGraphicsHandlerElements (TreeView Elemente)
			{
			TreeViewItem RootItem = new TreeViewItem ();
			Elemente.Items.Add (RootItem);
			GraphicsHandler = new GraphicsHandling(WMB.Basics.GetLocalWPMediaRoot ());
			GraphicsHandler.GetInstatiatedPackage (PackageFileName, false);
			RootItem.Header = GraphicsHandler.ActuallTableName + "/" +
			                  GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString ();

			CVM.DataSetViewer DataSetViewerInstance = new CVM.DataSetViewer ();

			Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem
				(GraphicsHandler.FrameDataDataSetReader, "FrameData in PKG"));

/*
			TreeViewItem SenderNameItem = new TreeViewItem ();
			Elemente.Items.Add (SenderNameItem);
			SenderNameItem.Header = ProgrammManagement.ProgrammData.SenderName;


			Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem
				(ProgrammManagement.ProgrammData.SchedulingDataSet, "SchedulingDataSet"));

			Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem
				(ProgrammManagement.ProgrammData.FutureSchedulingDataSet, "FutureSchedulingDataSet"));


			Elemente.Items.Add (DataSetViewerInstance.CreateDataTableStartTreeViewItem
				(ProgrammManagement.ProgrammData.OrderedTableOfProgrammBlocks, "OrderedTableOfProgrammBlocks"));

			TreeViewItem FullBeitragsListItem = new TreeViewItem ();
			FullBeitragsListItem.Header = "FullBeitragsList";
			Elemente.Items.Add (FullBeitragsListItem);
			foreach (String BeitragID in ProgrammManagement.ProgrammData.FullBeitragList.Keys)
				{
				DataSet FullBeitragDataSet = ProgrammManagement.ProgrammData.FullBeitragList [BeitragID];
				String BeitragName = BeitragID;
				if ((FullBeitragDataSet.Tables ["Beitraege"] != null)
					&& (FullBeitragDataSet.Tables ["Beitraege"].Rows.Count == 1))
					BeitragName = FullBeitragDataSet.Tables ["Beitraege"].Rows [0] ["Name"].ToString ();
				FullBeitragsListItem.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem
					(FullBeitragDataSet, BeitragName));

				}

*/
			}
		void CorrectThisEntry (String PackageName)
			{
			GraphicsHandling Handler = new GraphicsHandling ();
			Handler.GetInstatiatedPackage (PackageName, true);
			DataSet FrameDataSet = Handler.FrameDataDataSetReader;
			bool UpdateRequired = false;
			foreach (DataRow ContentRow in FrameDataSet.Tables ["FrameContent"].Select ("", "FrameOrder"))
				{
				String FrameContentID = "421156b1-f009-47c7-a6c6-913d7ab7dbd7";
				if (ContentRow ["ID"].ToString () == FrameContentID)
					UpdateRequired = true;
				if (!UpdateRequired)
					continue;
				String NameID = ContentRow ["NameID"].ToString ();
				String ItemName = ContentRow ["ItemName"].ToString ();
				if ((NameID == "KurzText")
					&& (ItemName == "LangTextSeite1"))
					{
					ContentRow ["NameID"] = "LangTextSeite1";
					ContentRow ["ItemName"] = "LangTextSeite1";
					continue;
					}
				if ((NameID == "LangtextSeite1")
					&& (ItemName == "LangTextSeite2"))
					{
					ContentRow ["NameID"] = "LangTextSeite2";
					continue;
					}
				if ((NameID == "LangtextSeite2")
					&& (ItemName == "LangTextSeite3"))
					{
					ContentRow ["NameID"] = "LangTextSeite3";
					continue;
					}
				if ((NameID == "LangtextSeite3")
					&& (ItemName == "LangTextSeite4"))
					{
					ContentRow ["NameID"] = "LangTextSeite4";
					continue;
					}
				if ((NameID == "LangtextSeite4")
					&& (ItemName == "LangTextSeite4"))
					{
					ContentRow ["NameID"] = "LangTextSeite5";
					ContentRow ["ItemName"] = "LangTextSeite5";
					continue;
					}
				String PictureName = ContentRow ["PictureName"].ToString ();
				}
			if (UpdateRequired == true)
				{
				Handler.RenewFrameDataSet (FrameDataSet);
				}
			Handler.Close ();
			}
Beispiel #4
0
		bool Instance_ChangeTextLayoutCall (object Sender, GraphicsHandling GraphiccHandler, DataRow FrameRow)
			{
			CommonUserInterfaceWindows FrameLayoutParameterWindow = new CommonUserInterfaceWindows ();
			FrameLayoutParameterWindow.DoIndividualDataCheckBeforeUpdateCall +=
				new DoIndividualDataCheckBeforeUpdateEvent (FrameLayoutParameterWindow_DoIndividualDataCheckBeforeUpdateCall);
			FrameLayoutParameterWindow.SetData (null, new CVM.ControlUserData ("Frames", "ID", "", true),
				null, null, FrameRow, "Bitte Layout korrigieren");
			return (bool) FrameLayoutParameterWindow.ShowDialog ();
			}
		private int  CreateOrCheckInternetJPGPicturesFor (String WPMediaRoot, GraphicsHandling GraphicsHandler)
			{
			if (GraphicsHandler == null)
				return 0;
			if (GraphicsHandler.ActuallReadableContentRow == null)
				{
				return 0;
				}
			String TableName = GraphicsHandler.ActuallTableName;
			String ID = GraphicsHandler.ActuallReadableContentRow ["ID"].ToString ();
			List<System.Windows.Media.Imaging.BitmapSource> PictureList = GraphicsHandler.GetFinalPictures ();
			String SubDirectoryName = WMB.Basics.GetSegmentedDirFileNameFromGuid (ID).Substring (0, 2);
			String RootDirectory = Path.Combine (Path.Combine (WPMediaRoot,
								 CVM.CommonValues.XML_AUTO_CONTENT_INTERNET_SOURCE), SubDirectoryName);
			if (!Directory.Exists (RootDirectory))
				Directory.CreateDirectory (RootDirectory);

			List<String> ExistingFiles = WMB.Basics.GetFilesFromDirectory (RootDirectory, new String [] {ID + "*.jpg"}, 1);
			foreach (String PictureNameToDelete in ExistingFiles)
				WMB.Basics.SecureFileDelete(PictureNameToDelete);

			int PictureIndex = 0;
			foreach (BitmapSource Picture in PictureList)
				{
				List<String> Names = GetNamesForInternetStandBildTV (RootDirectory, ID, PictureIndex);
				JpegBitmapEncoder JpgEncoder = new JpegBitmapEncoder();
				JpgEncoder.Frames.Add (BitmapFrame.Create (Picture));
				if (File.Exists (Names [0]))
					{
					MemoryStream PictureStream = new MemoryStream ();
					JpgEncoder.Save (PictureStream);
					if (WMB.Basics.IsTheContentEqual (Names [0], PictureStream))
						{
						if (!File.Exists (Names [1]))
							CVM.XAMLHandling.ResizePicture(Names[0], Names[1],
									200, 100, true, false);
						PictureIndex++;
						continue;
						}
					}
				JpegBitmapEncoder JpgDiskEncoder = new JpegBitmapEncoder ();
				JpgDiskEncoder.Frames.Add (BitmapFrame.Create (Picture));

				Stream Writer = File.Open (Names [0], FileMode.Create, FileAccess.Write);
				JpgDiskEncoder.Save (Writer);
				Writer.Close ();
				CVM.XAMLHandling.ResizePicture (Names [0], Names [1],
						200, 100, true, false);
				PictureIndex++;
				}
			PictureList.Clear ();

			FreeDisposeableElementsCall ();
			return PictureIndex;
			}
Beispiel #6
0
		private void FillFinalPages (GraphicsHandling GraphicsHandling)
			{
			PicturesTabControl.Items.Clear ();
			double TargetAspectRatio = GraphicsHandling.TargetPictureWidth / GraphicsHandling.TargetPictureHeight;
			double ResizingFactor = GraphicsHandling.TargetPictureWidth / DrawingWidth;
			Thickness BorderThickness = new Thickness ();
			BorderThickness.Left = 3;
			BorderThickness.Right = 3;
			BorderThickness.Top = 3;
			BorderThickness.Bottom = 3;
			BrushConverter BRConverter = new BrushConverter ();
			TabItem FinalSelectedItem = null;
			int PageIndex = 0;
			if (GraphicsHandling.PageIDsToPlay == null)
				return;
			foreach (String PageID in GraphicsHandling.PageIDsToPlay)
				{
				TabItem NewItem = DrawOneFinalPage (GraphicsHandling, PageID);
				if (FinalSelectedItem == null)
					FinalSelectedItem = NewItem;
				}
			PicturesTabControl.SelectedItem = FinalSelectedItem;
			if (!String.IsNullOrEmpty (m_WebLinkData))
				InsertWebBrowser (FinalSelectedItem, m_WebLinkData, m_WebSizing);
			PicturesTabControl.UpdateLayout ();
			}
Beispiel #7
0
		public TableProcessing ()
			{
			InitializeComponent ();
			ActuallyLockedIDs = new List<string> ();
            GraphicsHandling PreloadHelper = new GraphicsHandling();
			GraphicsSingleton.Instance.ModificationStatusChangedCall += new ModificationStatusChangedEvent (Instance_ModificationStatusChangedCall);
			GraphicsSingleton.Instance.ChangeTextLayoutCall += new GraphicsHandling.ChangeTextLayoutEvent (Instance_ChangeTextLayoutCall);
			GraphicsSingleton.Instance.ProcessTextInputCall += new GraphicsHandling.ProcessTextInputEvent (Instance_ProcessTextInputCall);
			}
		private void CheckAllFunctionality ()
			{
			int CorruptCounter = 0;
			foreach (ListViewItem ItemToProcess in AvailableEntries.Items)
				{
				String PackageToProcessName = ItemToProcess.Tag as String;
				m_GraphicsHandling = new GraphicsHandling (IntermediateStorageDirectory);
				Pkg = new PackagingHandler ();
				if (Pkg.OpenReadWrite (PackageToProcessName) == null)
					{
					ItemToProcess.Tag = "--- A -" + ItemToProcess.Tag as String;
					CorruptCounter++;
					ItemToProcess.IsEnabled = false;
					continue;
					}
				
				m_GraphicsHandling.DoStartupProcessing (Pkg);
				List<double> Durations = m_GraphicsHandling.PageDurations;
				ImageTabControl.Items.Clear ();
				int PageIndex = 0;
				if (m_GraphicsHandling.PageIDsToPlay == null)
					{
					ItemToProcess.Tag = "--- B -" + ItemToProcess.Tag as String;
					Pkg.ClosePackage ();
					CorruptCounter++;
					ItemToProcess.IsEnabled = false;
					continue;
					}
				if (m_GraphicsHandling.PageIDsToPlay.Count == 0)
					{
					ItemToProcess.Tag = "--- C -" + ItemToProcess.Tag as String;
					Pkg.ClosePackage ();
					CorruptCounter++;
					ItemToProcess.IsEnabled = false;
					continue;
					}
				m_GraphicsHandling.CheckAndRemoveUnuseableMaterials ();
				Pkg.ClosePackage ();

				}
			MessageBox.Show (CorruptCounter.ToString () + " falsche Einträge markiert");
			}
		private void DoDefaultCreationForOldPackages ()
			{
			DataSet AllTablesToProcess = m_DataBase.GetCommonDataSet ("Select * from TableDefinitions where "
			+ "ProcessingVersion = 'PKG_Version'");
			foreach (DataRow TableRow in AllTablesToProcess.Tables [0].Rows)
				{
				String TableName = TableRow ["TableName"].ToString ();

				String PathToFillWithEntries = Path.Combine( Path.Combine (RootDirectory, SubRoots [1]), TableName);
				String PathWithExistingEntries = Path.Combine(Path.Combine (RootDirectory, SubRoots [0]), TableName);
				List<String> OldSourceEntries = WMB.Basics.GetFilesFromDirectory (PathToFillWithEntries, new string [] {"*.pkg"}, 1);
				List<String> SourceEntries = WMB.Basics.GetFilesFromDirectory (PathWithExistingEntries, new string [] {"*.pkg"}, 1);
				DataSet AvailableEntriesDataSet = m_DataBase.GetCommonDataSet ("Select ID from " + TableName);
				foreach (DataRow ContentRow in AvailableEntriesDataSet.Tables [0].Rows)
					{
					String ID = ContentRow ["ID"].ToString ();
					bool ToProcess = false;
					foreach (String SourceEntry in SourceEntries)
						{
						if (SourceEntry.IndexOf (ID) != -1)
							{
							ToProcess = true;
							break;
							}
						}
					if (ToProcess == false)
						continue;
					foreach (String NewSourceEntry in OldSourceEntries)
						{
						if (NewSourceEntry.IndexOf (ID) != -1)
							{
							ToProcess = false;
							break;
							}
						}
					if (ToProcess == false)
						continue;
					GraphicsHandling Handler = new GraphicsHandling (CommonDataBase.DataBase.GetLocalWPMediaRoot ());
					Handler.LocalWPMediaRoot = CommonDataBase.DataBase.GetLocalWPMediaRoot ();
					Handler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot ();
					Handler.DoCentralStreamDownloadCall += new DoCentralStreamDownloadEvent (Handler_DoCentralStreamDownloadCall);
					}
				//    Handler.xxx
				//    Object Pkg = Handler
				//    String TargetPath = System.IO.Path.Combine (IntermediateStorageDirectory, SubDirectory);
				//if (!Directory.Exists (TargetPath))
				//    Directory.CreateDirectory (TargetPath);
				//List<String> TableDirectories = WMB.Basics.GetDirectoriesFromDirectory (PathToSearch, 1);
				//foreach (String TableDirectory in TableDirectories)
				//    {
				//    List<String> PkgFiles = WMB.Basics.GetFilesFromDirectory (TableDirectory, new string [] { "*.pkg" }, 1);
				//    if (PkgFiles.Count == 0)
				//        continue;
				//    String TableName = System.IO.Path.GetFileName (TableDirectory);
				//    String TargetTableDirectory = Path.Combine (TargetPath, TableName);
				//    if (!Directory.Exists (TargetTableDirectory))
				//        Directory.CreateDirectory (TargetTableDirectory);
				//    List<String> OldPkgFiles = WMB.Basics.GetFilesFromDirectory (TargetTableDirectory, new string [] { "*.pkg" }, 1);
				//    foreach (String FileToDelete in OldPkgFiles)
				//        WMB.Basics.SecureFileDelete (FileToDelete);
				//    foreach (String PkgFile in PkgFiles)
				//        {
				//        String TargetFileName = Path.Combine (TargetTableDirectory, Path.GetFileName (PkgFile));
				//        File.Copy (PkgFile, TargetFileName);
				//        }
				//    }
				}
			}
Beispiel #10
0
		private void StartTheShowForOnePackageFile ()
			{
			if (m_ReturnOfTheLastSetUpThePlayablePackage == false)
				return;
			try
				{
				
				if (PageIndexToProcessAfterRestart != -1)
					{
					PageIndexToProcess = PageIndexToProcessAfterRestart;
					PageIndexToProcessAfterRestart = -1;
					}
				else
					PageIndexToProcess = 0;
				ActuallGraphicsHandler = PrePreparedGraphicsHandler;
				PrePreparedGraphicsHandler = null;
				DispatcherTimer EndOfOnePackageFileTimer = new DispatcherTimer();
				EndOfOnePackageFileTimer.Tick += new EventHandler (m_EndOfOnePackageFileTimer_Tick);
				double RootDuration = GetCorrectedDurationForPage (PageIndexToProcess);
				if (RootDuration < 0)
					{
					if (WMB.Basics.IsTestRun)
						WMB.Basics.ReportInformationToEventViewer (m_MessageDescriptionID + ".StartTheShowForOnePackageFile",
							"Der Eintrag für \"" + m_StandBildPlayingData.NameOfActiveDescription ()
							+ "\"\r\nwird wegen \"RootDuration < 0\" beendet");
					if (CloseRequestedCall != null)
						CloseRequestedCall(this, CVM.CommonValues.REGULAR_CLOSING);
					return;
					}
				int NumberOfNumberOfPagesOfAvtiveDescription = m_StandBildPlayingData.NumberOfPagesOfActiveDescription ();
				if (NumberOfNumberOfPagesOfAvtiveDescription < 1)
					{
					if (CloseRequestedCall != null)
						CloseRequestedCall (this, CVM.CommonValues.REGULAR_CLOSING);
					if (WMB.Basics.IsTestRun)
						WMB.Basics.ReportInformationToEventViewer (m_MessageDescriptionID + ".StartTheShowForOnePackageFile",
							"Der Eintrag für \"" + m_StandBildPlayingData.NameOfActiveDescription()
							+ "\"\r\nwird wegen \"NumberOfEntries < 1\" beendet");
					return;
					}
				TimeSpan CalculatedLengtOfAllPagesInActuallPackage = TimeSpan.FromSeconds
					(GetCorrectedDurationForAllRemainingPages (m_StandBildPlayingData.IndexToFileIndexToPlay, PageIndexToProcess, true));
				if (CalculatedLengtOfAllPagesInActuallPackage <= TimeSpan.FromTicks (1))
					{
					WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".SetTimingsForOnePictureInActuallPackage",
						"NumberOfEntries ist \"" + Convert.ToString (NumberOfNumberOfPagesOfAvtiveDescription) + "\"\r\nRootDuration = \""
						+ Convert.ToString (RootDuration) + "\"\r\nbei folgenden Parameter Settings\r\n:"
						+ String.Join (" ", WMB.Basics.ConvertNameCollectionToCommandLineParameterArray (m_Arguments).ToArray ()));
					}

	
				EndOfOnePackageFileTimer.Interval = CalculatedLengtOfAllPagesInActuallPackage;
				EndOfOnePackageFileTimer.Start ();
				DispatcherTimer StartOfShowOnePageTimer = new DispatcherTimer ();
				StartOfShowOnePageTimer.Tick += new EventHandler (StartOfShowOnePageTimer_Tick);
				StartOfShowOnePageTimer.Interval = TimeSpan.FromTicks (1);
				StartOfShowOnePageTimer.Start ();
				if (WMB.Basics.IsTestRun)
					WMB.Basics.ReportInformationToEventViewer (m_MessageDescriptionID + ".StartTheShowForOnePackageFile",
						"Der Eintrag für \"" + m_StandBildPlayingData.NameOfActiveDescription () + "\"\r\nwird um "
						+ FinalStopTime.ToString() + " beendet");
				if (LogWPMediaActivitiesCall != null)
					{
					LogWPMediaActivitiesCall ("StandBildTV", "StandBild", ActuallGraphicsHandler.ActuallTableName,
											  ActuallGraphicsHandler.ActuallReadableContentRow ["ID"].ToString (), DateTime.Now,
											  CalculatedLengtOfAllPagesInActuallPackage);
					}
				}
			catch (Exception Excp)
				{
				WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".StartTheShowForOnePackageFile",
					"Folgender Fehler ist aufgetreten:\r\n" + Excp.ToString());
				}

			}
 String GetReadableNameFromDefinition (String WPMediaRootToUse, String PackageName)
     {
     if (!Path.IsPathRooted (PackageName))
         PackageName = Path.Combine (WPMediaRootToUse, PackageName);
     if (!File.Exists (PackageName))
         return "File \"" + PackageName + "\" not exists";
     GraphicsHandling Handler = new GraphicsHandling ();
     if (Handler.GetInstatiatedPackage (PackageName) == null)
         return "\"" + PackageName + "\" is not valid Package";
     return Handler.ActuallReadableContentRow ["NameID"].ToString ();
     }
Beispiel #12
0
		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;
			}
Beispiel #13
0
		private bool SetUpOnePlayablePackageFile ()
			{
			try
				{
				if (!m_StandBildPlayingData.IsFileIndexToPlayCorrect(SchedulingDefinedStopDateTime))
					{
					WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".SetUpOnePlayablePackageFile",
						"Der FileIndex ist nicht korrekt bei Tabelle \"" + m_StandBildPlayingData.TableName + "\"");
					if (CloseRequestedCall != null)
						CloseRequestedCall (this, CVM.CommonValues.ERROR_CLOSING + "-" + m_MessageDescriptionID + ".SetUpOnePlayablePackageFile");
					return false;
					}
				String ControlFileName = Path.Combine (WPMediaRoot, m_StandBildPlayingData.NameOfActiveDescription ());
				if ((IsDoubleClickRunMethode ())
					&& (ExtensionOfPrimaryControlFile != ".EXT"))
					ControlFileName = GetDoubleClickRunMethodeControlFile ();
				String Extension = Path.GetExtension (ControlFileName);
				if ((m_StandBildPlayingData.StandBildTVVersion == "PKG_Version")
					&& (File.Exists (ControlFileName.ToUpper ().Replace (".STB", ".PKG"))))
					{
					PrePreparedGraphicsHandler = LoadAndInstatiatePkgData ();
					if (PrePreparedGraphicsHandler != null)
						{
						return true;
						}
					else
						return false;
					}
				//else
				//	{
				//	if ((String.Compare (Extension, ".ser", true) == 0)
				//		|| (String.Compare (Extension, ".stb", true) == 0))
				//		{
				//		if (FillData () == true)
				//			{
				//			return true;
				//			}
				//		else
				//			return false;
				//		}
					
				//	}
				if (String.Compare (Extension, ".pkg", true) == 0)
					{
					PrePreparedGraphicsHandler = LoadAndInstatiatePkgData ();
					if (PrePreparedGraphicsHandler != null)
						{
						return true;
						}
					else
						return false;
					}
				return false;
				}
			catch (Exception Excp)
				{
				WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".SetUpOnePlayablePackageFile",
					"Folgender Fehler ist aufgetreten:\r\n" + Excp.ToString());
				return false;
				}
			}
Beispiel #14
0
        public static List<PositioningEntry> ShowFrameGeometry (double DrawingWidth, GraphicsHandling GraphicsHandler,
            CVM.RedrawInformation RedrawData, Grid RootGridForAllDrawings, String PageIDToProcess, RedrawMeEvent RedrawMeEventCall,
            GraphicsSingleton.DoThisAfterContextProcessingEvent DoThisAfterContextProcessingCall,
            SetUIElementsEnabelingToEvent SetUIElementsEnabelingToEventHandlerParameter,
            CVM.ActivatePageIDEvent ActivatePageIDEventHandler,
            CVM.GetBeitragsDatenFromBeitragsIDEvent GetBeitragsDatenFromBeitragsIDParameter,
            WMB.CloseRequested PosWindow_CloseRequestedEntry,
            RedrawFrameGeometryEvent RedrawFrameGeometryCall)
            {
            RedrawMeEventHandler = RedrawMeEventCall;
            DoThisAfterContextProcessingEventHandler = DoThisAfterContextProcessingCall;
            SetUIElementsEnabelingToEventHandler = SetUIElementsEnabelingToEventHandlerParameter;
            GetBeitragsDatenFromBeitragsIDHandler = GetBeitragsDatenFromBeitragsIDParameter;

            GraphicsSingleton SingletonInstance = GraphicsSingleton.Instance;
            SingletonInstance.SetDoThisAfterContextProcessingCall (DoThisAfterContextProcessingCall);
            SingletonInstance.RedrawData = RedrawData;
//DeleteExistingFrames (SingletonInstance.ListOfPositioningEntryInstances);
            TargetAspectRatio = GraphicsHandler.TargetPictureWidth / GraphicsHandler.TargetPictureHeight;
            ResizingFactor = GraphicsHandler.TargetPictureWidth / DrawingWidth;
            TargetPictureWidth = GraphicsHandler.TargetPictureWidth / ResizingFactor;
            TargetPictureHeight = GraphicsHandler.TargetPictureHeight / ResizingFactor;
            PositioningEntry.TargetPictureWidth = TargetPictureWidth;
            PositioningEntry.TargetPictureHeight = TargetPictureHeight;
            PositioningEntry.TargetAspectRatio = TargetAspectRatio;
            PositioningEntry.ResizingFactor = ResizingFactor;
            int LocalRootGridLastIndexNotToDelete = RootGridForAllDrawings.Children.Count;
            if (SingletonInstance.ListOfPositioningEntryInstances == null)
                SingletonInstance.ListOfPositioningEntryInstances = new List<PositioningEntry> ();
// by sac
            SingletonInstance.GraphicsHandler.ClearRootCanvas ();
            SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.MinWidth = TargetPictureWidth;
            SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.Width = TargetPictureWidth;
            SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.MinHeight = TargetPictureHeight;
            SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.Height = TargetPictureHeight;
            SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.AllowDrop = true;

            int DuplicationID = RedrawData.PageIndex;
            Image TargetImage = RedrawData.TargetImage;
            DataRow PageRow = GraphicsHandler.FrameDataDataSetReader.Tables ["Pages"]
                .Select ("ID = '" + RedrawData.PageID + "'") [0];
            DataRow [] FrameContentRows = GraphicsHandler.FrameDataDataSetReader.Tables ["FrameContent"]
                .Select ("PageID = '" + RedrawData.PageID + "'", "FrameOrder");
            foreach (DataRow FrameContentRow in FrameContentRows)
                {
                if (DuplicationID != -1)
                    if ((Convert.ToInt32 (FrameContentRow ["MultiPageIndex"]) != -1)
                        && (Convert.ToInt32 (FrameContentRow ["MultiPageIndex"]) != DuplicationID))
                        continue;
                if (!String.IsNullOrEmpty (FrameContentRow ["ItemName"].ToString ()))
                    if (GraphicsHandler.ActuallReadableContentRow.Table.Columns [FrameContentRow ["ItemName"].ToString ()] == null)
                        continue;
                DataRow [] FrameRows = GraphicsHandler.FrameDataDataSetReader.Tables ["Frames"]
                    .Select ("ID = '" + FrameContentRow ["FrameID"].ToString () + "'");
                if (FrameRows.Length != 1)
                    {
                    Basics.ReportErrorToEventViewer ("GraphicsHandling.ShowFrameGeometry",
                        "Fehler in der Frame und FrameContent Kombination:\r\n"
                        + "FrameContentID = \"" + FrameContentRow ["ID"].ToString ()
                        + "\" NameID = \"" + FrameContentRow ["NameID"].ToString () + "\r\nFrameID = \""
                        + FrameContentRow ["FrameID"].ToString () + "\"");
                    MessageBox.Show ("Fehler in der Frame und FrameContent Kombination:\r\n"
                                     + "FrameContentID = \"" + FrameContentRow ["ID"].ToString ()
                                     + "\" NameID = \"" + FrameContentRow ["NameID"].ToString () + "\r\nFrameID = \""
                                     + FrameContentRow ["FrameID"].ToString () + "\"");
                    continue;
                    }

                bool Found = false;
                String FrameID = FrameContentRow ["FrameID"].ToString ();
                foreach (PositioningEntry ExistingPositioningEntryInstance in SingletonInstance.ListOfPositioningEntryInstances)
                    {
                    if (ExistingPositioningEntryInstance.FrameID == FrameID)
                        {
                        ExistingPositioningEntryInstance.FillMeFromDataBase ();
                        Found = true;
                        break;
                        }
                    }
                if (Found == false)
                    {
                    PositioningEntry NewPositioningEntryInstance = new PositioningEntry ();
                    NewPositioningEntryInstance.FrameRow = FrameRows [0];
                    NewPositioningEntryInstance.FrameID = FrameID;
                    NewPositioningEntryInstance.FrameContentRow = FrameContentRow;
                    PositioningEntry.SetUIElementsEnabelingToEventHandler = SetUIElementsEnabelingToEventHandler;
                    PositioningEntry.ActivatePageIDEventHandler = ActivatePageIDEventHandler;
                    NewPositioningEntryInstance.RootUIElement = RootGridForAllDrawings;
                    NewPositioningEntryInstance.RedrawMeEventCall += RedrawMeEventCall;
                    NewPositioningEntryInstance.RedrawFrameGeometryCall += RedrawFrameGeometryCall;
                    NewPositioningEntryInstance.PageID = PageIDToProcess;
                    NewPositioningEntryInstance.RootGrid = RootGridForAllDrawings;
                    NewPositioningEntryInstance.RootGridLastIndexNotToDelete = LocalRootGridLastIndexNotToDelete;
                    //			NewPositioningEntryInstance.AllFrames = SingletonInstance.ListOfPositioningEntryInstances;
                    NewPositioningEntryInstance.CloseRequestedCall += PosWindow_CloseRequestedEntry;
                    NewPositioningEntryInstance.FillMeFromDataBase ();
                    SingletonInstance.ListOfPositioningEntryInstances.Add (NewPositioningEntryInstance);
                    }
                }

            int Index = 0;
            PositioningEntry PosWindowToSelect = null;
            foreach (PositioningEntry PosEntry in SingletonInstance.ListOfPositioningEntryInstances)
                {
                if (SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities
                    .Children.Contains (PosEntry.FramingRectangle) == false)
                    SingletonInstance.GraphicsHandler.RootCanvasForDrawingActivities.Children.Add (PosEntry.FramingRectangle);
                Canvas.SetLeft (PosEntry.FramingRectangle, PosEntry.Left);
                Canvas.SetTop (PosEntry.FramingRectangle, PosEntry.Top);
                if (Index == LastSelectedIndex)
                    PosWindowToSelect = PosEntry;
                Index++;
                }
            //if (PosWindowToSelect != null)
            //    {
            //    PosWindowToSelect.PositionableEntry_MouseDown (PosWindowToSelect.FramingRectangle, null);
            //    }
            if (Basics.IsTestRun)
                Basics.ReportInformationToEventViewer ("PositioningEntry.ShowFrameGeometry (static)",
                    "SingletonInstance.ListOfPositioningEntryInstances mit "
                    + Convert.ToString (SingletonInstance.ListOfPositioningEntryInstances.Count)
                    + " returned");

            return SingletonInstance.ListOfPositioningEntryInstances;
            }
Beispiel #15
0
		private String CreateLocalPackage (String TableName, String TableID, out int NumberOfPlayablePages)
			{
			GraphicsHandling PackageHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ());
			PackageHandler.RemoteWPMediaRoot = Basics.GetRemoteWPMediaRoot ();
			PackageHandler.DoSQLBatchCall += new DoSQLBatchEvent (LayoutHandler_DoSQLBatchCall);
			WCFStandards DataBase = new WCFStandards ();
			DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString";
			PackageHandler.GetInstatiatedPackage (DataBase, TableName, TableID);
			NumberOfPlayablePages = PackageHandler.PageDurations.Count;
			return PackageHandler.Close ();
			}
Beispiel #16
0
		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;
			}
		private void TestDefaultFilling ()
			{
			GraphicsHandling GraphicsHandler = new GraphicsHandling (CommonDataBase.DataBase.GetLocalWPMediaRoot ());
			GraphicsHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot ();
			Object Pkg = GraphicsHandler.GetInstatiatedPackage (
				"D:\\Temp\\Paketieren\\Source\\KaufParkMieter\\697db05f-9269-4b8f-8ad0-331b24626e72.pkg");
			GraphicsHandler.InsertDefaultPackageMaterials (DataAccess, Pkg);
			}
Beispiel #18
0
		public static GraphicsHandling GetHandlerForServerData (String TableName, String TableID, ref bool DoNotClose)
			{
			if ((GraphicsSingleton.Instance.GraphicsHandler != null)
				&& (GraphicsSingleton.Instance.GraphicsHandler.ActuallTableName == TableName)
				&& (GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow ["ID"].ToString () == TableID))
				{
				DoNotClose = true;
				if (GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow.Table.Columns ["NumberOfPages"] != null)
					GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow["NumberOfPages"]
						= GraphicsSingleton.Instance.GraphicsHandler.CalculatePagesToPlayAndTheirDurations();
				return GraphicsSingleton.Instance.GraphicsHandler;
				}
			String TableSourceDirectory = Path.Combine (Path.Combine( WPMediaRootServer, Basics.XML_AUTO_CONTENT_OLD_SOURCE), TableName);
			String PackageFileName = GetCorrectPackageFileName (Path.Combine( TableSourceDirectory, TableID + ".pkg"));
			if (String.IsNullOrEmpty(PackageFileName))
				return null;
			GraphicsHandling GraphicsHandler = new GraphicsHandling ();
			GraphicsHandler.GetInstatiatedPackage (PackageFileName, false);
			DoNotClose = false;
			return GraphicsHandler;
			}
		private void Window_Loaded (object sender, RoutedEventArgs e)
			{
			WMB.WPMediaApplicationState.Instance.Properties ["DataBase"] = DataAccess;
			DoSpecialCorrection ();
			return;
			DoDefaultCreationForOldPackages ();
			DoPictureRenaming ();
			TestDefaultFilling ();
			//LoadPkgs ();
			PackageFileNames = WMB.Basics.GetFilesFromDirectory (IntermediateStorageDirectory, new string [] {"*.pkg"}, 3);
			foreach (String PackageToProcessName in PackageFileNames)
				{
				m_GraphicsHandling = new GraphicsHandling (IntermediateStorageDirectory);
				Pkg = new PackagingHandler ();
				if (Pkg.OpenReadWrite (PackageToProcessName) == null)
					continue;
				m_GraphicsHandling.DoStartupProcessing (Pkg);
				ListViewItem Entry = new ListViewItem ();
				Entry.Tag = PackageToProcessName;
				Entry.Content = PackageToProcessName.Replace (IntermediateStorageDirectory, "");
				AvailableEntries.Items.Add (Entry);

// Copy Loop
				List<String> DocumentNames = Pkg.GetOriginalDocumentNamesInPackage ();
				foreach (String DocumentName in DocumentNames)
					{
					if (DocumentName.IndexOf ("BauchBinde") != -1)
						{
						Pkg.CopyFileElement (DocumentName, DocumentName.Replace ("\\\\", "\\")
						                  	.Replace ("BauchBinde", "Content_KP_P03_Frame_02"));
						Pkg.FlushPackage ();
						}
					if (DocumentName.IndexOf ("Bauchbinde") != -1)
						{
						Pkg.CopyFileElement (DocumentName, DocumentName.Replace ("\\\\", "\\")
											.Replace ("Bauchbinde", "Content_KP_P03_Frame_02"));
						Pkg.FlushPackage ();
						}
					if (DocumentName.IndexOf ("StandardBackGround") != -1)
						{
						Pkg.DeleteFileElement (DocumentName);
						Pkg.FlushPackage ();
						}
					if (DocumentName.IndexOf ("Intern_Kalender") != -1)
						{
						Pkg.DeleteFileElement (DocumentName);
						Pkg.FlushPackage ();
						}
					}

// Rename Loop	
				DocumentNames = Pkg.GetOriginalDocumentNamesInPackage ();
				foreach (String DocumentName in DocumentNames)
					{
					String NewName = DocumentName.Replace ("\\\\", "\\");
					int SearchIndex = 0;
					while (SearchIndex < ReplaceFileNames.Length)
						{
						NewName = NewName.Replace (ReplaceFileNames [SearchIndex], ReplaceFileNames [SearchIndex + 1]);
						SearchIndex += 2;
						}

					if (NewName != DocumentName)
						Pkg.RenameFileElement (DocumentName, NewName);
					}

				m_GraphicsHandling.RevertEntryToFileDefault ();

				m_GraphicsHandling.Close ();

				}
			CheckAllFunctionality ();
			}
Beispiel #20
0
		public BitmapSource GetPictureFromPackage (String PackageFileName, int PageIndex,
														 int TargetHeight = -1)
			{
			PackageFileName = GetCorrectPackageFileName (PackageFileName);
			if (String.IsNullOrEmpty (PackageFileName))
				return null;

			GraphicsHandling GraphicsHandler = new GraphicsHandling ();
			GraphicsHandler.GetInstatiatedPackage (PackageFileName, false);
			BitmapSource Result = GraphicsHandler.GetCreatedFrameBitmapSource (PageIndex);
			GraphicsHandler.Close();
			if (TargetHeight == -1)
				return Result;
			return Basics.ResizeBitmapSourceToNewHeight(Result, TargetHeight);
			}
		private void AvailableEntries_MouseDoubleClick (object sender, MouseButtonEventArgs e)
			{
			ListView Items = sender as ListView;
			ListViewItem SelectedItem = (ListViewItem) Items.SelectedItem;
			if (SelectedItem == null)
				return;
			String PackageToProcessName = SelectedItem.Tag as String;
			m_GraphicsHandling = new GraphicsHandling (IntermediateStorageDirectory);
			Pkg = new PackagingHandler ();
			if (Pkg.OpenReadWrite (PackageToProcessName) == null)
				return;
			m_GraphicsHandling.DoStartupProcessing (Pkg);
			List<double> Durations = m_GraphicsHandling.PageDurations;
			ImageTabControl.Items.Clear ();
			int PageIndex = 0;
			if (m_GraphicsHandling.PageIDsToPlay == null)
				{
				MessageBox.Show ("Fehler", "Keine Pages To Play bei \"" + PackageToProcessName + "\"");
				Pkg.ClosePackage ();
				return;
				}
			foreach (String PageID in m_GraphicsHandling.PageIDsToPlay)
				{
				Image PageImage = new Image ();
				PageImage.Tag = new CVM.RedrawInformation
					(PageID, m_GraphicsHandling.PageOrdersToPlay [PageIndex], PageImage);
				BitmapSource BitmapSourceDrawing = m_GraphicsHandling.GetCreatedFrameBitmapSource (PageImage.Tag as CVM.RedrawInformation);
				TabItem ImageTab = new TabItem ();
				ImageTabControl.Items.Add (ImageTab);
				ImageTab.Header = m_GraphicsHandling.ActuallTableName + " " + Convert.ToString (++PageIndex);
				PageImage.Width = 640;
				PageImage.Height = 360;
				ImageTab.Content = PageImage;
				PageImage.Source = BitmapSourceDrawing;

				}
			Pkg.ClosePackage ();

			}
Beispiel #22
0
		public List<BitmapSource> GetPicturesFromPackage (String originalPackageFileName,
		                                                  Size TargetSize, bool FullAndThumbMixed = false)
			{
			String packageFileName = GetCorrectPackageFileName(originalPackageFileName);
			if (String.IsNullOrEmpty(packageFileName))
				{
                return new List<BitmapSource>() ;

				}

			GraphicsHandling GraphicsHandler = new GraphicsHandling();
			GraphicsHandler.GetInstatiatedPackage(packageFileName, false);
			GraphicsHandler.CreateAndStoreFinalPictures();
			List<BitmapSource> Result = GraphicsHandler.GetResizedPictures(GraphicsHandler.FinalPictures, TargetSize, FullAndThumbMixed);
			GraphicsHandler.Close();
			return Result;
			}
Beispiel #23
0
		private void Window_Loaded (object sender, RoutedEventArgs e)
			{
			//CreateChristiansSpecialEffect ();
			return;
			m_GraphicsHandling = new GraphicsHandling ("E:\\Temp");
			foreach (String TableName in TablesToProcess)
				{
				DataSet StandBildDataSet = DataAccess.GetCommonDataSet ("Select * from " + TableName);
				foreach (DataRow StandBildDaten in StandBildDataSet.Tables [TableName].Rows)
					{
					String ID = StandBildDaten ["ID"].ToString ();
					Paketieren.PackagingHandler PackagingDll = m_GraphicsHandling.CreateNewPackage
					                                           	(DataAccess, TableName, ID) as Paketieren.PackagingHandler;
					m_GraphicsHandling.InsertDefaultPackageMaterials (DataAccess, PackagingDll);
					PackagingDll.ClosePackage ();

					}
				}
			//Paketieren.PackagingHandler PackagingDll = new PackagingHandler ();
			//PackagingDll.StartPackage ("D:\\Temp\\TestPackage.pkg");
			//List<String> AccessURIs = new List<string> ();

			//DataSet FrameDefinitions = m_XAMLHandling.CreateDefaultFrameDataSet (DataAccess, "ModellBauTV");
			//AccessURIs.Add (PackagingDll.AddDataSet (FrameDefinitions));

			//AccessURIs.Add (PackagingDll.AddDataSet (new DataSet ("TestDataSet")));
			//AccessURIs.Add (PackagingDll.AddDataSet (new DataSet ("TestDataSet")));
			//AccessURIs.Add (PackagingDll.AddDataSet (new DataSet ("TestDataSet")));
			//AccessURIs.Add (PackagingDll.AddDataSet (new DataSet ("TestDataSet")));
			//AccessURIs.Add (PackagingDll.AddDataTable (new DataTable ("TestDataTable")));
			//AccessURIs.AddRange (PackagingDll.AddCompleteDirectory ("E:\\Christian\\Deutschland als Industrienation"));
			//AccessURIs.AddRange (PackagingDll.AddCompleteDirectory ("E:\\Christian\\Deutschland als Industrienation"));
			//AccessURIs.AddRange (PackagingDll.AddCompleteDirectory ("E:\\Christian\\Deutschland als Industrienation"));

			//PackagingDll.OpenRead ("D:\\Temp\\TestPackage.pkg");

			//DataSet FrameDefinitionsObject = PackagingDll.GetDataSetFromDataSetName ("FrameDefinitions");

			//DataSet ReturnObjectDataSet = PackagingDll.GetDataSetFromDataSetName ("TestDataSet");
			//DataTable ReturnObjectDataTable = PackagingDll.GetDataTableFromDataTableName ("TestDataTable");
			//List<String> Documents = PackagingDll.GetOriginalDocumentNamesInPackage ();
			//foreach (String FileName in AccessURIs)
			//    {
			//    if ((FileName.IndexOf ("\\Class\\") != -1)
			//        || (FileName.IndexOf ("/Class/") != -1))
			//        {
			//        Object ReturnObject = PackagingDll.GetObjectFromOriginalDocumentName (FileName);
			//        System.Windows.Controls.Button DrawingTestArea = new System.Windows.Controls.Button ();
			//        Grid.SetColumn (DrawingTestArea, 0);
			//        Grid.SetRow (DrawingTestArea, 0);
			//        //System.Drawing.Graphics DrawingEnvironment = this.
			//        }
			//    else
			//        {
			//        Stream Content = PackagingDll.GetStreamFromOriginalDocumentName (FileName);
			//        MemoryStream MemoryContent = PackagingDll.GetMemoryStreamFromOriginalDocumentName (FileName);
			//        }
			//    }
			}
Beispiel #24
0
		void BulkImport_Click (object sender, RoutedEventArgs e)
			{
			MenuItem ActivatedEntry = sender as MenuItem;
			if (ActivatedEntry == null)
				return;
			String TableNameToProcess = ActivatedEntry.Tag as String;
			OpenFileDialog OFD = new OpenFileDialog ();
			OFD.Filter = "Alle Bilder|*.jpg;*.png;*.tiff;*.bmp";
			OFD.Title = "Bitte selektieren Sie Bilder für \"" + TableNameToProcess + "\"";
			OFD.Multiselect = true;
			if (OFD.ShowDialog () != true)
				{
				return;
				}
			if (OFD.FileNames.Length == 0)
				return;
			CVM.IFullTimingsInterface FullManagedTimingsInterface = new ManagedTimingsWindow () as CVM.IFullTimingsInterface ;
			DataSet TimingsTemplateDataSet = m_DataBase.GetCommonMultiDataSet (new string [] {
			            "Select * from Timings where ConnectedID = '" +
			            System.Guid.NewGuid ().ToString () + "'",
			            "Select * from TimingTypen order by ProcessingOrder"
			                                                                            });
			FullManagedTimingsInterface.TimingsTemplateDataSet = TimingsTemplateDataSet;
			FullManagedTimingsInterface.WindowsHeadLine = "Bitte geben sie die zu generierenden Timings ein";
			FullManagedTimingsInterface.FillStoreableTimingsDataSetViaUI (TableNameToProcess);
			Cursor = Cursors.Wait;
			Window ProgressWindow = new Window ();
			ProgressWindow.Height = 50;
			ProgressWindow.Width = 700;
			ProgressBar ProgressControl = new ProgressBar ();
			ProgressWindow.Content = ProgressControl;
			ProgressControl.Minimum = 0;
			ProgressControl.Maximum = OFD.FileNames.Length;
			ProgressWindow.Title = "Upload wird vorbereitet";
			ProgressWindow.Show ();
			ManagedFileHandling.FileHandlingModell  FileHandlingModellInstance = new FileHandlingModell ();
			//CommonDataBase.CommonBasics CopyInstance = new CommonBasics ();
			//CopyInstance.SendFileBlockEventCall += new SendFileBlockEvent (CopyInstance_SendFileBlockEventCall);
			//CopyInstance.CopyToServerListFinishedCall +=new CopyToServerListFinished(CopyInstance_CopyToServerListFinishedCall);
			String InsertSqlStatement = m_DataBase.GetTableDefinitionEntry (TableNameToProcess,
					WCFStandardsNS.WCFStandardClientSchema.SQL_TABLE_PROPERTY_SQL_INSERT);
			if (String.IsNullOrEmpty (InsertSqlStatement))
				InsertSqlStatement = "Insert into " + TableNameToProcess + " (ID, NameID, Titel) values ('{0}', '{1}', '{2}')";
			int LoopCounter = 0;
			foreach (String PictureFileName in OFD.FileNames)
				{
				String NewID = System.Guid.NewGuid ().ToString ();
				String NewEntryName = Path.GetFileName (Path.GetDirectoryName (PictureFileName)) + ":" +
				                      Path.GetFileNameWithoutExtension (PictureFileName);
				if (ProgressWindow.IsLoaded == false)
					break;
				ProgressControl.Value = LoopCounter++;
				ProgressWindow.Title = "Upload von " + PictureFileName;
				WMB.Basics.DoEvents ();
				String FinalInsertSqlStatement = String.Format (InsertSqlStatement, NewID, NewEntryName, "");

				m_DataBase.RunSQLBatch (FinalInsertSqlStatement);
				DataSet StoredEntry = m_DataBase.GetCommonDataSet ("Select * from "
				         + TableNameToProcess + " where ID = '" + NewID + "'");
				StoredEntry.Tables [0].Rows [0] ["ModifyTimeStamp"] = DateTime.Now;
				StoredEntry.Tables [0].Rows [0] ["ProcessingStatus"] = CVM.CommonValues.TABLE_PROCESSING_STATUS_INTERNET_PUBLISHING_PENDING
														   + ";" + CVM.CommonValues.TABLE_PROCESSING_STATUS_TV_PUBLISHING_PENDING;
				m_DataBase.SetCommonDataSet (StoredEntry);
				DataSet StoreableTimingsDataSet = FullManagedTimingsInterface.GetStoreableTimingsDataSet (NewID);
				m_DataBase.SetCommonDataSet (StoreableTimingsDataSet);
				CVM.GraphicsHandling GraphicHandler = new GraphicsHandling (CommonDataBase.DataBase.GetLocalWPMediaRoot ());
				GraphicHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot ();
				Object Pkg = GraphicHandler.GetInstatiatedPackage (m_DataBase, TableNameToProcess, NewID);
				String Extension = Path.GetExtension (PictureFileName);
				GraphicHandler.AddFileFromElementname ("BackGround" + Extension, PictureFileName);
				String LocalFileName = GraphicHandler.Close ();
				String RemoteFileName = CommonDataBase.DataBase.GetRemoteArchivFileNameFromLocalFileName (LocalFileName);
				FileInfo FInfo = new FileInfo (LocalFileName);
				FileHandlingModellInstance.DoCentralFileUpdateCall(TableNameToProcess, LocalFileName, RemoteFileName);
				//CopyInfoBlock CopyBlock = new CopyInfoBlock (LocalFileName, RemoteFileName, FInfo.LastWriteTime);
				//CopyInstance.CopyToServer (new List<CopyInfoBlock> {CopyBlock}, true);
				}
			ProgressWindow.Close ();
			Cursor = Cursors.Arrow;
			}
Beispiel #25
0
		TabItem DrawOneFinalPage (GraphicsHandling GraphicsHandlingInstance, String PageID)
			{
			double TargetAspectRatio = GraphicsHandlingInstance.TargetPictureWidth / GraphicsHandlingInstance.TargetPictureHeight;
			double ResizingFactor = GraphicsHandlingInstance.TargetPictureWidth / DrawingWidth;
			Thickness BorderThickness = new Thickness ();
			BorderThickness.Left = 3;
			BorderThickness.Right = 3;
			BorderThickness.Top = 3;
			BorderThickness.Bottom = 3;
			BrushConverter BRConverter = new BrushConverter ();
			TabItem NewItem = new TabItem ();
			NewItem.ContextMenuOpening += new ContextMenuEventHandler (NewItem_ContextMenuOpening);
			NewItem.Tag = PageID;
			PicturesTabControl.Items.Add (NewItem);
			PicturesTabControl.SelectedItem = NewItem;
			int PageIndex = GraphicsHandlingInstance.PageIDsToPlay.FindIndex (delegate (String Entry)
			    { return (PageID == Entry); } );
			Grid TabItemGrid = m_XAML.CreateGrid (new int [] { 1 }, new int [] { 20, 1 });
			String PlayTime = " (" + GraphicsHandlingInstance.GetPageDuration (PageID).ToString () + ")";
			String PageName = "Seite " + Convert.ToString (PageIndex + 1) + PlayTime;
			NewItem.Content = TabItemGrid;

			NewItem.Header = PageName;

			Image JustifiedImage = new Image ();
			JustifiedImage.ContextMenuOpening += new ContextMenuEventHandler (JustifiedImage_ContextMenuOpening);
			RedrawInformation RedrawData = new RedrawInformation (PageID, ++PageIndex, JustifiedImage);
			JustifiedImage.Tag = RedrawData;
			BitmapSource ImageSource = GraphicsHandlingInstance.GetCreatedFrameBitmapSource (RedrawData);
			if (!String.IsNullOrEmpty (m_WebLinkData))
				{
				m_WebSizing.Width /= (float) ResizingFactor;
				m_WebSizing.Height /= (float) ResizingFactor;
				return NewItem;
				}
			JustifiedImage.BeginInit ();
			JustifiedImage.Source = ImageSource;
			JustifiedImage.Width = GraphicsHandlingInstance.TargetPictureWidth / ResizingFactor;
			JustifiedImage.EndInit ();
			Border ImageBorder = new Border ();
			TabItemGrid.Children.Add (ImageBorder);
			ImageBorder.BorderThickness = BorderThickness;
			ImageBorder.BorderBrush = (Brush) BRConverter.ConvertFromString ("Black");
			ImageBorder.Child = JustifiedImage;
			ImageBorder.Width = (GraphicsHandlingInstance.TargetPictureWidth / ResizingFactor) + BorderThickness.Left + BorderThickness.Right;
			ImageBorder.Height = (GraphicsHandlingInstance.TargetPictureHeight / ResizingFactor) + BorderThickness.Top + BorderThickness.Bottom;
			Grid.SetColumn (ImageBorder, 0);
			Grid.SetRow (ImageBorder, 0);

			Grid DescriptionTextGrid = m_XAML.CreateGrid (new int [] { 70, 30 }, new int [] { 10 });
			TabItemGrid.Children.Add (DescriptionTextGrid);
			Grid.SetColumn (DescriptionTextGrid, 0);
			Grid.SetRow (DescriptionTextGrid, 1);
			TextBox BasePictureText = new TextBox ();
			DescriptionTextGrid.Children.Add (BasePictureText);
			Grid.SetColumn (BasePictureText, 1);
			Grid.SetRow (BasePictureText, 0);
			BasePictureText.Text = "(" + Convert.ToString ((int) GraphicsHandlingInstance.TargetPictureWidth) + " * "
				+ Convert.ToString ((int) GraphicsHandlingInstance.TargetPictureHeight) + " - "
				+ String.Format ("{0:0.000}", GraphicsHandlingInstance.TargetPictureWidth 
				/ GraphicsHandlingInstance.TargetPictureHeight) + ") " + PageName;
			BasePictureText.TextAlignment = TextAlignment.Right;
			return NewItem;
			}
Beispiel #26
0
/*
	public void CreateGalleriePlayingData (String PictureElementsFileRootDirectory,
					String TableName, DataRow TableTableRow)
		{
		CVM.CommonValues m_CVM = new CVM.CommonValues ();
		XAMLHandling m_XAMLHandling = new XAMLHandling (m_CVM);
		LocalWPMediaRoot = CommonDataBase.DataBase.GetLocalWPMediaRoot ();
		String TableDirectory = Path.Combine (PictureElementsFileRootDirectory, TableName);
		List<FileInfo> ExistingFiles = WMB.Basics.GetFileInfoEntriesFromDirectory
			(TableDirectory, new string [] { ControlFileExtension }, 1);
		return;
		}		
*/		
		
	public void CreateStandbildPlayingData (String WPMediaServerRootDirectory, 
			String PackageFilesRootDirectory, String TableName, DataRow tableDefinitionRow)
		{
		if (WMB.Basics.IsTestRun)
			{
			int NumberOfFiles = WMB.Basics.GetFilesFromDirectory
				(Path.Combine(PackageFilesRootDirectory, TableName), new string[] { "*.pkg" }, 1).Count; 

			WMB.Basics.ReportInformationToEventViewer("WPMediaCentralServices.CreateStandbildPlayingData",
				"PackageFilesRootDirectory =\r\n\"" + PackageFilesRootDirectory + "\" Tabelle =\r\n\""
				+ TableName + "\" " + Convert.ToString(NumberOfFiles) + " Files");
			}
		DateTime DateTimeToHandle = DateTime.Now;
		CVM.CommonValues m_CVM = new CVM.CommonValues();
		XAMLHandling m_XAMLHandling = new XAMLHandling (m_CVM);
		LocalWPMediaRoot = CommonDataBase.DataBase.GetLocalWPMediaRoot ();
		String TableDirectory = Path.Combine (PackageFilesRootDirectory, TableName);
		List<FileInfo> ExistingFiles = WMB.Basics.GetFileInfoEntriesFromDirectory
			(TableDirectory, new string [] { ControlFileExtension }, 1);
		if (ExistingFiles == null)
			return;
		WPMediaStandbildPlayingData Description = new WPMediaStandbildPlayingData();

//ToDo	Checking for IsActive on this day - new Implementation	
		List<MMUnitUsageData> PossibleDataFromDataBase
			= Data.DbServer3.WPMediaAddOnData.GetWPMediaAddOnDataStandBildUsagePerTabelle
				(TableName, Data.DbServer3.WPMediaAddOnData.Timings
					.GetPossiblyInvolvedConnectedIds(DateTimeToHandle)[TableName]);


		Dictionary<DateTime, List<MMUnitUsageData>> AvtiveThisDayParameter 
				= new Dictionary<DateTime, List<MMUnitUsageData>>()
					{
						{ DateTimeToHandle,
						GetDayMMUnitUsageData
							(PossibleDataFromDataBase, DateTimeToHandle)
						}
					};

			//TODO
			//MMUnitUsageTreeEntry Root = MMUnitUsageTreeEntry.GetUsageTree (null, null, null, null);

			//int WeekDay = (int) DateTime.Now.DayOfWeek;
			//List<MMUnitUsageData> DownloadEntriesStandBildUsageData = Root.Childs[MMUnitUsageTreeEntry.ALL_ACTIVE_ENTRIES].ContentList;
			//	MMUnitUsageTreeEntry RootsChilds = Root.Childs [MMUnitUsageTreeEntry.ALL_ACTIVE_ENTRIES];
			//List<MMUnitUsageData> AllDayUsageData = RootsChilds.Childs[MMUnitUsageTreeEntry.ALL_DAY_ENTRIES].ContentList;
			//List<MMUnitUsageData> ThisWeekDayUsageData = RootsChilds.Childs[WMB.Basics.ShortWeekDayNames[WeekDay]].ContentList;

			//Description.NamesOfLocalToDownloadDescriptions = new List<string> ();
			//foreach (MMUnitUsageData UsageData in DownloadEntriesStandBildUsageData)
			//	{
			//	Description.NamesOfLocalToDownloadDescriptions.Add(UsageData.PackageFileNamePart);
			//	}
			//foreach (MMUnitUsageData UsageData in AllDayUsageData)
			//	{
			//	Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart);
			//	}
			//foreach (MMUnitUsageData UsageData in ThisWeekDayUsageData)
			//	{
			//	Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart);
			//	}

			Description.NamesOfTodayActiveDescriptions = new List<string>();
			foreach (MMUnitUsageData UsageData in AvtiveThisDayParameter[DateTimeToHandle])
				{
				Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart);
				}

			foreach (String PackageFileName in Description.NamesOfTodayActiveDescriptions)
			{
			bool Found = false;
			foreach (FileInfo FInfo in ExistingFiles)
				{
				if (FInfo.Name.ToLower () == Path.GetFileName (PackageFileName).ToLower ())
					Found = true;
				}
			if (!Found)
				{
				WMB.Basics.ReportErrorToEventViewer("WPMediaCentralService.CreateStandbildPlayingData",
					"Der PackageFile \"" + PackageFileName + "\" fehlt");
				}
			}
		int SkipLength = PackageFilesRootDirectory.Length + 1 - "Source\\".Length;

		if (WMB.Basics.IsTestRun)
			WMB.Basics.ReportInformationToEventViewer ("WPMediaCentralServices.CreateStandbildPlayingData",
			    "NamesOfLocalToDownloadDescriptions = " + Convert.ToString (Description.NamesOfLocalToDownloadDescriptions.Count)
			    + "\r\nNamesOfTodayActiveDescriptions = " + Convert.ToString (Description.NamesOfTodayActiveDescriptions.Count));
	
		String EntryTimingType = tableDefinitionRow[CVM.CommonValues.WPMEDIA_ENTRY_TIMING_TYPE].ToString();
		String PlayingOrder = tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_PLAYING_ORDER].ToString ();
		double EntryDuration = 8;
		if (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION] != null)
			{
			if (!String.IsNullOrEmpty (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION].ToString ()))
				EntryDuration = Convert.ToDouble (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION]);
			}
		double OutsideSetDuration = -1;
		if (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION] != null)
			{
			if (!String.IsNullOrEmpty (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION].ToString ()))
				OutsideSetDuration = Convert.ToDouble (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION]);
			}
		String MeaningOfOutsideSetDuration = tableDefinitionRow [CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION].ToString ();
		Description.TableName = TableName;
		Description.TableDefinitionTable = tableDefinitionRow.Table.Clone ();
		DataRow TableDefinitionRow = Description.TableDefinitionTable.NewRow ();
		TableDefinitionRow.ItemArray = tableDefinitionRow.ItemArray;
		Description.TableDefinitionTable.Rows.Add (TableDefinitionRow);
		Description.NameOfProcessingModule = tableDefinitionRow ["Type"].ToString ();

		Description.NamesOfActiveDescriptions = new List<string> ();
		Description.SortFields = new List<string> ();
		Description.LastWriteTimesOfNamesOfActiveDescriptions = new List<DateTime> ();
		Description.PlayLengthOfEachDescription = new List<TimeSpan> ();
		Description.NumberOfPagesOfEachDescription = new List<int> ();
		Description.NameOfPlayingDataDescription = TableName;
		Description.OverallPlayLength = 0;
		int OverallNumberOfPictures = 0;
		String TableType = tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_TYPE_OF_TABLE].ToString ();
		ManagedTimingsControl TimingsCheckerClass = new ManagedTimingsControl ();
		CVM.ITimingsInterface TimingsCheckerInterface = TimingsCheckerClass as ITimingsInterface;
		TimingsCheckerInterface.m_TimingsTypenDataSet = m_DataBase.GetCommonDataSet ("Select * from TimingTypen");
		foreach (String PackageFileName in Description.NamesOfTodayActiveDescriptions)
			{
			FileInfo Entry = new FileInfo(Path.Combine(PackageFilesRootDirectory, PackageFileName));
			String ID = Path.GetFileNameWithoutExtension (Entry.FullName);
			DataTable UsedTimings;
			if (TimingsCheckerInterface.IsActive (ID, out UsedTimings) == false)
				continue;
			int NumberOfPages = 0;
			String SortField = PlayingOrder;
			TimeSpan PlayLengthForThisEntry = TimeSpan.Zero;
			List <double> PageDurations = new List<double> ();

			GraphicsHandling GraphicsHandler = new GraphicsHandling (LocalWPMediaRoot);
			if (GraphicsHandler.GetInstatiatedPackage (Entry.FullName) == null)
				{
				WMB.Basics.ReportErrorToEventViewer("WPMediaCentralServices.CreateStandbildPlayingData",
					"Der File\r\n\"" + Entry.FullName + "\"\r\nkonnte nicht als gültiges Package aufgelöst werden.\r\n"
					+ "In der Folge werden damit Fehler auftreten");
				continue;
				}
			List<TimeSpan> DurationForEachPage = new List<TimeSpan> ();
			foreach (double PageDuration in GraphicsHandler.PageDurations)
				{
				PlayLengthForThisEntry += TimeSpan.FromSeconds(PageDuration);
				DurationForEachPage.Add(TimeSpan.FromSeconds(PageDuration));
				}
			SortField = GraphicsHandler.GetFilledSortField (SortField);
			NumberOfPages = GraphicsHandler.PageDurations.Count;
			GraphicsHandler.Close ();
			Description.StandBildTVVersion = "PKG_Version";
			Description.DurationOfEachPageInEachDescription.Add (DurationForEachPage);
			Description.FillTimingsForEachDescription (ID, UsedTimings);

			if ((NumberOfPages == 0)
				|| (PlayLengthForThisEntry == TimeSpan.Zero))
				{
				WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices.CreateStandbildPlayingData",
					Entry.FullName + " in der Table \"" + TableName + "\" hat eine PlayLength von 0");
				continue;
				}
			Description.NamesOfActiveDescriptions.Add (Entry.FullName.Substring (SkipLength));
			if (String.IsNullOrEmpty(Description.SubDirectoryWhereTheDescriptionsAreLocated))
				{
				Description.SubDirectoryWhereTheDescriptionsAreLocated = Path.GetDirectoryName
					(Entry.FullName.Substring (SkipLength));
				}
			
			Description.LastWriteTimesOfNamesOfActiveDescriptions.Add (Entry.LastWriteTime);
			Description.SortFields.Add (SortField);
			Description.NumberOfPagesOfEachDescription.Add (NumberOfPages);
			OverallNumberOfPictures += NumberOfPages;
			Description.OverallPlayLength += PlayLengthForThisEntry.TotalSeconds;
			Description.PlayLengthOfEachDescription.Add (PlayLengthForThisEntry);
			}
		if (OutsideSetDuration > 0)
			{
			if (MeaningOfOutsideSetDuration == CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION_MAX)
				if (OutsideSetDuration < Description.OverallPlayLength)
					Description.OverallPlayLength = OutsideSetDuration;
			if (MeaningOfOutsideSetDuration == CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION_FIX)
				Description.OverallPlayLength = OutsideSetDuration;
			}
		Description.OverallNumberOfPicturesToShow = OverallNumberOfPictures;
		String ControlFileName = Description.TableName;
		if (tableDefinitionRow ["DefinitionNameToCreate"] != Convert.DBNull)
			if (!String.IsNullOrEmpty (tableDefinitionRow ["DefinitionNameToCreate"].ToString ()))
				ControlFileName = tableDefinitionRow ["DefinitionNameToCreate"].ToString ();
//TODO	String PlayingDataDirectory = Path.Combine(LocalWPMediaRoot, XML_SENDER_AUTO_CONTROL_DIRECTORY);
		String PlayingDataDirectory = Path.Combine(WPMediaServerRootDirectory, XML_SENDER_AUTO_CONTROL_DIRECTORY);
		if (!Directory.Exists (PlayingDataDirectory))
			Directory.CreateDirectory (PlayingDataDirectory);
		String FileName = Path.Combine (PlayingDataDirectory, ControlFileName + AUTO_CONTROL_FILE_EXT_EXTENSION_SHORT);
		Description.FillIndexIndizess ();
		WPMediaStandbildPlayingData EarlierDescription
			= GetWPMediaStandbildPlayingDataFromAssembledFile (FileName);
//		EarlierDescription.ClearAllRandomElements();
		if (PlayingDataObjectsAreEqual(EarlierDescription, Description))
			return;

		MemoryStream ContentOfPlayingData = AssembleContentOfPlayingData(Description,
			Convert.ToString(Description.OverallPlayLength), Description.TableName, "StandbildTV");
		bool CorrectDeleted = true;
		if (File.Exists (FileName))
			{
			CorrectDeleted = CommonDataBase.CommonBasics.SecureFileDelete (FileName, null);
			}
		if (CorrectDeleted)
			{
			FileStream TargetFile = File.Open (FileName, FileMode.Create, FileAccess.Write);
			ContentOfPlayingData.WriteTo(TargetFile);
			TargetFile.Close ();
			}
		ContentOfPlayingData.Close ();
		}
Beispiel #27
0
		//private bool CheckAndInformForIncompleteEntry (DataRow ActuallRow)
		//    {
		//    if (!GraphicsSingleton.Instance.GraphicsHandler.CheckForIncompleteEntry (ActuallRow))
		//        {
		//        MessageBox.Show ("Achtung, der zuletzt aktive Karteieintrag ist evt. nicht\r\n"
		//                        + "fertig bearbeitet. Sie haben möglicherweise einen\r\n"
		//                         + "neuen Eintrag angelegt, und diesen nicht ausgefüllt. Es kann\r\n"
		//                         + "auch sein, daß Sie gewünschte Änderungen nicht gespeichert\r\n"
		//                         + "haben (= nicht die \"Speichern\" - Taste gedrückt??).\r\n"
		//                         + "Bitte korrigieren Sie ggf. den Eintrag indem Sie mit der\r\n"
		//                        + "rechten Maustaste auf den zu ändenden Eintrag drücken.\r\n"
		//                        + "Wenn Sie eben das Programm schließen, oder die\r\n"
		//                        + "Kartei wechseln, sollten Sie nochmals einsteigen.");
		//        return false;
		//        }
		//    return true;
		//    }



		private void ProcessChangedEntry (String SelectedID)
			{
			PicturesTabControl.IsEnabled = false;
			if (m_ManagedTimingsControl != null)
				{
				m_ManagedTimingsControl.DoUpdateIfNeccessary ();
				m_ManagedTimingsControl.ConnectedID = SelectedID;
				}
			AvailableEntriesListBox.IsEnabled = false;
			GraphicsSingleton.Instance.CheckAndProcessPossibleChanges (DoCentralFileUpdateCall);
			if (String.IsNullOrEmpty (SelectedID))
				{
				PicturesTabControl.IsEnabled = true;
				AvailableEntriesListBox.IsEnabled = true;
				InsertFromTemplateButton.IsEnabled = true;
				GraphicsSingleton.Instance.RemoveAllGraphics ();
				return;
				}
			GraphicsSingleton.Instance.RemoveAllGraphics ();
			AvailableEntriesListBox.IsEnabled = false;
			GraphicsHandling LocalGraphicsHandling = new GraphicsHandling (WMB.Basics.GetLocalWPMediaRoot ());
			LocalGraphicsHandling.DoCentralStreamDownloadCall += new DoCentralStreamDownloadEvent
				(LocalGraphicsHandling_DoCentralStreamDownloadCall);
			LocalGraphicsHandling.DoSQLBatchCall += new DoSQLBatchEvent (LocalGraphicsHandling_DoSQLBatchCall);
			LocalGraphicsHandling.RemoteWPMediaRoot = WMB.Basics.GetRemoteWPMediaRoot();
			LocalGraphicsHandling.DoCentralFileDownloadCall += new DoCentralFileDownloadEvent
				(LocalGraphicsHandling_DoCentralFileDownloadCall);
			LocalGraphicsHandling.GetLastWriteTimeForServerFileCall += new WMB.GetLastWriteTimeForServerFileEvent
				(LocalGraphicsHandling_GetLastWriteTimeForServerFileCall);
			LocalGraphicsHandling.GetCroppedBitmapSourceCall += new GetCroppedBitmapSourceEvent (LocalGraphicsHandling_GetCroppedBitmapSourceCall);
			m_Pkg = LocalGraphicsHandling.CheckAndGetInstatiatedPackage (m_DataBase, TableToProcess, SelectedID) as PackagingHandler;
			if (m_Pkg == null)
				{
				AvailableEntriesListBox.IsEnabled = true;
				MessageBox.Show ("Fehler in der Definition der Tabelle\r\n\""
								 + TableToProcess + "\"\r\nes konnte kein Package erzeugt werden - Abbruch");
				LastSelectedTableRows = null;
				CloseRequestedCall (this, "FormatierDataSet Fehler bei \"" + TableToProcess + "\"");
				return ;
				}



			FillFinalPages (LocalGraphicsHandling);
			PicturesTabControl.IsEnabled = true;
			AvailableEntriesListBox.IsEnabled = true;
			InsertFromTemplateButton.IsEnabled = true;


			ShowFrameGeometryButton.IsEnabled = true;
			ShowFrameGeometryButton.Content = "Layout/Geometrie";
			FormatModified = true;
			}
		void CheckAllEntries (List<String> PackageList)
			{
			DataSet PageEntriesDataSet =
				m_DataBase.GetCommonDataSet (
					"Select * from Pages where NameID > 'DefaultKarteiPage01' and NameID < 'DefaultKarteiPage10'");
			if (PageEntriesDataSet.Tables ["Pages"].Rows.Count != 8)
				throw new Exception ("Alles im Eimer bei \"PageEntriesDataSet\"");
			foreach (String PackageName in PackageList)
				{
				GraphicsHandling Handler = new GraphicsHandling ();
				Handler.GetInstatiatedPackage (PackageName, true);
				DataSet FrameDataSet = Handler.FrameDataDataSetReader;
				if (FrameDataSet.Tables ["FrameContent"].Select( "FormattingTemplate = 'DefaultKartei'").Length == 0)
					continue;
				bool UpdateRequired = false;
				foreach (DataRow PageRow in PageEntriesDataSet.Tables ["Pages"].Rows)
					{
					String PageID = PageRow ["ID"].ToString ();
					if (FrameDataSet.Tables ["Pages"].Select ("ID = '" + PageID + "'").Length == 0)
						{
						FrameDataSet.Tables ["Pages"].ImportRow (PageRow);
						UpdateRequired = true;
						}
					}
				String IDForOldEntry =
					FrameDataSet.Tables ["Pages"].Select ("NameID = 'DefaultKarteiPage01'") [0] ["ID"].ToString ();
				int PageIndex = 2;
				while (PageIndex < 10)
					{
					String PageSearchString = "DefaultKarteiPage0" + Convert.ToString (PageIndex);
					String IDForNewEntry =
						FrameDataSet.Tables ["Pages"].Select ("NameID = '" + PageSearchString + "'") [0] ["ID"].ToString ();
					foreach (DataRow ContentRow in FrameDataSet.Tables ["FrameContent"].Select
						("PageID = '" + IDForOldEntry + "' and MultiPageIndex = " + Convert.ToString (PageIndex), "FrameOrder"))
						{
						String NameID = ContentRow ["NameID"].ToString ();
						String ItemName = ContentRow ["ItemName"].ToString ();
						ContentRow ["PageID"] = IDForNewEntry;
						UpdateRequired = true;

						}
					PageIndex++;
					}

				if (UpdateRequired == true)
					{
					Handler.RenewFrameDataSet (FrameDataSet);
					Handler.Close ();
					}
				WMB.Basics.DoEvents ();
				}
			}
Beispiel #29
0
		private bool CopyPkgEntrysFormat (String TableName, String OldID, String NewID)
			{
			String OldPkgFileName = GraphicsSingleton.Instance.GraphicsHandler.GetPackageName (TableName, OldID);
			String NewPkgFileName = Path.Combine (Path.GetDirectoryName (OldPkgFileName),
									  NewID + Path.GetExtension (OldPkgFileName));
			File.Copy (OldPkgFileName, NewPkgFileName);


			GraphicsHandling NewHandler = new GraphicsHandling (WMB.Basics.GetLocalWPMediaRoot ());
			NewHandler.RemoteWPMediaRoot = WMB.Basics.GetRemoteWPMediaRoot ();
			NewHandler.DoSQLBatchCall += new DoSQLBatchEvent (LocalGraphicsHandling_DoSQLBatchCall);
			NewHandler.GetInstatiatedPackage (TableToProcess, NewID);
			NewHandler.ActualizeInstanceDataIntoFrameDataSet (m_DataBase, TableToProcess, NewID);
			NewHandler.Close ();
			String RemoteFileName = WMB.Basics.GetRemoteFileNameFromLocalFileName(NewPkgFileName);
			DoCentralFileUpdate(NewPkgFileName, RemoteFileName);
			NewHandler.GetInstatiatedPackage (NewPkgFileName);
			return true;
			}
Beispiel #30
0
		public int CreateOrCheckInternetJPGPicturesFor (String WPMediaRoot, String TableName, String ID)
			{
			GraphicsHandling GraphicsHandler = new GraphicsHandling (WPMediaRoot);
			String PackageName = GraphicsHandler.GetPackageName (TableName, ID);
			if (!File.Exists (PackageName))
				{
				String ArchivedPackageName = PackageName.Replace
							("\\" + CVM.CommonValues.XML_AUTO_CONTENT_SOURCE + "\\",
							"\\" + CVM.CommonValues.XML_AUTO_CONTENT_OLD_SOURCE + "\\");
				if (File.Exists (ArchivedPackageName))
					PackageName = ArchivedPackageName;
				else
					{
					WMB.Basics.ReportErrorToEventViewer("Es würde ein neues Package angelegt:\r\n"
						+ PackageName + "\r\nAus Sicherheitsgründen wird die Neuanlage abgebrochen");
					return 0;
					Object Pkg = GraphicsHandler.CreateNewPackage(m_DataBase, TableName, ID);
					GraphicsHandler.RemoteWPMediaRoot = WPMediaRoot;
					GraphicsHandler.InsertDefaultPackageMaterials (m_DataBase, Pkg);
					GraphicsHandler.ActualizeInstanceDataIntoFrameDataSet (m_DataBase, TableName, ID);
					GraphicsHandler.DoStartupProcessing (m_DataBase, Pkg);
					if (Convert.ToInt32 (GraphicsHandler.ActuallReadableContentRow ["NumberOfPages"]) !=
					    GraphicsHandler.PageIDsToPlay.Count)
						{
						String UpdateStatement = "Update " + TableName + " set NumberOfPages = "
						                         + Convert.ToString (GraphicsHandler.PageIDsToPlay.Count) + " where ID = '" + ID + "'";
						m_DataBase.RunSQLBatch (UpdateStatement);
						}
					PackageName = GraphicsHandler.Close ();

					if ((!File.Exists (PackageName))
						&& (!File.Exists (ArchivedPackageName)))
						{
						WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices.WriteOrRewritePicturesFor",
						                                     "Weder der File\r\n\"" + PackageName + "\" noch der File\r\n\""
						                                     + ArchivedPackageName + "\" wurden vorerst nicht gefunden und "
																+ "konnten danach auch nicht erzeugt werden");
						return 0;
						}
					GraphicsHandler = new GraphicsHandling (WPMediaRoot);
					}
					
				}
			GraphicsHandler.GetInstatiatedPackage (PackageName);
			int NumberOfCreatedPictures = 0;
			if (GraphicsHandler.CheckPackageConsistence () == true)
				{
				NumberOfCreatedPictures = CreateOrCheckInternetJPGPicturesFor (WPMediaRoot, GraphicsHandler);
				}
			GraphicsHandler.Close ();
			return NumberOfCreatedPictures;
			}