From b2379348d5b4c330330a5e7605d179a85f215b95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bellai=20=C3=81d=C3=A1m?= Date: Tue, 10 Oct 2017 08:15:54 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30570 --- client/IntegrationTests/OctopusIT.cs | 2 +- client/IntegrationTests/PlanAIRTests.cs | 2 +- .../Configuration/ConfigurationInfo.cs | 1 + client/Maestro/Maestro.csproj | 2 + client/Maestro/MaestroForm.Designer.cs | 178 +++++++++++++++--- client/Maestro/MaestroForm.Metadata.cs | 5 +- client/Maestro/MaestroForm.Source.cs | 4 +- client/Maestro/MaestroForm.Target.cs | 9 - client/Maestro/MaestroForm.cs | 33 +++- client/Maestro/MaestroForm.resx | 3 + .../DataSources/SystemMessage.datasource | 10 + .../Resources/configuration-nexio.json | 1 + .../Maestro/Resources/configuration-unc.json | 11 +- client/Maestro/Sources/CreatedFileMonitor.cs | 14 +- client/Maestro/Sources/FileSourceItem.cs | 9 + client/Maestro/Sources/FileSystemSource.cs | 67 ++++--- client/Maestro/Sources/NexioRESTSource.cs | 8 +- client/Maestro/StringResources.Designer.cs | 36 ++++ client/Maestro/StringResources.resx | 12 ++ client/Maestro/SystemMessage.cs | 13 ++ client/MediaCubeClient/MediaCubeApi.cs | 9 +- client/MediaCubeClient/MediaCubeClient.csproj | 1 + client/MediaCubeClient/NexioAPI.cs | 6 +- client/OctopusClient/OctopusAPI.cs | 71 ++++--- client/OctopusClient/OctopusIDSelector.cs | 10 +- client/OctopusClient/Resources.Designer.cs | 9 + client/OctopusClient/Resources.resx | 3 + client/PlanAIRClient/Reader.cs | 4 - client/PlanAIRClient/TrafficAPI.cs | 10 +- client/PlanAIRClient/TrafficConfiguration.cs | 1 + client/PlanAIRClient/TrafficIDSelector.cs | 6 +- .../Workers/AdvertisementWorker.cs | 7 +- .../PlanAIRClient/Workers/BroadcastWorker.cs | 10 +- .../Workers/PromotionalWorker.cs | 10 +- client/PlanAIRClient/Workers/SegmentWorker.cs | 11 +- client/PlanAIRClient/Workers/TrafficWorker.cs | 4 +- 36 files changed, 453 insertions(+), 139 deletions(-) create mode 100644 client/Maestro/Properties/DataSources/SystemMessage.datasource create mode 100644 client/Maestro/SystemMessage.cs diff --git a/client/IntegrationTests/OctopusIT.cs b/client/IntegrationTests/OctopusIT.cs index 0c7ce2fc..41b43e51 100644 --- a/client/IntegrationTests/OctopusIT.cs +++ b/client/IntegrationTests/OctopusIT.cs @@ -20,7 +20,7 @@ namespace IntegrationTests { [TestMethod] public void TestGetRundowns() { - OctopusAPI client = new OctopusAPI("http://localhost:8080/rest/services/octopus/", null, null, 100); + OctopusAPI client = new OctopusAPI("http://localhost:8080/rest/services/octopus/", null, null, 100, null); var actual = client.GetRundowns(DateTime.Now); } diff --git a/client/IntegrationTests/PlanAIRTests.cs b/client/IntegrationTests/PlanAIRTests.cs index c46d1060..f60f813e 100644 --- a/client/IntegrationTests/PlanAIRTests.cs +++ b/client/IntegrationTests/PlanAIRTests.cs @@ -16,7 +16,7 @@ namespace IntegrationTests { [TestInitialize] public void initialize() { - sut = new TrafficAPI(CONNECTION_STRING, USER_NAME, PASSWORD, TIMEOUT); + sut = new TrafficAPI(CONNECTION_STRING, USER_NAME, PASSWORD, TIMEOUT, null); } [TestMethod] diff --git a/client/Maestro/Configuration/ConfigurationInfo.cs b/client/Maestro/Configuration/ConfigurationInfo.cs index 0b484174..acb4ec99 100644 --- a/client/Maestro/Configuration/ConfigurationInfo.cs +++ b/client/Maestro/Configuration/ConfigurationInfo.cs @@ -30,6 +30,7 @@ namespace Maestro.Configuration { public bool EnableCustomMetadataId { get; set; } public MetadataProvider[] Metadatas { get; set; } public Target[] Targets { get; set; } + public String Filter { get; set; } } public class Player { diff --git a/client/Maestro/Maestro.csproj b/client/Maestro/Maestro.csproj index 6c846124..a6f2da8f 100644 --- a/client/Maestro/Maestro.csproj +++ b/client/Maestro/Maestro.csproj @@ -210,6 +210,7 @@ + @@ -251,6 +252,7 @@ + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index df6ddc14..728fbb01 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -36,6 +36,10 @@ namespace Maestro { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupSource = new System.Windows.Forms.GroupBox(); this.dataGridSource = new System.Windows.Forms.DataGridView(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); @@ -65,6 +69,8 @@ namespace Maestro { this.btnExecute = new System.Windows.Forms.Button(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.groupActions = new System.Windows.Forms.GroupBox(); + this.tabControl2 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); this.dataGridJobs = new System.Windows.Forms.DataGridView(); this.columnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -74,6 +80,11 @@ namespace Maestro { this.columnInput = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.columnOutput = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.bindingSourceJobs = new System.Windows.Forms.BindingSource(this.components); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.dataGridMessages = new System.Windows.Forms.DataGridView(); + this.timeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.systemMessageBindingSource = new System.Windows.Forms.BindingSource(this.components); this.metadataInfoBindingSource = new System.Windows.Forms.BindingSource(this.components); this.groupSource.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).BeginInit(); @@ -100,8 +111,13 @@ namespace Maestro { this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); this.groupActions.SuspendLayout(); + this.tabControl2.SuspendLayout(); + this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridJobs)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSourceJobs)).BeginInit(); + this.tabPage2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridMessages)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.systemMessageBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.metadataInfoBindingSource)).BeginInit(); this.SuspendLayout(); // @@ -115,7 +131,7 @@ namespace Maestro { this.groupSource.Location = new System.Drawing.Point(0, 0); this.groupSource.Name = "groupSource"; this.groupSource.Padding = new System.Windows.Forms.Padding(10); - this.groupSource.Size = new System.Drawing.Size(414, 419); + this.groupSource.Size = new System.Drawing.Size(414, 471); this.groupSource.TabIndex = 0; this.groupSource.TabStop = false; this.groupSource.Text = "Source file"; @@ -160,7 +176,7 @@ namespace Maestro { this.dataGridSource.RowsDefaultCellStyle = dataGridViewCellStyle3; this.dataGridSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dataGridSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridSource.Size = new System.Drawing.Size(394, 304); + this.dataGridSource.Size = new System.Drawing.Size(394, 356); this.dataGridSource.TabIndex = 0; this.dataGridSource.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.sourceGridView_CellContentClick); this.dataGridSource.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellEnter); @@ -190,7 +206,7 @@ namespace Maestro { this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel2.Controls.Add(this.buttonMetadata, 1, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tableLayoutPanel2.Location = new System.Drawing.Point(10, 347); + this.tableLayoutPanel2.Location = new System.Drawing.Point(10, 399); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 2; @@ -275,7 +291,7 @@ namespace Maestro { // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1022, 419); + this.splitContainer1.Size = new System.Drawing.Size(1022, 471); this.splitContainer1.SplitterDistance = 414; this.splitContainer1.TabIndex = 1; // @@ -292,7 +308,7 @@ namespace Maestro { // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.groupTarget); - this.splitContainer3.Size = new System.Drawing.Size(604, 419); + this.splitContainer3.Size = new System.Drawing.Size(604, 471); this.splitContainer3.SplitterDistance = 284; this.splitContainer3.TabIndex = 2; // @@ -305,7 +321,7 @@ namespace Maestro { this.groupMetadata.Location = new System.Drawing.Point(0, 0); this.groupMetadata.Name = "groupMetadata"; this.groupMetadata.Padding = new System.Windows.Forms.Padding(10); - this.groupMetadata.Size = new System.Drawing.Size(284, 419); + this.groupMetadata.Size = new System.Drawing.Size(284, 471); this.groupMetadata.TabIndex = 1; this.groupMetadata.TabStop = false; this.groupMetadata.Text = "Metadata"; @@ -321,7 +337,7 @@ namespace Maestro { this.tabControl1.Location = new System.Drawing.Point(10, 23); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(264, 324); + this.tabControl1.Size = new System.Drawing.Size(264, 376); this.tabControl1.TabIndex = 1; // // tpOctopus @@ -330,7 +346,7 @@ namespace Maestro { this.tpOctopus.Location = new System.Drawing.Point(4, 24); this.tpOctopus.Name = "tpOctopus"; this.tpOctopus.Padding = new System.Windows.Forms.Padding(3); - this.tpOctopus.Size = new System.Drawing.Size(256, 296); + this.tpOctopus.Size = new System.Drawing.Size(256, 348); this.tpOctopus.TabIndex = 0; this.tpOctopus.Text = "Octopus"; this.tpOctopus.UseVisualStyleBackColor = true; @@ -338,7 +354,7 @@ namespace Maestro { // octopusIDSelector // this.octopusIDSelector.BackColor = System.Drawing.Color.White; - this.octopusIDSelector.clearCheckBox = null; + this.octopusIDSelector.ClearCheckBox = null; this.octopusIDSelector.Disposeabel = false; this.octopusIDSelector.Dock = System.Windows.Forms.DockStyle.Fill; this.octopusIDSelector.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); @@ -348,7 +364,8 @@ namespace Maestro { this.octopusIDSelector.MinimumSize = new System.Drawing.Size(200, 300); this.octopusIDSelector.Name = "octopusIDSelector"; this.octopusIDSelector.Padding = new System.Windows.Forms.Padding(6); - this.octopusIDSelector.Size = new System.Drawing.Size(250, 300); + this.octopusIDSelector.ErrorReporter = null; + this.octopusIDSelector.Size = new System.Drawing.Size(250, 342); this.octopusIDSelector.TabIndex = 1; // // tpTraffic @@ -357,7 +374,7 @@ namespace Maestro { this.tpTraffic.Location = new System.Drawing.Point(4, 24); this.tpTraffic.Name = "tpTraffic"; this.tpTraffic.Padding = new System.Windows.Forms.Padding(3); - this.tpTraffic.Size = new System.Drawing.Size(256, 296); + this.tpTraffic.Size = new System.Drawing.Size(256, 348); this.tpTraffic.TabIndex = 1; this.tpTraffic.Text = "Traffic"; this.tpTraffic.UseVisualStyleBackColor = true; @@ -373,7 +390,7 @@ namespace Maestro { this.trafficIDSelector.Margin = new System.Windows.Forms.Padding(4); this.trafficIDSelector.Name = "trafficIDSelector"; this.trafficIDSelector.Padding = new System.Windows.Forms.Padding(6); - this.trafficIDSelector.Size = new System.Drawing.Size(250, 290); + this.trafficIDSelector.Size = new System.Drawing.Size(250, 342); this.trafficIDSelector.TabIndex = 0; // // tableLayoutPanel1 @@ -385,7 +402,7 @@ namespace Maestro { this.tableLayoutPanel1.Controls.Add(this.textSelectedMetadata, 0, 1); this.tableLayoutPanel1.Controls.Add(this.menuButtonActions, 1, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tableLayoutPanel1.Location = new System.Drawing.Point(10, 347); + this.tableLayoutPanel1.Location = new System.Drawing.Point(10, 399); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; @@ -442,7 +459,7 @@ namespace Maestro { this.groupTarget.Location = new System.Drawing.Point(0, 0); this.groupTarget.Name = "groupTarget"; this.groupTarget.Padding = new System.Windows.Forms.Padding(10); - this.groupTarget.Size = new System.Drawing.Size(316, 419); + this.groupTarget.Size = new System.Drawing.Size(316, 471); this.groupTarget.TabIndex = 0; this.groupTarget.TabStop = false; this.groupTarget.Text = "Target action"; @@ -462,7 +479,7 @@ namespace Maestro { this.panelActions.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0); this.panelActions.RowCount = 1; this.panelActions.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.panelActions.Size = new System.Drawing.Size(296, 324); + this.panelActions.Size = new System.Drawing.Size(296, 376); this.panelActions.TabIndex = 4; this.panelActions.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnTargetPanelsMouseClick); // @@ -471,7 +488,7 @@ namespace Maestro { this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.btnExecute); this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel1.Location = new System.Drawing.Point(10, 347); + this.panel1.Location = new System.Drawing.Point(10, 399); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(296, 62); this.panel1.TabIndex = 5; @@ -505,25 +522,47 @@ namespace Maestro { // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.groupActions); - this.splitContainer2.Size = new System.Drawing.Size(1022, 561); - this.splitContainer2.SplitterDistance = 419; + this.splitContainer2.Size = new System.Drawing.Size(1022, 632); + this.splitContainer2.SplitterDistance = 471; this.splitContainer2.TabIndex = 2; // // groupActions // this.groupActions.BackColor = System.Drawing.Color.Transparent; - this.groupActions.Controls.Add(this.dataGridJobs); + this.groupActions.Controls.Add(this.tabControl2); this.groupActions.Dock = System.Windows.Forms.DockStyle.Fill; this.groupActions.Location = new System.Drawing.Point(0, 0); this.groupActions.Name = "groupActions"; this.groupActions.Padding = new System.Windows.Forms.Padding(10); - this.groupActions.Size = new System.Drawing.Size(1022, 138); + this.groupActions.Size = new System.Drawing.Size(1022, 157); this.groupActions.TabIndex = 1; this.groupActions.TabStop = false; this.groupActions.Text = "Actions"; this.groupActions.Enter += new System.EventHandler(this.groupBox_Enter); this.groupActions.Leave += new System.EventHandler(this.groupBox_Leave); // + // tabControl2 + // + this.tabControl2.Controls.Add(this.tabPage1); + this.tabControl2.Controls.Add(this.tabPage2); + this.tabControl2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl2.Location = new System.Drawing.Point(10, 23); + this.tabControl2.Name = "tabControl2"; + this.tabControl2.SelectedIndex = 0; + this.tabControl2.Size = new System.Drawing.Size(1002, 124); + this.tabControl2.TabIndex = 1; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.dataGridJobs); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(994, 98); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = global::Maestro.StringResources.FOLYAMATOK; + this.tabPage1.UseVisualStyleBackColor = true; + // // dataGridJobs // this.dataGridJobs.AllowUserToAddRows = false; @@ -562,7 +601,7 @@ namespace Maestro { this.dataGridJobs.DefaultCellStyle = dataGridViewCellStyle8; this.dataGridJobs.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.dataGridJobs.Location = new System.Drawing.Point(10, 23); + this.dataGridJobs.Location = new System.Drawing.Point(3, 3); this.dataGridJobs.Name = "dataGridJobs"; dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; @@ -577,7 +616,7 @@ namespace Maestro { this.dataGridJobs.RowsDefaultCellStyle = dataGridViewCellStyle10; this.dataGridJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dataGridJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridJobs.Size = new System.Drawing.Size(1002, 105); + this.dataGridJobs.Size = new System.Drawing.Size(988, 92); this.dataGridJobs.TabIndex = 0; this.dataGridJobs.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridJobs_CellEnter); // @@ -649,6 +688,87 @@ namespace Maestro { this.columnOutput.Name = "columnOutput"; this.columnOutput.Width = 68; // + // tabPage2 + // + this.tabPage2.Controls.Add(this.dataGridMessages); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(994, 98); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = global::Maestro.StringResources.UZENETEK; + this.tabPage2.UseVisualStyleBackColor = true; + // + // dataGridMessages + // + this.dataGridMessages.AllowUserToAddRows = false; + this.dataGridMessages.AllowUserToOrderColumns = true; + this.dataGridMessages.AllowUserToResizeRows = false; + this.dataGridMessages.AutoGenerateColumns = false; + this.dataGridMessages.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells; + this.dataGridMessages.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; + this.dataGridMessages.BackgroundColor = System.Drawing.Color.White; + this.dataGridMessages.BorderStyle = System.Windows.Forms.BorderStyle.None; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridMessages.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + this.dataGridMessages.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.timeDataGridViewTextBoxColumn, + this.messageDataGridViewTextBoxColumn}); + this.dataGridMessages.DataSource = this.systemMessageBindingSource; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.Gainsboro; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridMessages.DefaultCellStyle = dataGridViewCellStyle12; + this.dataGridMessages.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.dataGridMessages.Location = new System.Drawing.Point(3, 3); + this.dataGridMessages.Name = "dataGridMessages"; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridMessages.RowHeadersDefaultCellStyle = dataGridViewCellStyle13; + this.dataGridMessages.RowHeadersVisible = false; + dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.dataGridMessages.RowsDefaultCellStyle = dataGridViewCellStyle14; + this.dataGridMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.dataGridMessages.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridMessages.Size = new System.Drawing.Size(988, 92); + this.dataGridMessages.TabIndex = 0; + this.dataGridMessages.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridMessages_RowsAdded); + // + // timeDataGridViewTextBoxColumn + // + this.timeDataGridViewTextBoxColumn.DataPropertyName = "Time"; + this.timeDataGridViewTextBoxColumn.HeaderText = "Time"; + this.timeDataGridViewTextBoxColumn.Name = "timeDataGridViewTextBoxColumn"; + this.timeDataGridViewTextBoxColumn.Width = 60; + // + // messageDataGridViewTextBoxColumn + // + this.messageDataGridViewTextBoxColumn.DataPropertyName = "message"; + this.messageDataGridViewTextBoxColumn.HeaderText = "message"; + this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn"; + this.messageDataGridViewTextBoxColumn.Width = 83; + // + // systemMessageBindingSource + // + this.systemMessageBindingSource.DataSource = typeof(Maestro.SystemMessage); + // // metadataInfoBindingSource // this.metadataInfoBindingSource.DataSource = typeof(Maestro.Metadata.MetadataInfo); @@ -658,7 +778,7 @@ namespace Maestro { this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(1022, 561); + this.ClientSize = new System.Drawing.Size(1022, 632); this.Controls.Add(this.splitContainer2); this.Icon = global::Maestro.Properties.Resources.AppIcon; this.Name = "MaestroForm"; @@ -696,8 +816,13 @@ namespace Maestro { ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); this.groupActions.ResumeLayout(false); + this.tabControl2.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridJobs)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bindingSourceJobs)).EndInit(); + this.tabPage2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridMessages)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.systemMessageBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.metadataInfoBindingSource)).EndInit(); this.ResumeLayout(false); @@ -744,6 +869,13 @@ namespace Maestro { private System.Windows.Forms.DataGridViewTextBoxColumn columnFinished; private System.Windows.Forms.DataGridViewTextBoxColumn columnInput; private System.Windows.Forms.DataGridViewTextBoxColumn columnOutput; + private System.Windows.Forms.TabControl tabControl2; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.DataGridView dataGridMessages; + private System.Windows.Forms.BindingSource systemMessageBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn timeDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn; } } diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 14c17c32..c317cd85 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -42,7 +42,8 @@ namespace Maestro { Address = metadata.Server.Address, UserName = metadata.Server.UserName, Password = metadata.Server.Password, - Timeout = metadata.Server.Timeout + Timeout = metadata.Server.Timeout, + ErrorReporter = ReportError }; trafficIDSelector.IDChangedEvent += TrafficIDSelected; } @@ -64,7 +65,7 @@ namespace Maestro { MediaCubeMetadata metadata = Configuration.Metadatas.Where(m => { return m is MediaCubeMetadata; }).FirstOrDefault() as MediaCubeMetadata; if (metadata == null) return; - mediaCubeApi = new MediaCubeApi(metadata.Server.Address.ToString(), metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout); + mediaCubeApi = new MediaCubeApi(metadata.Server.Address.ToString(), metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout) { ErrorReporter = ReportError }; } private void OnOctopusIDSelected(string selectedID) { diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index a044d31b..88cac0c9 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -37,12 +37,12 @@ namespace Maestro { if (Configuration?.Source is UNCSource) { logger.Debug("UNC source initialization"); - source = new FileSystemSource(this, MessageBus); + source = new FileSystemSource(this, MessageBus, Configuration.Filter); logger.Debug("UNC source created"); } if (Configuration?.Source is NEXIOSource) { logger.Debug("NEXIO source initialization"); - source = new NexioRESTSource(this, MessageBus); + source = new NexioRESTSource(this, MessageBus, ReportError); logger.Debug("NEXIO source created"); } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index d8a69d23..3323c8df 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -77,15 +77,6 @@ namespace Maestro { ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters); processors.Add(processor); } - //foreach (String actual in selectedSources) { - // string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor); - // Type type = Type.GetType(typeName); - // ISourceItem selectedFile = GetSourceItemFromBindingSource(actual);//bindingSource.Current as ISourceItem; - // string id = selectedMetadata.ID; - // object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi, model }; - // ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters); - // processors.Add(processor); - //} currentProcessors.Add(checkBox, processors); } else currentProcessors.Remove(checkBox); diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index e9a08042..038d9f80 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -29,6 +29,7 @@ namespace Maestro { public ConfigurationInfo Configuration; private TraficMetadataSelected trafficMetadataSelected; private OctopusMetadataSelected octopusMetadataSelected; + private Color newMSGColor; public Clear clear; @@ -41,7 +42,8 @@ namespace Maestro { public MaestroForm() { InitializeComponent(); trafficIDSelector.clearCheckBox = octopusIDSelector.ClearEveryCheckBox; - octopusIDSelector.clearCheckBox = trafficIDSelector.ClearSelectionSource; + octopusIDSelector.ClearCheckBox = trafficIDSelector.ClearSelectionSource; + octopusIDSelector.ErrorReporter = ReportError; groups = new GroupBox[] { groupSource, groupMetadata, groupTarget, groupActions }; trafficMetadataSelected = TrafficIDSelected; octopusMetadataSelected = OnOctopusIDSelected; @@ -64,7 +66,6 @@ namespace Maestro { columnStatus.HeaderText = StringResources.STATUSZ; ctxiDefineSegments.Text = StringResources.SZEGMENS_LETREHOZASA; ctxiModifyArchiveMetadata.Text = StringResources.ARCHÍV_METAADATOK_MODOSITASA; - buttonMetadata.Text = StringResources.METAADAT; } private void InitializeComponents() { @@ -72,9 +73,23 @@ namespace Maestro { InitializeMetadata(); InitializeTarget(); InitializeJobs(); + InitializeMessages(); InitializeControlTexts(); } + private void InitializeMessages() { + dataGridMessages.Columns.AddRange(new DataGridViewTextBoxColumn() { + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, + DataPropertyName = "Time", + HeaderText = StringResources.IDO + }, + new DataGridViewTextBoxColumn() { + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, + DataPropertyName = "Message", + HeaderText = StringResources.UZENET + }); + } + private void InitializeJobs() { bindingSourceJobs.DataSource = jobs; foreach (DataGridViewColumn column in dataGridJobs.Columns) { @@ -244,5 +259,19 @@ namespace Maestro { } + public void ReportError(DateTime time, String message, Color color) { + systemMessageBindingSource.Insert(0, new SystemMessage() { Time = time, message = message}); + UpdateDataChanged(); + newMSGColor = color; + } + + private void UpdateDataChanged() { + dataGridMessages.DataSource = null; + dataGridMessages.DataSource = systemMessageBindingSource; + } + + private void dataGridMessages_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { + dataGridMessages.Rows[0].DefaultCellStyle.BackColor = newMSGColor; + } } } diff --git a/client/Maestro/MaestroForm.resx b/client/Maestro/MaestroForm.resx index 6323a0bb..a7fb3dc3 100644 --- a/client/Maestro/MaestroForm.resx +++ b/client/Maestro/MaestroForm.resx @@ -147,6 +147,9 @@ 154, 17 + + 630, 17 + 309, 17 diff --git a/client/Maestro/Properties/DataSources/SystemMessage.datasource b/client/Maestro/Properties/DataSources/SystemMessage.datasource new file mode 100644 index 00000000..4435d113 --- /dev/null +++ b/client/Maestro/Properties/DataSources/SystemMessage.datasource @@ -0,0 +1,10 @@ + + + + Maestro.SystemMessage, Maestro, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/client/Maestro/Resources/configuration-nexio.json b/client/Maestro/Resources/configuration-nexio.json index afd9612f..0ac702f2 100644 --- a/client/Maestro/Resources/configuration-nexio.json +++ b/client/Maestro/Resources/configuration-nexio.json @@ -3,6 +3,7 @@ "active": true, "startInTray": false, "enableNameOverride": false, + "filter": "avi", "player": { "enabled": true, "autoStart": false, diff --git a/client/Maestro/Resources/configuration-unc.json b/client/Maestro/Resources/configuration-unc.json index 32c05da0..dba3de99 100644 --- a/client/Maestro/Resources/configuration-unc.json +++ b/client/Maestro/Resources/configuration-unc.json @@ -4,6 +4,7 @@ "startInTray": false, "enableNameOverride": false, "enableCustomMetadataId": true, + "filter": "avi,wav", "player": { "enabled": true, "autoStart": false, @@ -12,19 +13,19 @@ "source": { "$type": "UNCSource", "local": { - "address": "file://10.10.1.100/BRAAVOS/_TEST_/_ECHO/hirado/test" + "address": "file://localhost/watch" }, "remote": { - "address": "ftp://10.10.1.100:21/_TEST_/_ECHO/hirado/test", - "userName": "mediacube", - "password": "Broadca5T" + "address": "ftp://localhost:21/watch", + "userName": "dani", + "password": "dani" } }, "metadatas": [ { "$type": "OctopusMetadata", "server": { - "address": "http://10.10.1.28:8080/services/rest/octopus/", + "address": "http://100.10.1.28:8080/services/rest/octopus/", "userName": "dani", "password": "dani", "timeout": 1000 diff --git a/client/Maestro/Sources/CreatedFileMonitor.cs b/client/Maestro/Sources/CreatedFileMonitor.cs index fa65e0ae..212a6789 100644 --- a/client/Maestro/Sources/CreatedFileMonitor.cs +++ b/client/Maestro/Sources/CreatedFileMonitor.cs @@ -17,14 +17,14 @@ namespace Maestro.Sources { while (!e.Cancel) { Thread.Sleep(3000); FileInfo fi = new FileInfo(path); - if (lastSize == fi.Length) { - e.Result = fi; - break; - } - else - lastSize = fi.Length; + if (fi.Exists) + if (lastSize == fi.Length) { + e.Result = fi; + break; + } else + lastSize = fi.Length; } - + } diff --git a/client/Maestro/Sources/FileSourceItem.cs b/client/Maestro/Sources/FileSourceItem.cs index 815c1248..d441a315 100644 --- a/client/Maestro/Sources/FileSourceItem.cs +++ b/client/Maestro/Sources/FileSourceItem.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Drawing; using System.IO; using System.Runtime.CompilerServices; +using System.Collections.Generic; namespace Maestro.Sources { public class FileSourceItem : ISourceItem { @@ -60,5 +61,13 @@ namespace Maestro.Sources { } } + + public bool CanHandle(List extensions) { + if (extensions == null || extensions.Count < 1) + return true; + if (extensions.Contains(fileInfo.Extension.Substring(1))) + return true; + return false; + } } } diff --git a/client/Maestro/Sources/FileSystemSource.cs b/client/Maestro/Sources/FileSystemSource.cs index cdeec3c5..b4148f8b 100644 --- a/client/Maestro/Sources/FileSystemSource.cs +++ b/client/Maestro/Sources/FileSystemSource.cs @@ -19,6 +19,8 @@ namespace Maestro.Sources { private List createdFileMonitors = new List(); private Control parent; private string filter; + private string fileExtensionFilter; + private List acceptableExtensions = new List(); private List cache = new List(); public DataGridViewColumn[] Columns { @@ -62,9 +64,15 @@ namespace Maestro.Sources { public bool SupportsFiltering => true; - public FileSystemSource(Control parent, IMessageBus messageBus) { + public FileSystemSource(Control parent, IMessageBus messageBus, String fileExtensionFilter) { this.parent = parent; this.messageBus = messageBus; + this.fileExtensionFilter = fileExtensionFilter; + SetAcceptableExtensions(); + } + + private void SetAcceptableExtensions() { + acceptableExtensions = fileExtensionFilter.Split(',').ToList(); } public void Startup(Uri address) { @@ -88,7 +96,8 @@ namespace Maestro.Sources { private void initializeList(string path) { string[] files = Directory.GetFiles(path); - files.Select(f => CreateItem(new FileInfo(f), false)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); + //files.Select(f => CreateItem(new FileInfo(f), false)).Where(x => x.Name.EndsWith("avi")).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); + files.Select(f => CreateItem(new FileInfo(f), false)).Where(x => x.CanHandle(acceptableExtensions)).OrderByDescending(i => i.Created).ToList().ForEach(i => parent.SafeCall(() => Add(i))); cache.AddRange(this); } @@ -109,13 +118,15 @@ namespace Maestro.Sources { var item = this.Where(x => x.Name == e.OldName).SingleOrDefault(); if (item == null) return; - item.FileInfo = new FileInfo(e.FullPath); - parent.SafeCall(() => { - messageBus.Send(new ModifyFileActionMsg() { - FileName = e.Name, - Source = parent + if (item.CanHandle(acceptableExtensions)) { + item.FileInfo = new FileInfo(e.FullPath); + parent.SafeCall(() => { + messageBus.Send(new ModifyFileActionMsg() { + FileName = e.Name, + Source = parent + }); }); - }); + } } private void OnChanged(object sender, FileSystemEventArgs e) { @@ -123,13 +134,15 @@ namespace Maestro.Sources { var item = this.Where(x => x.Name == e.Name).SingleOrDefault(); if (item == null) return; - item.FileInfo = new FileInfo(e.FullPath); - parent.SafeCall(() => { - messageBus.Send(new ModifyFileActionMsg() { - FileName = e.Name, - Source = parent + if (item.CanHandle(acceptableExtensions)) { + item.FileInfo = new FileInfo(e.FullPath); + parent.SafeCall(() => { + messageBus.Send(new ModifyFileActionMsg() { + FileName = e.Name, + Source = parent + }); }); - }); + } } private void OnCreated(object sender, FileSystemEventArgs e) { @@ -148,18 +161,24 @@ namespace Maestro.Sources { logger.Debug("{0} {1}", e.ChangeType, e.Name); } - private void OnDeleted(object sender, FileSystemEventArgs e) { + private void OnDeleted(object sender, FileSystemEventArgs e) { logger.Debug("{0} {1}", e.ChangeType, e.Name); - FileSourceItem fileSourceItem = this.Where(item => item.Name.Equals(e.Name)).First(); - parent.SafeCall(() => { - Remove(fileSourceItem); - messageBus.Send(new RemoveFileActionMsg() { - FileName = e.Name, - Source = parent + var enumList = this.Where(item => item.Name.Equals(e.Name))?.ToList(); + FileSourceItem fileSourceItem = enumList.Count == 0 ? null : enumList.First(); + if (fileSourceItem == null) + return; + if (fileSourceItem.CanHandle(acceptableExtensions)) { + parent.SafeCall(() => { + Remove(fileSourceItem); + messageBus.Send(new RemoveFileActionMsg() { + FileName = e.Name, + Source = parent + }); }); - }); - MaestroForm form = (MaestroForm)parent; - form.SourceDeleted(e.Name); + MaestroForm form = (MaestroForm)parent; + form.SourceDeleted(e.Name); + return; + } } public void ApplySort(ListSortDescriptionCollection sorts) { diff --git a/client/Maestro/Sources/NexioRESTSource.cs b/client/Maestro/Sources/NexioRESTSource.cs index bfc2c5ab..ad86398c 100644 --- a/client/Maestro/Sources/NexioRESTSource.cs +++ b/client/Maestro/Sources/NexioRESTSource.cs @@ -11,6 +11,7 @@ using WebSocketSharp; using System; using System.Drawing; using NLog; +using JobEngineClient; namespace Maestro.Sources { class NexioRESTSource : BindingList, ISource { @@ -66,9 +67,12 @@ namespace Maestro.Sources { public bool SupportsFiltering => throw new NotImplementedException(); - public NexioRESTSource(Control parent, IMessageBus messageBus) { + private MediaCubeErrorReporter errorReporter; + + public NexioRESTSource(Control parent, IMessageBus messageBus, MediaCubeErrorReporter errorReporter) { this.parent = parent; this.messageBus = messageBus; + this.errorReporter = errorReporter; } public void Startup(Uri address) { @@ -80,7 +84,7 @@ namespace Maestro.Sources { private void CreateWatch(string path) { logger.Info("info"); logger.Error("error"); - dataClient = new NexioAPI(path); + dataClient = new NexioAPI(path) { ErrorReporter = errorReporter}; dataClient.Open(OnResponse); } diff --git a/client/Maestro/StringResources.Designer.cs b/client/Maestro/StringResources.Designer.cs index 6855d6b3..452f016e 100644 --- a/client/Maestro/StringResources.Designer.cs +++ b/client/Maestro/StringResources.Designer.cs @@ -132,6 +132,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Folyamatok. + /// + internal static string FOLYAMATOK { + get { + return ResourceManager.GetString("FOLYAMATOK", resourceCulture); + } + } + /// /// Looks up a localized string similar to Forrás. /// @@ -150,6 +159,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Idő. + /// + internal static string IDO { + get { + return ResourceManager.GetString("IDO", resourceCulture); + } + } + /// /// Looks up a localized string similar to Kezdés. /// @@ -258,6 +276,24 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Üzenet. + /// + internal static string UZENET { + get { + return ResourceManager.GetString("UZENET", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Üzenetek. + /// + internal static string UZENETEK { + get { + return ResourceManager.GetString("UZENETEK", resourceCulture); + } + } + /// /// Looks up a localized string similar to Vége. /// diff --git a/client/Maestro/StringResources.resx b/client/Maestro/StringResources.resx index cbbbbab7..66d10991 100644 --- a/client/Maestro/StringResources.resx +++ b/client/Maestro/StringResources.resx @@ -141,12 +141,18 @@ Felvétel dátuma + + Folyamatok + Forrás Forrás fájl + + Idő + Kezdés @@ -183,6 +189,12 @@ Ügynökség + + Üzenet + + + Üzenetek + Vége diff --git a/client/Maestro/SystemMessage.cs b/client/Maestro/SystemMessage.cs new file mode 100644 index 00000000..f5b8db34 --- /dev/null +++ b/client/Maestro/SystemMessage.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Maestro { + public class SystemMessage { + + public DateTime Time { get; set; } + public String message { get; set; } + } +} diff --git a/client/MediaCubeClient/MediaCubeApi.cs b/client/MediaCubeClient/MediaCubeApi.cs index afa9fcee..647a99c2 100644 --- a/client/MediaCubeClient/MediaCubeApi.cs +++ b/client/MediaCubeClient/MediaCubeApi.cs @@ -8,8 +8,12 @@ using System; using System.Diagnostics; using System.Net; using System.Runtime.Serialization; +using System.Drawing; namespace JobEngineClient { + + public delegate void MediaCubeErrorReporter(DateTime time, String message, Color color); + public class MediaCubeApi { private const string DATEFORMAT = "yyyy'-'MM'-'dd'T'HH':'mm':'ssK"; private static Logger logger = LogManager.GetCurrentClassLogger(); @@ -17,6 +21,7 @@ namespace JobEngineClient { private JsonSerializerSettings serializerSettings; private string user; private string pwd; + public MediaCubeErrorReporter ErrorReporter { get; set; } public MediaCubeApi(string address, string user, string pwd, int timeout) { this.user = user; @@ -39,8 +44,10 @@ namespace JobEngineClient { //Debug.WriteLine(body); request.AddParameter("application/json", body, ParameterType.RequestBody); var response = client.Execute(request); - if (response.StatusCode != HttpStatusCode.OK || response.ContentLength < 1) + if (response.StatusCode != HttpStatusCode.OK || response.ContentLength < 1) { + ErrorReporter?.Invoke(DateTime.Now, String.Format("[MediaCube] {0}", response.ErrorMessage), Color.Red); return null; + } //Debug.WriteLine(response.Content); var result = JsonConvert.DeserializeObject(response.Content); return result; diff --git a/client/MediaCubeClient/MediaCubeClient.csproj b/client/MediaCubeClient/MediaCubeClient.csproj index 5cacaf49..6d1f5737 100644 --- a/client/MediaCubeClient/MediaCubeClient.csproj +++ b/client/MediaCubeClient/MediaCubeClient.csproj @@ -72,6 +72,7 @@ + diff --git a/client/MediaCubeClient/NexioAPI.cs b/client/MediaCubeClient/NexioAPI.cs index 4bcaacc3..69dadbdd 100644 --- a/client/MediaCubeClient/NexioAPI.cs +++ b/client/MediaCubeClient/NexioAPI.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json.Linq; using System; using System.Diagnostics; using WebSocketSharp; - +using JobEngineClient; namespace NexioClient { public class NexioAPI { @@ -14,7 +14,7 @@ namespace NexioClient { public const string UPDATE = "update"; private WebSocket ws = null; private string path; - + public MediaCubeErrorReporter ErrorReporter { get; set; } public NexioAPI(String path) { this.path = path; } @@ -55,6 +55,7 @@ namespace NexioClient { ws.Connect(); } catch (Exception e) { + ErrorReporter?.Invoke(DateTime.Now, String.Format("[NexioAPI] {0}", e.Message), System.Drawing.Color.Red); } } @@ -65,6 +66,7 @@ namespace NexioClient { ws.Send(data.ToString()); } catch (Exception e) { + ErrorReporter?.Invoke(DateTime.Now, String.Format("[NexioAPI] {0}", e.Message), System.Drawing.Color.Red); } } diff --git a/client/OctopusClient/OctopusAPI.cs b/client/OctopusClient/OctopusAPI.cs index f23fda47..988bf059 100644 --- a/client/OctopusClient/OctopusAPI.cs +++ b/client/OctopusClient/OctopusAPI.cs @@ -67,14 +67,16 @@ namespace OctopusClient { private RestClient client; private string user; private string pwd; + private OctopusErrorReporterDelegate errorRiporter; - public OctopusAPI(string address, string user, string pwd, int timeout) { + public OctopusAPI(string address, string user, string pwd, int timeout, OctopusErrorReporterDelegate errorRiporter) { this.user = user; this.pwd = pwd; client = new RestClient(address) { Authenticator = new HttpBasicAuthenticator(user, pwd), Timeout = timeout }; + this.errorRiporter = errorRiporter; } public IEnumerable GetRundowns(DateTime scheduledDate) { @@ -85,7 +87,7 @@ namespace OctopusClient { request.AddParameter("scheduledDate", dt, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -99,7 +101,8 @@ namespace OctopusClient { }); } catch (Exception e) { - //log e.Message ?? + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + return result; } return result; } @@ -111,7 +114,7 @@ namespace OctopusClient { request.AddParameter("rundownID", rundownID, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -133,7 +136,9 @@ namespace OctopusClient { return r.ID; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -144,7 +149,7 @@ namespace OctopusClient { request.AddParameter("storyFolderID", storyFolderID, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -167,7 +172,9 @@ namespace OctopusClient { return r.ID; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -214,7 +221,7 @@ namespace OctopusClient { var request = new RestRequest("storyfolders", Method.GET); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -226,7 +233,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -236,7 +245,7 @@ namespace OctopusClient { var request = new RestRequest("stories", Method.GET); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -254,7 +263,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -265,7 +276,7 @@ namespace OctopusClient { request.AddParameter("id", id, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -283,7 +294,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -294,7 +307,7 @@ namespace OctopusClient { request.AddParameter("id", id, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -307,7 +320,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -318,7 +333,7 @@ namespace OctopusClient { request.AddParameter("id", id, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -332,7 +347,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -343,7 +360,7 @@ namespace OctopusClient { request.AddParameter("id", id, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -359,7 +376,9 @@ namespace OctopusClient { return r; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } @@ -370,7 +389,7 @@ namespace OctopusClient { request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -384,7 +403,7 @@ namespace OctopusClient { }); } catch (Exception e) { - //log e.Message ?? + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); } return result; } @@ -396,7 +415,7 @@ namespace OctopusClient { request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -409,7 +428,7 @@ namespace OctopusClient { }); } catch (Exception e) { - //log e.Message ?? + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); } return result; } @@ -421,7 +440,7 @@ namespace OctopusClient { request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); var response = client.Execute(request); if (response.ContentLength == 0) - return null; + throw new Exception(String.Format("[Octopus] {0}", response.ErrorMessage)); JArray resultObject = JArray.Parse(response.Content); result = resultObject.Children().Select(d => { @@ -444,7 +463,9 @@ namespace OctopusClient { return r.ID; }); } - catch (Exception e) { } + catch (Exception e) { + errorRiporter?.Invoke(DateTime.Now, e.Message, System.Drawing.Color.Red); + } return result; } } diff --git a/client/OctopusClient/OctopusIDSelector.cs b/client/OctopusClient/OctopusIDSelector.cs index 65a2fe9e..6d45babf 100644 --- a/client/OctopusClient/OctopusIDSelector.cs +++ b/client/OctopusClient/OctopusIDSelector.cs @@ -4,15 +4,19 @@ using System.Linq; using System.Windows.Forms; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; namespace OctopusClient { public delegate void OnSelectedIDChanged(string ID); public delegate void ClearCheckBox(); + public delegate void OctopusErrorReporterDelegate(DateTime time, String message, Color color); public partial class OctopusIDSelector : UserControl { private string id; - public ClearCheckBox clearCheckBox { get; set; } + public ClearCheckBox ClearCheckBox { get; set; } + + public OctopusErrorReporterDelegate ErrorReporter { get; set; } public bool Disposeabel { get; set; } @@ -27,7 +31,7 @@ namespace OctopusClient { public OctopusConfiguration Configuration { set { - client = new OctopusAPI(value.Address.OriginalString, value.UserName, value.Password, value.Timeout); + client = new OctopusAPI(value.Address.OriginalString, value.UserName, value.Password, value.Timeout, ErrorReporter); refreshStoryFolders(); refreshRundowns(); } @@ -226,7 +230,7 @@ namespace OctopusClient { private void InnerAfterCheck(TreeNode node) { string text = node.Name; checkFromCode = false; - clearCheckBox?.Invoke(); + ClearCheckBox?.Invoke(); ClearSelectionSource(node, treeContent.Nodes); id = node.Checked ? text : string.Empty; IDChangedEvent?.Invoke(id); diff --git a/client/OctopusClient/Resources.Designer.cs b/client/OctopusClient/Resources.Designer.cs index abda2f3f..d1feb6af 100644 --- a/client/OctopusClient/Resources.Designer.cs +++ b/client/OctopusClient/Resources.Designer.cs @@ -177,6 +177,15 @@ namespace OctopusClient { } } + /// + /// Looks up a localized string similar to Nem lehet csatlakozni az octopus kiszolgálóhoz. + /// + internal static string OCTOPUS_KAPCSOLATI_HIBA { + get { + return ResourceManager.GetString("OCTOPUS_KAPCSOLATI_HIBA", resourceCulture); + } + } + /// /// Looks up a localized string similar to Válasszon elemet. /// diff --git a/client/OctopusClient/Resources.resx b/client/OctopusClient/Resources.resx index 3baa3ae9..3e037957 100644 --- a/client/OctopusClient/Resources.resx +++ b/client/OctopusClient/Resources.resx @@ -156,6 +156,9 @@ Objektum típusa + + Nem lehet csatlakozni az octopus kiszolgálóhoz + Válasszon elemet diff --git a/client/PlanAIRClient/Reader.cs b/client/PlanAIRClient/Reader.cs index 00b7a50f..68be041d 100644 --- a/client/PlanAIRClient/Reader.cs +++ b/client/PlanAIRClient/Reader.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Data.SqlClient; namespace TrafficClient { diff --git a/client/PlanAIRClient/TrafficAPI.cs b/client/PlanAIRClient/TrafficAPI.cs index 050aacab..4425eacd 100644 --- a/client/PlanAIRClient/TrafficAPI.cs +++ b/client/PlanAIRClient/TrafficAPI.cs @@ -17,14 +17,14 @@ namespace TrafficClient { private AdvertisementWorker adWorker; private SegmentWorker segmentWorker; - public TrafficAPI(string connString, string user, string password, int timeout) { + public TrafficAPI(string connString, string user, string password, int timeout, TrafficErrorReporterDelegate errorReporter) { connectionString = String.Format("{0};User ID={1};Password={2};Connection Timeout={3}", connString, user, password, timeout); connection = new SqlConnection(connectionString); cliFSPReader = new CliFSPReader(); - broadvastWorker = new BroadcastWorker(connection, cliFSPReader); - promoWorker = new PromotionalWorker(connection, cliFSPReader); - adWorker = new AdvertisementWorker(connection, cliFSPReader); - segmentWorker = new SegmentWorker(connection, cliFSPReader); + broadvastWorker = new BroadcastWorker(connection, cliFSPReader, errorReporter); + promoWorker = new PromotionalWorker(connection, cliFSPReader, errorReporter); + adWorker = new AdvertisementWorker(connection, cliFSPReader, errorReporter); + segmentWorker = new SegmentWorker(connection, cliFSPReader, errorReporter); } public List GetBroadcasts(string strParam, DateTime? from, DateTime? to, bool missingCopia) { diff --git a/client/PlanAIRClient/TrafficConfiguration.cs b/client/PlanAIRClient/TrafficConfiguration.cs index 17542d93..9c5d76a0 100644 --- a/client/PlanAIRClient/TrafficConfiguration.cs +++ b/client/PlanAIRClient/TrafficConfiguration.cs @@ -12,5 +12,6 @@ namespace TrafficClient public string UserName { get; set; } public string Password { get; set; } public int Timeout; + public TrafficErrorReporterDelegate ErrorReporter { get; set; } } } diff --git a/client/PlanAIRClient/TrafficIDSelector.cs b/client/PlanAIRClient/TrafficIDSelector.cs index 54392a40..a5035585 100644 --- a/client/PlanAIRClient/TrafficIDSelector.cs +++ b/client/PlanAIRClient/TrafficIDSelector.cs @@ -8,11 +8,13 @@ using System.Collections.Generic; namespace TrafficClient { public delegate void OnSelectedIDChanged(string ID, int variantID); public delegate void ClearCheckBox(); - + public delegate void TrafficErrorReporterDelegate(DateTime time, String message, Color color); public partial class TrafficIDSelector : UserControl { public TrafficAPI trafficAPI { get; private set; } public OnSelectedIDChanged IDChangedEvent { get; set; } public ClearCheckBox clearCheckBox { get; set; } + + public TrafficErrorReporterDelegate ErrorReporter { get; set; } public TrafficIDSelector() { InitializeComponent(); InitializeTexts(); @@ -72,7 +74,7 @@ namespace TrafficClient { public TrafficConfiguration Configuration { set { - trafficAPI = new TrafficAPI(value.Address.OriginalString, value.UserName, value.Password, value.Timeout); + trafficAPI = new TrafficAPI(value.Address.OriginalString, value.UserName, value.Password, value.Timeout, value.ErrorReporter); } } diff --git a/client/PlanAIRClient/Workers/AdvertisementWorker.cs b/client/PlanAIRClient/Workers/AdvertisementWorker.cs index 2ddf0720..77db905c 100644 --- a/client/PlanAIRClient/Workers/AdvertisementWorker.cs +++ b/client/PlanAIRClient/Workers/AdvertisementWorker.cs @@ -9,7 +9,8 @@ namespace TrafficClient.Workers { private static Logger logger = LogManager.GetCurrentClassLogger(); - public AdvertisementWorker(SqlConnection connection, CliFSPReader cliFSPReader) : base(connection, cliFSPReader) { + public AdvertisementWorker(SqlConnection connection, CliFSPReader cliFSPReader, TrafficErrorReporterDelegate errorReporter) : + base(connection, cliFSPReader, errorReporter) { } public List GetAdvertisements(string strParam) { @@ -29,7 +30,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -81,7 +82,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); diff --git a/client/PlanAIRClient/Workers/BroadcastWorker.cs b/client/PlanAIRClient/Workers/BroadcastWorker.cs index 70097c6c..87684d2b 100644 --- a/client/PlanAIRClient/Workers/BroadcastWorker.cs +++ b/client/PlanAIRClient/Workers/BroadcastWorker.cs @@ -10,8 +10,8 @@ namespace TrafficClient.Workers { private static Logger logger = LogManager.GetCurrentClassLogger(); - public BroadcastWorker(SqlConnection connection, CliFSPReader cliFSPReader) - : base(connection, cliFSPReader){ + public BroadcastWorker(SqlConnection connection, CliFSPReader cliFSPReader, TrafficErrorReporterDelegate errorReporter) + : base(connection, cliFSPReader, errorReporter){ } public List GetBroadcasts(string strParam, DateTime? from, DateTime? to, bool missingCopia) { @@ -43,7 +43,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -100,7 +100,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -137,7 +137,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); diff --git a/client/PlanAIRClient/Workers/PromotionalWorker.cs b/client/PlanAIRClient/Workers/PromotionalWorker.cs index ec61c8f0..4c2aea58 100644 --- a/client/PlanAIRClient/Workers/PromotionalWorker.cs +++ b/client/PlanAIRClient/Workers/PromotionalWorker.cs @@ -9,8 +9,8 @@ namespace TrafficClient.Workers { private static Logger logger = LogManager.GetCurrentClassLogger(); - public PromotionalWorker(SqlConnection connection, CliFSPReader cliFSPReader) - : base(connection, cliFSPReader) { + public PromotionalWorker(SqlConnection connection, CliFSPReader cliFSPReader, TrafficErrorReporterDelegate errorReporter) + : base(connection, cliFSPReader, errorReporter) { } public List GetPromotionals(string strParam) { @@ -30,7 +30,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -68,7 +68,7 @@ namespace TrafficClient.Workers { } } catch (Exception e) { - logger.Error(e.Message); + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } return result; } @@ -90,7 +90,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); diff --git a/client/PlanAIRClient/Workers/SegmentWorker.cs b/client/PlanAIRClient/Workers/SegmentWorker.cs index 16514d53..08167d7c 100644 --- a/client/PlanAIRClient/Workers/SegmentWorker.cs +++ b/client/PlanAIRClient/Workers/SegmentWorker.cs @@ -10,7 +10,8 @@ namespace TrafficClient.Workers { private static Logger logger = LogManager.GetCurrentClassLogger(); - public SegmentWorker(SqlConnection connection, CliFSPReader cliFSPReader) : base(connection, cliFSPReader) { + public SegmentWorker(SqlConnection connection, CliFSPReader cliFSPReader, TrafficErrorReporterDelegate errorReporter) : + base(connection, cliFSPReader, errorReporter) { } public List GetSegments(int itemID) { @@ -34,7 +35,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -72,7 +73,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -94,7 +95,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); @@ -123,7 +124,7 @@ namespace TrafficClient.Workers { } catch (Exception e) { logger.Error(e.Message); - throw e; + errorReporter?.Invoke(DateTime.Now, String.Format("[Traffic] {0}", e.Message), System.Drawing.Color.Red); } finally { connection.Close(); diff --git a/client/PlanAIRClient/Workers/TrafficWorker.cs b/client/PlanAIRClient/Workers/TrafficWorker.cs index 793b156f..b127b29f 100644 --- a/client/PlanAIRClient/Workers/TrafficWorker.cs +++ b/client/PlanAIRClient/Workers/TrafficWorker.cs @@ -6,12 +6,14 @@ using System.Data.SqlClient; namespace TrafficClient.Workers { public class TrafficWorker { + protected TrafficErrorReporterDelegate errorReporter; protected CliFSPReader cliFSPReader; protected SqlConnection connection; - public TrafficWorker(SqlConnection connection, CliFSPReader cliFSPReader) { + public TrafficWorker(SqlConnection connection, CliFSPReader cliFSPReader, TrafficErrorReporterDelegate errorReporter) { this.connection = connection; this.cliFSPReader = cliFSPReader; + this.errorReporter = errorReporter; } protected void TryConnect() { if (connection.State != ConnectionState.Open) { -- 2.54.0