Exemplo n.º 1
0
		private void GenerateFileAccessRing_Click(object sender, RoutedEventArgs e)
			{
			Cursor = Cursors.Wait;
//			IRingManager MVCInterface = null;

			RingPlayerDb player = new RingPlayerDb();
			player.Set_DbProxy(new DbEntitiesAccess.Proxys.DbServer3
				.DirectHsServerSqlConnector()
				{ Catalog = RingPlayerDb.NativeName });
			player.LoadSchema();
			player.SetHasBeenLoaded();
			RingMetaData ringMetaData = player.RingMetaDatas.NewRow();
			ringMetaData.SenderId = SelectedSender.Id;
			//ringMetaData.ComputerId = Guid.NewGuid();
			//ringMetaData.ComputerName = Environment.MachineName;
			//ringMetaData.Description = $"{Process.GetCurrentProcess().ProcessName} created Ring";
			//ringMetaData.CreatorNameId = $"ich";
			//ringMetaData.RingId = 1;
			//ringMetaData.StatusNumber = 100;
			ringMetaData.CreationDate = DateTime.Now;
			ringMetaData.Table.Add(ringMetaData);
			ringMetaData.Table.AcceptChanges();
//			MVCInterface.Generate(dataContext, SelectedSender.NameId, ringMetaData);
			RingPlayerDb dataSet = ringMetaData.DataSet;
			RingPlayerDb.SetInstance(this, dataSet);
			Cursor = Cursors.Arrow;
			}
Exemplo n.º 2
0
		public static IDuratedPage[] GetDuratedPagesFromDataSet(RingPlayerDb playerDb )
			{
			List<IDuratedPage> newList = new List<IDuratedPage>();
			foreach (PageGroup pageGroup in playerDb.PageGroups)
				{
				foreach (Page page in pageGroup.Pages.OrderBy(ord => ord.SortOrder))
					{
					newList.Add(new TemporaryDuratedPage()
						{
						IPage = page,
						IDuration = new Duration(TimeSpan.FromSeconds(page.ExpectedDuration.Value)),
						IPageGroupId = (Guid)pageGroup.Id
						});
					}
				}

			return newList.ToArray();
			}
Exemplo n.º 3
0
		private PageGroupGenerator(MMUnit mmUnitSource, RingPlayerDb targetPlayerDb)
			{
			MMUnitSource = mmUnitSource;
			TargetPlayerDb = targetPlayerDb;

			//ContractCollection<MMPart> sourceListe = source.MMParts;
			//List<Page> targetListe = TargetPageGroup.Pages.ToList();

			//ListAssimilator<Page, MMPart> assimilator = new ListAssimilator<Page, MMPart>(targetListe, sourceListe);
			//assimilator.EqualFunc = (page, part) => page.Id == part.Id;
			//assimilator.ConvertFunc = part =>
			//	{
			//	return new Page(part);
			//	};
			//assimilator.OnPairFound = DoUpdates;
			//assimilator.OnRemoved = page => page.Delete();
			//assimilator.Execute();

			}
Exemplo n.º 4
0
		public RingGenerator(MMSender targetSender, DateTime targetDate)
			{
			RingPlayerDb playerDb = new RingPlayerDb();
			playerDb.Set_DbProxy(new DirectHsServerSqlConnector() {Catalog = RingPlayerDb.NativeName});
			playerDb.LoadSchema();

			TargetRing = playerDb.RingMetaDatas.NewRow();
			TargetRing.SenderId = targetSender.Id;
			//TargetRing.ComputerId = Guid.NewGuid();
			//TargetRing.ComputerName = Environment.MachineName;
			//TargetRing.RingId = 1;
			//TargetRing.CreatorNameId = CsGlobal.Os.Info.ComputerName + " " + CsGlobal.Os.Info.CurrentUser;
			TargetRing.CreationDate = DateTime.Now;
//			TargetRing.TransferTime = null;
			//TargetRing.Status = RingMetaDataStates.Created;
			TargetRing.Table.Rows.Add(TargetRing);

			SourceSender = targetSender;
			TargetDate = targetDate;

			Init();
			}
Exemplo n.º 5
0
		public PageGroupGenerator(MMUnit mmUnitSource, RingPlayerDb targetPlayerDb)
			{
			MMUnitSource = mmUnitSource;
			TargetPlayerDb = targetPlayerDb;
			}
