From: Vásáry Dániel Date: Wed, 8 Aug 2018 08:11:23 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=3e825c69ccbe7484fa8e14f50e8fdec71b34f053;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31232 --- diff --git a/client/DxPlay/Configuration/dxplay.json b/client/DxPlay/Configuration/dxplay.json index eb24fa45..9c4d6417 100644 --- a/client/DxPlay/Configuration/dxplay.json +++ b/client/DxPlay/Configuration/dxplay.json @@ -7,11 +7,12 @@ }, "metadata": { "$type": "TrafficMetadata", + "uiFileName": "metadataprovider.en", "server": { "address": "Data Source=10.10.1.45;Initial Catalog=PA_Echo;Persist Security Info=True;", "userName": "MAM", "password": "7RKZYBzumKjL40SJwuwiFCvX57xuCN8zay6OttUm2wbrgImyYZBHyZTUUYrXX31Ge2Uwew07HYsqh2uzdJeDBDwcVntxaHg3nIpv9Dyq/odVoiC4tUF/K+lgvKWANcrZ", - "timeout": 1000 + "timeout": 500 } } } diff --git a/client/DxPlay/Configuration/metadataprovider.en b/client/DxPlay/Configuration/metadataprovider.en new file mode 100644 index 00000000..3f488e8c --- /dev/null +++ b/client/DxPlay/Configuration/metadataprovider.en @@ -0,0 +1,27 @@ +{ + "define-segment": "Define segment", + "break-segment": "Break segment", + "position-as-tcin": "Current position as TC in", + "position-as-tcout": "Current position as TC out", + "delete-segment": "Delete segment", + "segments": "Segments", + "no-input": "NO INPUT", + "start": "START", + "length": "LENGTH", + "tc-in": "TC in", + "tc-out": "TC out", + "optional": "Optional", + "comment": "Comment", + "starting": "STARTING", + "exiting": "EXITING", + "paused": "PAUSED", + "playing": "PLAYING", + "stopped": "STOPPED", + "completed": "COMPLETED", + "pause": "Pause", + "play": "Play", + "stop": "Stop", + "missing-traffic-configuration": "Missing PlanAir connection configuration.", + "error-traffic-connect": "Could not connect to PlanAir system, using: {0}", + "missing-traffic-variant": "Missing metadata for {0} in PlanAir system." +} diff --git a/client/DxPlay/DxPlay.csproj b/client/DxPlay/DxPlay.csproj index 730e8fa9..bb3c4129 100644 --- a/client/DxPlay/DxPlay.csproj +++ b/client/DxPlay/DxPlay.csproj @@ -246,6 +246,9 @@ + + Always + Always diff --git a/client/DxPlay/DxPlaySettings.cs b/client/DxPlay/DxPlaySettings.cs index c18c4077..d59d0b87 100644 --- a/client/DxPlay/DxPlaySettings.cs +++ b/client/DxPlay/DxPlaySettings.cs @@ -5,7 +5,7 @@ using System.ComponentModel; namespace DxPlay { public class DxPlaySettings : UISettings { public Player Player { get; set; } - public MetadataProvider Metadata { get; set; } + public TrafficMetadata Metadata { get; set; } public BindingList Segments { get; set; } public bool IsStandalone { get; set; } public bool IsMaximized { get; set; } diff --git a/client/DxPlay/Integration/Traffic.cs b/client/DxPlay/Integration/Traffic.cs index f3e65ec2..680d77b0 100644 --- a/client/DxPlay/Integration/Traffic.cs +++ b/client/DxPlay/Integration/Traffic.cs @@ -1,7 +1,6 @@  using LinkDotNet.MessageHandling.Contracts; using TrafficClient; -using LinkDotNet.MessageHandling; using MaestroShared.Configuration; using System; using System.Linq; @@ -12,14 +11,12 @@ using NLog; namespace DxPlay.Integration { public class Traffic { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - private IMessageBus messageBus = new MessageBus(); private readonly DxPlaySettings settings; private readonly string id; private readonly Connection connection; public TrafficAPI Api { get; private set; } - public Traffic(DxPlaySettings settings, string id) { - messageBus.Subscribe(OnMessage); + public Traffic(DxPlaySettings settings, string id, IMessageBus messageBus) { connection = settings?.Metadata?.Server; if (connection == null) throw new Exception(settings.Resource("missing-traffic-configuration", StringResource.MISSING_TRAFFIC_CONFIGURATION)); @@ -28,12 +25,6 @@ namespace DxPlay.Integration { this.id = id; } - private void OnMessage(IMessage message) { - string msg = string.Format(settings.Resource("error-traffic-connect", StringResource.ERROR_TRAFFIC_CONNECT), connection.Address.OriginalString); - throw new Exception(msg); - //MessageBox.Show(msg, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - public List LoadSegments() { var metadataType = MetadataTypeUtil.Guess(id); List result = null; diff --git a/client/DxPlay/Model/DxPlayModel.cs b/client/DxPlay/Model/DxPlayModel.cs index 57fa05d0..ebaf9eb5 100644 --- a/client/DxPlay/Model/DxPlayModel.cs +++ b/client/DxPlay/Model/DxPlayModel.cs @@ -4,6 +4,9 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; +using LinkDotNet.MessageHandling; +using LinkDotNet.MessageHandling.Contracts; +using TrafficClient; namespace DxPlay.Model { public class DxPlayModel { @@ -16,12 +19,22 @@ namespace DxPlay.Model { IsSegmentEditorEnabled = true.Equals(settings?.Player?.SegmentEditor); IsMenuVisible = true.Equals(settings?.IsStandalone); Segments = settings.Segments ?? new BindingList(); + messageBus.Subscribe(OnMessage); + } + + private void OnMessage(IMessage message) { + string msg = string.Format(settings.Resource("error-traffic-connect", StringResource.ERROR_TRAFFIC_CONNECT), settings?.Metadata?.Server?.Address?.OriginalString); + throw new Exception(msg); + //MessageBox.Show(msg, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); } private void Notify([CallerMemberName] String propertyName = "") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + private IMessageBus messageBus = new MessageBus(); + public IMessageBus MessageBus { get => messageBus; } + private bool isSegmentEditorEnabled; public bool IsSegmentEditorEnabled { get { @@ -66,7 +79,7 @@ namespace DxPlay.Model { internal void InitializeSegments(string id) { Segments.Clear(); try { - traffic = new Traffic(settings, id); + traffic = new Traffic(settings, id, MessageBus); List segments = traffic.LoadSegments(); if (segments != null) segments.ForEach(s => Segments.Add(s)); diff --git a/client/DxPlay/PlayerForm.Designer.cs b/client/DxPlay/PlayerForm.Designer.cs index 9e1cefff..5fdb198b 100644 --- a/client/DxPlay/PlayerForm.Designer.cs +++ b/client/DxPlay/PlayerForm.Designer.cs @@ -237,7 +237,7 @@ namespace DxPlay { this.tpSegments.Location = new System.Drawing.Point(4, 4); this.tpSegments.Name = "tpSegments"; this.tpSegments.Padding = new System.Windows.Forms.Padding(3); - this.tpSegments.Size = new System.Drawing.Size(281, 442); + this.tpSegments.Size = new System.Drawing.Size(192, 30); this.tpSegments.TabIndex = 1; this.tpSegments.Text = "Segments"; this.tpSegments.UseVisualStyleBackColor = true; @@ -267,7 +267,7 @@ namespace DxPlay { this.dgSegments.Name = "dgSegments"; this.dgSegments.RowHeadersVisible = false; this.dgSegments.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgSegments.Size = new System.Drawing.Size(275, 411); + this.dgSegments.Size = new System.Drawing.Size(186, 0); this.dgSegments.TabIndex = 1; this.dgSegments.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgSegments_CellContentClick); this.dgSegments.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgSegments_CellMouseDoubleClick); @@ -288,7 +288,7 @@ namespace DxPlay { this.segmentActions.Location = new System.Drawing.Point(3, 3); this.segmentActions.Name = "segmentActions"; this.segmentActions.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.segmentActions.Size = new System.Drawing.Size(275, 25); + this.segmentActions.Size = new System.Drawing.Size(186, 25); this.segmentActions.TabIndex = 0; this.segmentActions.Text = "toolStrip1"; // diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 884a4f72..46a651de 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -5,6 +5,8 @@ using System.Linq; using MaestroShared.Metadata; using NLog; using DxPlay.Model; +using TrafficClient; +using MaestroShared.Commons; namespace DxPlay { @@ -64,6 +66,9 @@ namespace DxPlay { mainSplit.Panel2.Hide(); }; mainSplit.DataBindings.Add(segmentEditorPanelBinding); + trafficBrowser.Parameters = new TrafficParameters { + Configuration = Settings.Metadata, MessageBus = model.MessageBus + }; } public PlayerForm() { @@ -158,7 +163,7 @@ namespace DxPlay { try { model.InitializeSegments(id); } catch (Exception e) { - MessageBox.Show(e.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); + MsgBox.Error(e.Message); logger.Error(e); } } diff --git a/client/DxPlay/PlayerForm.resx b/client/DxPlay/PlayerForm.resx index ebe652a9..8c2e6ddd 100644 --- a/client/DxPlay/PlayerForm.resx +++ b/client/DxPlay/PlayerForm.resx @@ -176,7 +176,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABo - CAAAAk1TRnQBSQFMAgEBAgEAAVgBAAFYAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAWABAAFgAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/client/MaestroShared/Configuration/ConfigurationInfo.cs b/client/MaestroShared/Configuration/ConfigurationInfo.cs index 43496074..e7706c1e 100644 --- a/client/MaestroShared/Configuration/ConfigurationInfo.cs +++ b/client/MaestroShared/Configuration/ConfigurationInfo.cs @@ -153,7 +153,7 @@ namespace MaestroShared.Configuration { public class NEXIOSource : Source { } - public class MetadataProvider { + public class MetadataProvider : UISettings { public Connection Server { get; set; } }