コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: heinzsack/DEV
		public MainWindow()
			{
			if (Environment.GetCommandLineArgs().Length < 1)
				Environment.Exit(0);
			FileInfo dBFileInfo = new FileInfo(Environment.GetCommandLineArgs()[0]);
			if (!dBFileInfo.Exists)
				App.Current.Shutdown();


			RingPlayerDb ringerl = dBFileInfo.LoadAs_Object_From_SerializedBinary<RingPlayerDb>();
			if (ringerl == null)
				{
				MessageBox.Show($"Der File\r\n{Environment.GetCommandLineArgs()[0]}\r\nkann nicht als DataSet desrialisiert werden");
				Environment.Exit(0);
				}









			PlayerDataSetViewerModellInstance = new PlayerDataSetViewerModell(ringerl);
			InitializeComponent();
			}
コード例 #2
0
ファイル: RuntimeSettings.cs プロジェクト: heinzsack/DEV
		public DataSet LoadAndDeSerialize()
			{
			FileInfo SerializedParameter = new FileInfo($"\\\\{ComputerName}\\WPMediaSender\\RuntimeParameter.ser");
			if (!SerializedParameter.Exists)
				return null;
			return SerializedParameter.LoadAs_Object_From_SerializedBinary<DataSet>();
			}
コード例 #3
0
ファイル: CommonServices.cs プロジェクト: heinzsack/DEV
		private static MultiMedia LoadAndDeSerialize()
			{
			lock (lockObject)
				{
				FileInfo SerializedParameter = new FileInfo($"\\\\{ComputerName}\\WPMediaSender\\RuntimeParameter.ser");
				MultiMedia multiMediaDb = new MultiMedia();
				foreach (DataTable dataTable in SerializedParameter.LoadAs_Object_From_SerializedBinary<DataSet>().Tables)
					{
					CsDbTable mmTable = multiMediaDb.GetTableByName(dataTable.TableName);
					mmTable.Merge(dataTable);
					}
				multiMediaDb.SetHasBeenLoaded();
				return multiMediaDb;
				}
			}
コード例 #4
0
ファイル: BalancerUsage.cs プロジェクト: heinzsack/DEV
		private Dictionary<MMSlot, StatisticalBalancer<MMUnit>> LoadActuallBalancers
			(MMSender mmSender, DateTime dateTimeToCheck)
			{
			Dictionary<MMSlot, StatisticalBalancer<MMUnit>> entriesActuallInBalancer
				= new Dictionary<MMSlot, StatisticalBalancer<MMUnit>>();
			List<MMSlot> balancedMMSlotsToCheck = new List<MMSlot>();
			foreach (MMProgrammBlock programmBlock in mmSender.Get_OrderedProgrammBloecke)
				{
				foreach (MMProgrammBlockToMMSlot mmProgrammBlockToMMSlot in programmBlock.Get_MMSlotsZuMMProgrammBlockOrdered
					.Where(whe => whe.MMProgrammBlockToMMSlotsPlayingTyp.Id == Guid.Parse("F173BC3B-F8B4-407D-90B5-1B717219C444")))
					if (!balancedMMSlotsToCheck.Contains(mmProgrammBlockToMMSlot.MMSlot))
						balancedMMSlotsToCheck.Add(mmProgrammBlockToMMSlot.MMSlot);
				}
			foreach (MMSlot mmSlot in balancedMMSlotsToCheck)
				{
				if (!entriesActuallInBalancer.Keys.Contains(mmSlot))
					{
					if (dateTimeToCheck.Date == DateTime.Now.Date)
						{
						FileInfo playerFileInfo = new FileInfo(VisualBasics.GetSenderPlaylistName(mmSender.NameId));
						RingPlayerDb playerDb = playerFileInfo.LoadAs_Object_From_SerializedBinary<RingPlayerDb>();
						playerDb.SetHasBeenLoaded();
						RingUpdater ringUpdater = new RingUpdater(playerDb, mmSlot.DataSet);
						ringUpdater.Load();
						if (ringUpdater.BalancerPerBalancerId.ContainsKey(mmSlot.Id))
							entriesActuallInBalancer[mmSlot]
								= ringUpdater.BalancerPerBalancerId[mmSlot.Id];
						else
							entriesActuallInBalancer[mmSlot]
								= new StatisticalBalancer<MMUnit>();
						}
					else
						{
						entriesActuallInBalancer[mmSlot]
							= new StatisticalBalancer<MMUnit>();
						}
					}
				//TODO Actualice the balancer content
				//Debug.WriteLine($"Vor dem Ergänzen der Balancer - {dateTimeToCheck} für den Sender {mmSender.NameId}");
				//Debug.WriteLine($"\tSlot = {mmSlot.NameId}");
				//foreach (MMUnit mmUnit in TodayActiveMMUnitsPerMMSlot[mmSlot].Keys)
				//	{
				//	Debug.WriteLine($"\t\t{mmUnit.NameId} - {((IContainTimingAttributes)mmUnit.MMUnitTimings.FirstOrDefault()).FreiText}");
				//	}
				ActualizeBalancers(entriesActuallInBalancer[mmSlot],
					TodayActiveMMUnitsPerMMSlot[mmSlot].Keys.ToArray());
				//Debug.WriteLine($"Actuelle Entries in Balancer nach dem Aktualisieren");
				//foreach (MMUnit entriesKey in entriesActuallInBalancer[mmSlot].Entries.Keys)
				//	{
				//	Debug.WriteLine($"\t{entriesKey.NameId}");
				//	}
				}
			return entriesActuallInBalancer;
			}
コード例 #5
0
ファイル: ProgrammSchemaModell.cs プロジェクト: heinzsack/DEV
		public void SetActuallPlayerDb(MMSender mmSender)
			{

			FileInfo actuallDBFileInfo = new FileInfo(VisualBasics.GetSenderPlaylistName(mmSender.NameId));
			if ((actuallDBFileInfo.Exists)
				&& (actuallDBFileInfo.Length > 2000))
				{
				String Message = String.Empty;
				try
					{
					RingPlayerDb CommonDataSet= actuallDBFileInfo.LoadAs_Object_From_SerializedBinary<RingPlayerDb>();
					ActualRing = CreateNewRingInstance();
					ActualRing.DataSet.Merge(CommonDataSet);
					ActualRing.DataSet.SetHasBeenLoaded();
					}
				catch (Exception Excp)
					{
					Message = Excp.ToString();
					
					ActualRing = CreateNewRingInstance();
					}
				}
			else
				{
				ActualRing = CreateNewRingInstance();
				ActualRing.DataSet.SaveAs_SerializedBinary(actuallDBFileInfo);
				}
			if (ActualRing != null)
				{
				ActualRing.SourceFileName = actuallDBFileInfo.FullName;
				ActualRing.SourceCreationDateTime = actuallDBFileInfo.LastWriteTime;
				_selectedPageGroupSchedule = ActualRing.ScheduledPageGroups;
				}
			else
				{
				_selectedPageGroupSchedule = null;
				}
			}