Exemplo n.º 6
0
		public static PageGroup GetOrCreatePageGroup(MMUnit source, RingPlayerDb targetDb)
			{
			return new PageGroupGenerator(source, targetDb).Generate();
			}
Exemplo n.º 7
0
		public static IPageSchedule[] GetScheduledPagesFromDataSet(RingPlayerDb playerDb)
			{
			return playerDb.PageSchedules.OrderBy(x => x.StartTime).Select(x=>(IPageSchedule)x).ToArray();

			}
Exemplo n.º 8
0
		public PlayerDataSetViewerModell(RingPlayerDb target)
			{
			RingPlayerDb = target;
			OrderedPageSchedules = RingPlayerDb.RingMetaDatas[0].PageSchedules.OrderBy(x => x.StartTime).ToArray();
			}
Exemplo n.º 9
0
		/// <summary>
		///     Loads the complete data bundle of the current row into a target data set.
		///     <para>A data bundle is defined as a set of all rows inside a database which are connected via relations.</para>
		///     <para>The currently selected row is the root of the bundle</para>
		/// </summary>
		public void Copy_BundledData_Into_DataSet(RingPlayerDb target)
		{
			base.Copy_BundledData_Into_DataSet(target);
		}
Exemplo n.º 10
0
		public RingUpdater(RingPlayerDb data, MultiMedia sourceDatabase)
			{
			Player = data;
			MultimediaDb = sourceDatabase;
			}
Exemplo n.º 11
0
		public RingUpdater(RingPlayerDb ringPlayerDb, MultiMedia sourceDatabase)
			{
			Player = ringPlayerDb;
			MultimediaDb = sourceDatabase;
			}
Exemplo n.º 12
0
		public void TesMMUnitTimingFunctions()
			{
			Data.DbServer3.MultiMedia.LoadAll_IfHasNotBeenLoaded();
			DistributionRoot DistributionRootInstance 
				= new DistributionRoot
				(Data.DbServer3.MultiMedia, DateTime.Now);
			DistributionRootInstance.PreloadAllForAllTodayAndTomorrowMMunitsIfNotHasBeenLoaded();
			Dictionary<MMSlot, Dictionary<MMUnit, List<MMUnitTiming>>> ToDayAndTomorrowInvolvedMMUnitsPerMMSlot
				= DistributionRootInstance.ToDayAndTomorrowInvolvedMMUnitsPerMMSlot;
			Debug.WriteLine($"");
			Debug.WriteLine($"ToDayAndTomorrowInvolvedMMUnitsPerMMSlot");

			foreach (MMSlot mmSlot in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");						}
						}
				}

			Debug.WriteLine($"");
			Debug.WriteLine($"TodayActiveMMUnitsPerMMSlo");

			foreach (MMSlot mmSlot in DistributionRootInstance.TodayActiveMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");
						}
					}
				}

			Debug.WriteLine($"");
			Debug.WriteLine($"TomorrowActiveMMUnitsPerMMSlot");

			foreach (MMSlot mmSlot in DistributionRootInstance.TomorrowActiveMMUnitsPerMMSlot.Keys)
				{
				if (!mmSlot.NameId.Contains("Kauf"))
					continue;
				Debug.WriteLine($"{mmSlot.NameId}");
				foreach (MMUnit mmUnit in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot].Keys)
					{
					Debug.WriteLine($"\t{mmUnit.NameId}");
					foreach (MMUnitTiming mmUnitTiming in ToDayAndTomorrowInvolvedMMUnitsPerMMSlot[mmSlot][mmUnit])
						{
						Debug.WriteLine($"\t\t{mmUnitTiming.FreiText}");
						}
					}
				}
			MMSender mmSender = Data.DbServer3.MultiMedia.MMSenders.FindOrLoad_via_NameId("Haus");
			RingPlayerDb ActuallPlayerDb = new RingPlayerDb();
			ActuallPlayerDb.Set_DbProxy(new DirectHsServerSqlConnector(){ Catalog = RingPlayerDb.NativeName });
			ActuallPlayerDb.LoadSchema();
			ActuallPlayerDb.SetHasBeenLoaded();

			RingMetaData testRingMetaData = ActuallPlayerDb.RingMetaDatas.NewRow();
			testRingMetaData.SenderId = mmSender.Id;
			//ringMetaData.ComputerId = Guid.NewGuid();
			//ringMetaData.ComputerName = Environment.MachineName;
			testRingMetaData.TargetDate = DateTime.Now;
			testRingMetaData.CreationDate = DateTime.Now;
			testRingMetaData.Id = 1;

			//AddOnRingDistribution.DataCollector.BalancerUsage balancerUsage
			//	= new AddOnRingDistribution.DataCollector.BalancerUsage(mmSender, testRingMetaData, DateTime.Now)
			//	{
			//	TodaysActiveMMUnitsPerMMSlot = DistributionRootInstance.TodayActiveMMUnitsPerMMSlot,
			//	TomorrowsActiveMMUnitsPerMMSlot = DistributionRootInstance.TomorrowActiveMMUnitsPerMMSlot
			//	};
			//balancerUsage.LoadActuallBalancers(mmSender);
			//RingUpdater ringUpdater = new RingUpdater(mmSender, testRingMetaData, DateTime.Now)
			//	{
			//	DistributionRootInstance = DistributionRootInstance,
			//	TodaysBalancers = balancerUsage.TodaysBalancersPerSender[mmSender]
			//	};

			}
Exemplo n.º 13
0
		public RingMetaData CreateNewRingInstance()
			{
			RingPlayerDb playerDb = new RingPlayerDb();
			playerDb.Set_DbProxy(new DirectHsServerSqlConnector { Catalog = RingPlayerDb.NativeName });
			playerDb.LoadConstraints();
			playerDb.SetHasBeenLoaded();

			RingMetaData ring = playerDb.RingMetaDatas.NewRow();
			ring.Id = 1;
			ring.SenderId = Guid.Empty;
			ring.CreationDate = DateTime.MinValue;
			ring.TargetDate = DateTime.MinValue;
			ring.Occasion = "";
			ring.AddToTable();
			return ring;
			}
Exemplo n.º 14
0
		private void OpenViewer(RingPlayerDb db, string title)
			{
			Window wPMediaPlayerWindow = new Window();
			wPMediaPlayerWindow.Title = title;
			IDuratedPage[] duratedPages = db.PageGroups.SelectMany(x => x.GetDuratedPages()).ToArray();



			//Page dbPage = db.Pages[0];
			//BitmapSource bitmapSource = dbPage.GetRenderedImage().Result;

			//BitmapSource image = bitmapSource;


			//FileInfo targetFile = new FileInfo("Temp.jpg").In_Desktop_Directory();
			//image.SaveAs_JpgFile(targetFile);
			//targetFile.Open_InProcess();



			wPMediaPlayerWindow.Content = new RingPlayer()
				{
				Pages = duratedPages
				};
			wPMediaPlayerWindow.Show();
			}
Exemplo n.º 15
0
		private void MMUnitImageClicked_OnClick(object sender, RoutedEventArgs e)
			{
			MMUnit selectedMMUnit = (sender as Button).DataContext as MMUnit;

			//CREATE DATABASE
			RingPlayerDb ActuallPlayerDb = new RingPlayerDb();
			ActuallPlayerDb.Set_DbProxy(new DirectHsServerSqlConnector{ Catalog = RingPlayerDb.NativeName });
			ActuallPlayerDb.LoadConstraints();
			ActuallPlayerDb.SetHasBeenLoaded();
			//***************

			//CREATE CONTENT
			new PageGroupGenerator(selectedMMUnit, ActuallPlayerDb).Generate();
			//**************

			var downloader = ActuallPlayerDb.GetDependencyDownloader();
			if (downloader == null)
				{
				OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) ");
				return;
				}

			Window wind = new Window() { Content = "Downloading" };
			wind.Show();
			downloader.Start().ContinueWith(t =>
			{
				wind.Close();

				if (t.Exception != null)
					MessageBox.Show($"Der download war nicht erfolgreich: {t.Exception.MostInner()?.Message}");
				else
					OpenViewer(ActuallPlayerDb, $"{selectedMMUnit.NameId} ({selectedMMUnit.MMUnitTyp.TypNameId}) ");
			}, TaskScheduler.FromCurrentSynchronizationContext());
			


			}