git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorBellai Ádám <USER\adam.bellai>
Fri, 29 Sep 2017 11:50:24 +0000 (11:50 +0000)
committerBellai Ádám <USER\adam.bellai>
Fri, 29 Sep 2017 11:50:24 +0000 (11:50 +0000)
18 files changed:
client/IntegrationTests/MaestroIT.cs
client/Maestro/ArchiveMetadata.Designer.cs
client/Maestro/ArchiveMetadata.cs
client/Maestro/Configuration/ConfigurationInfo.cs
client/Maestro/MaestroForm.Metadata.cs
client/Maestro/MaestroForm.Source.cs
client/Maestro/MaestroForm.Target.cs
client/Maestro/Metadata/ArchiveMetadata.cs
client/Maestro/Resources/configuration-unc.json
client/Maestro/StringResources.Designer.cs
client/Maestro/StringResources.resx
client/Maestro/Targets/FTPTargetProcessor.cs
client/Maestro/Targets/FXPTargetProcessor.cs
client/Maestro/Targets/TargetProcessor.cs
client/OctopusClient/Resources.Designer.cs
client/OctopusClient/Resources.resx
client/PlanAIRClient/TrafficIDSelector.Designer.cs
client/PlanAIRClient/TrafficIDSelector.cs

index e9ef00c22d7f54fd4d6390a688ba27d463cae730..2ab62d648ae68d4f017dae0c7d371e51b20a3298 100644 (file)
@@ -17,8 +17,7 @@ namespace IntegrationTests {
                 },\r
                 OutputFormat = "{0}_{1}_{2}"\r
             };\r
-            //todo utolsó paraméterként szegmens lista átadása\r
-            FTPTargetProcessor sut = new FTPTargetProcessor(null, null, configuration, @"c:\tmp\watch\tcdrone.MXF", "000000", null);\r
+            FTPTargetProcessor sut = new FTPTargetProcessor(null, null, configuration, @"c:\tmp\watch\tcdrone.MXF", "000000", null, null, null);\r
             sut.Execute();\r
         }\r
 \r
index 737d7eb2e14cd035f98c072606937844a43f7f64..777450f316b4f2fa8ff7bfe9227e3040404ad8a5 100644 (file)
             this.button_cancel.TabIndex = 0;\r
             this.button_cancel.Text = "Cancel";\r
             this.button_cancel.UseVisualStyleBackColor = true;\r
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);\r
             // \r
             // button_ok\r
             // \r
index 0217f905421ef4b20eee25cc3506eef3a681a25f..ea56eca2dcb25a9d9b76c79402f762bf421cf2c0 100644 (file)
@@ -25,7 +25,17 @@ namespace Maestro {
         }\r
 \r
         private void button_ok_Click(object sender, System.EventArgs e) {\r
-            //todo\r
+            model.StuffID = textBox_stuffID.Text;\r
+            model.StuffTitle = textBox_stuffTitle.Text;\r
+            model.StuffDescription = textBox_stuffDescription.Text;\r
+            model.MediaID = textBox_mediaID.Text;\r
+            model.MediaTitle = textBox_mediaTitle.Text;\r
+            model.MediaDescription = textBox_mediaDescription.Text;\r
+            Dispose();\r
+        }\r
+\r
+        private void button_cancel_Click(object sender, System.EventArgs e) {\r
+            Dispose();\r
         }\r
     }\r
 }\r
index 8d6d7abde68d16503ce056902738f305afa6fdc3..79e2103e2d10b8e5d5fa363028b9ca1c5696c88e 100644 (file)
@@ -48,6 +48,7 @@ namespace Maestro.Configuration {
         public bool SaveSegments { get; set; }\r
         public bool CreateSubFolder { get; set; }\r
         public string Tag { get; set; }\r
+        public bool UseMetadata {get; set;}\r
     }\r
 \r
     public class Connection {\r
index 5dc07076e41b95048faaaf5ddb79742355ffb94e..a760f5a3acf6028f8330c54000b91ca6e9be234a 100644 (file)
@@ -10,12 +10,13 @@ using System.Collections.Generic;
 using System.ComponentModel;\r
 using System.Text.RegularExpressions;\r
 using JobEngineClient;\r
+\r
 namespace Maestro {\r
     public partial class MaestroForm {\r
         private MetadataInfo selectedMetadata;\r
         private List<Segment> segments = new List<Segment>();\r
         private MediaCubeApi mediaCubeApi;\r
-\r
+        private ArchiveMetadataModel model;\r
         public MetadataInfo SelectedMetadata {\r
             get {\r
                 return selectedMetadata;\r
@@ -74,64 +75,11 @@ namespace Maestro {
         }\r
 \r
         private void ModifyArchiveMetadataClick(object sender, EventArgs e) {\r
-            ArchiveMetadata form = null;\r
-            IDTypes idType = GetTypeOfSelectedMetadata();\r
-            ArchiveMetadataModel model = new ArchiveMetadataModel();\r
-            Cursor.Current = Cursors.WaitCursor;\r
-            if (idType == IDTypes.OctopusID)\r
-                FillTheModelFromOctopus(model);\r
-            else if (idType == IDTypes.TrafficID)\r
-                FillTheModelFromTraffic(model);\r
-            form = new ArchiveMetadata(model);\r
+            ArchiveMetadata form = new ArchiveMetadata(model);\r
             form.ShowDialog();\r
         }\r
 \r
-        private void FillTheModelFromTraffic(ArchiveMetadataModel model) {\r
-            string id = selectedMetadata.ID;\r
-            TrafficAPI api = trafficIDSelector.trafficAPI;\r
-            List<ArchiveMatadataWrapper> result = api.SearchArchiveMetadata(id); ;\r
-            ArchiveMatadataWrapper actualResult = result[0];\r
-            model.StuffID = actualResult.ProgID;\r
-            model.StuffTitle = actualResult.ProgTitle;\r
-            model.StuffDescription = actualResult.ProgDescription;\r
-            model.MediaID = actualResult.EpisodeID;\r
-            model.MediaTitle = String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle;\r
-            model.MediaDescription = actualResult.EpisodeDescription;\r
-        }\r
-\r
-        private void FillTheModelFromOctopus(ArchiveMetadataModel model) {\r
-            string id = selectedMetadata.ID;\r
-            OctopusAPI api = octopusIDSelector.GetClient();\r
-            IEnumerable<Story> storyEnum = api.GetStoriesById(id);\r
-            if (storyEnum != null) {\r
-                FillModelFromStories(model, storyEnum.ToList(), api);\r
-            } else {\r
-                //List<MosObject> mosObjectsEnum = api.GetMosObjectsByID(id).ToList();\r
-                //MosObject mosObject = mosObjectsEnum[0];\r
-                List<Story> stories = api.GetStoriesByPlaceHolderId(id).ToList();\r
-                FillModelFromStories(model, stories, api);\r
-                //todo ha mosObject, mivel töltsem fel a model-t?\r
-            }\r
-        }\r
-\r
-        private void FillModelFromStories(ArchiveMetadataModel model, List<Story> stories, OctopusAPI api) {\r
-            Story story = stories[0];\r
-            if (story.StoryFolders != null) {\r
-                List<StoryFolder> storyFolders = api.GetStoryFoldersByStoryID(story.ID).ToList();\r
-                StoryFolder folder = storyFolders[0];\r
-                model.StuffID = folder.ID;\r
-                model.StuffTitle = folder.Name;\r
-            } else if (story.Rundowns != null) {\r
-                List<Rundown> rundowns = api.GetRundownsByStoryID(story.ID).ToList();\r
-                Rundown rundown = rundowns[0];\r
-                model.StuffID = rundown.ID;\r
-                model.StuffTitle = rundown.Name;\r
-                model.StuffDescription = rundown.Start;\r
-            }\r
-            model.MediaID = story.ID;\r
-            model.MediaTitle = story.Name;\r
-            model.MediaDescription = story.Script;\r
-        }\r
+        \r
 \r
         private IDTypes GetTypeOfSelectedMetadata() {\r
             IDTypes result = IDTypes.None;\r
index d3488845ef035b9af72bde872e7bbdf3ba93d396..abd0ecede59379cf728cad980e8edb2724b803f6 100644 (file)
@@ -187,8 +187,9 @@ namespace Maestro {
         }\r
 \r
         private void SetSelectedSourceFileInfo(SourceInfo selectedSource) {\r
-            //todo ha nexio-s akkor null a fileinfo\r
-            if (selectedSources.Count == 1) {\r
+            if (Configuration.Source.GetType() == typeof(NEXIOSource))\r
+                selectedSource.FileInfo = null;\r
+            else if (selectedSources.Count == 1) {\r
                 Uri inputUri = new Uri(String.Format("{0}/{1}", Configuration.Source.Local.Address.LocalPath, selectedSources[0]));\r
                 selectedSource.FileInfo = new System.IO.FileInfo(inputUri.LocalPath);\r
             }\r
index a8e31f340c20f35c19ef717ba99efbe4450f1619..96ac62b049959e5c1102e83c7c4ba765b079e9e2 100644 (file)
@@ -8,6 +8,7 @@ using Maestro.Metadata;
 using System.Collections.Generic;\r
 using System.Text.RegularExpressions;\r
 using TrafficClient;\r
+using OctopusClient;\r
 \r
 namespace Maestro {\r
     public partial class MaestroForm {\r
@@ -42,18 +43,15 @@ namespace Maestro {
                     foreach (String actual in selectedSources) {\r
                         string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor);\r
                         Type type = Type.GetType(typeName);\r
-\r
-                        //ISourceItem actualFile =  new FileSourceItem() { FileInfo = new System.IO.FileInfo(actual), };\r
                         ISourceItem selectedFile = GetSourceItemFromBindingSource(actual);//bindingSource.Current as ISourceItem;\r
                         string id = selectedMetadata.ID;\r
-                        object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi };\r
+                        object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi, model };\r
                         ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters);\r
                         processors.Add(processor);\r
                     }\r
                     currentProcessors.Add(checkBox, processors);\r
                 } else\r
                     currentProcessors.Remove(checkBox);\r
-\r
                 btnExecute.Enabled = currentProcessors.Count > 0;\r
             };\r
 \r
@@ -106,11 +104,68 @@ namespace Maestro {
                 ChangeProcessButtonsState(false);\r
             }\r
 \r
-            ctxiModifyArchiveMetadata.Enabled = selectedMetadata != null;\r
-\r
             if (Configuration.Player != null)\r
                 ctxiDefineSegments.Enabled = SelectedSource?.FileInfo != null && Configuration.Player.SegmentEditor && MetadataType.Traffic.Equals(SelectedMetadata?.Kind);\r
             IsSelectedFileAnID();\r
+            EnableArchiveMetadataButtonAndCreateMetadataModel();\r
+        }\r
+\r
+        private void EnableArchiveMetadataButtonAndCreateMetadataModel() {\r
+            ctxiModifyArchiveMetadata.Enabled = selectedMetadata != null;\r
+            if (ctxiModifyArchiveMetadata.Enabled) {\r
+                model = new ArchiveMetadataModel();\r
+                Cursor.Current = Cursors.WaitCursor;\r
+                IDTypes idType = GetTypeOfSelectedMetadata();\r
+                if (idType == IDTypes.OctopusID)\r
+                    FillTheModelFromOctopus(model);\r
+                else if (idType == IDTypes.TrafficID)\r
+                    FillTheModelFromTraffic(model);\r
+            } else\r
+                model = null;\r
+        }\r
+\r
+        private void FillTheModelFromTraffic(ArchiveMetadataModel model) {\r
+            string id = selectedMetadata.ID;\r
+            TrafficAPI api = trafficIDSelector.trafficAPI;\r
+            List<ArchiveMatadataWrapper> result = api.SearchArchiveMetadata(id); ;\r
+            ArchiveMatadataWrapper actualResult = result[0];\r
+            model.StuffID = actualResult.ProgID;\r
+            model.StuffTitle = actualResult.ProgTitle;\r
+            model.StuffDescription = actualResult.ProgDescription;\r
+            model.MediaID = actualResult.EpisodeID;\r
+            model.MediaTitle = String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle;\r
+            model.MediaDescription = actualResult.EpisodeDescription;\r
+        }\r
+\r
+        private void FillTheModelFromOctopus(ArchiveMetadataModel model) {\r
+            string id = selectedMetadata.ID;\r
+            OctopusAPI api = octopusIDSelector.GetClient();\r
+            IEnumerable<Story> storyEnum = api.GetStoriesById(id);\r
+            if (storyEnum != null) \r
+                FillModelFromStories(model, storyEnum.ToList(), api);\r
+            else {\r
+                List<Story> stories = api.GetStoriesByPlaceHolderId(id).ToList();\r
+                FillModelFromStories(model, stories, api);\r
+            }\r
+        }\r
+\r
+        private void FillModelFromStories(ArchiveMetadataModel model, List<Story> stories, OctopusAPI api) {\r
+            Story story = stories[0];\r
+            if (story.StoryFolders != null) {\r
+                List<StoryFolder> storyFolders = api.GetStoryFoldersByStoryID(story.ID).ToList();\r
+                StoryFolder folder = storyFolders[0];\r
+                model.StuffID = folder.ID;\r
+                model.StuffTitle = folder.Name;\r
+            } else if (story.Rundowns != null) {\r
+                List<Rundown> rundowns = api.GetRundownsByStoryID(story.ID).ToList();\r
+                Rundown rundown = rundowns[0];\r
+                model.StuffID = rundown.ID;\r
+                model.StuffTitle = rundown.Name;\r
+                model.StuffDescription = rundown.Start;\r
+            }\r
+            model.MediaID = story.ID;\r
+            model.MediaTitle = story.Name;\r
+            model.MediaDescription = story.Script;\r
         }\r
 \r
         private void IsSelectedFileAnID() {\r
index 92227c8e171863747cef18aef59db71295ab1b77..676b4303bec3d821300cb623552f7034ebc5a24e 100644 (file)
@@ -14,5 +14,10 @@ namespace Maestro.Metadata {
         public string MediaID { get; set; }\r
         public string MediaTitle { get; set; }\r
         public string MediaDescription { get; set; }\r
+\r
+        public override string ToString() {\r
+            return String.Format("{{\n \"Anyag azonosító\": \"{0}\",\n, \"Anyag cím\": \"{1}\",\n \"Anyag leírása\": \"{2}\",\n \"Média azonosító\": \"{3}\",\n \"Média cím\": \"{4}\",\n \"Média leírás\": \"{5}\"  \n}}",\r
+                StuffID, StuffTitle, StuffDescription, MediaID, MediaTitle, MediaDescription);\r
+        }\r
     }\r
 }\r
index 127416c51b832d25313deece2673a7ff780c4ffe..36d46875b5d1b18b39d8b14f51af34a6e8d34dd4 100644 (file)
@@ -67,6 +67,7 @@
          "killDateDays": 1,\r
          "tag": "tag",\r
          "createSubFolder": true,\r
+         "useMetadata": true,\r
       "remote": {\r
         "address": "ftp://localhost:21/out",\r
         "userName": "dani",\r
index d7519f7c0e9df9c488bbfa7a251d6ef5f5a93cd0..b889828ee7e9eb4ceae71df1dfdec46de70f77a7 100644 (file)
@@ -87,6 +87,15 @@ namespace Maestro {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to Archive.\r
+        /// </summary>\r
+        internal static string ARCHIVE {\r
+            get {\r
+                return ResourceManager.GetString("ARCHIVE", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to Befejezés.\r
         /// </summary>\r
index 8b6ca6cca799fb61549f94267c38ad508f861210..4aa791b6062100d2390da353982ae987e0bbec75 100644 (file)
   <data name="ALLAPOT" xml:space="preserve">\r
     <value>Állapot</value>\r
   </data>\r
+  <data name="ARCHIVE" xml:space="preserve">\r
+    <value>Archive</value>\r
+  </data>\r
   <data name="ARCHÍV_METAADATOK_MODOSITASA" xml:space="preserve">\r
     <value>Archív metaadatok módosítása</value>\r
   </data>\r
index bebdde15c6599b46cd9cb947da822f23399e1174..e3d59b0f5df10172d6a33693d020d561fca32e4c 100644 (file)
@@ -9,6 +9,7 @@ using System.Collections.Generic;
 using TrafficClient;\r
 using Model;\r
 using JobEngineClient;\r
+using Maestro.Metadata;\r
 \r
 namespace Maestro.Targets {\r
 \r
@@ -29,12 +30,13 @@ namespace Maestro.Targets {
 \r
         public WorkflowAction workFlowAction { get; set; }\r
 \r
-        public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi) : base(parent, targetConfig, segments) {\r
+        public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel model)\r
+            : base(parent, targetConfig, segments, model) {\r
             FtpTrace.LogFunctions = false;\r
             this.mediaCubeApi = mediaCubeApi;\r
             this.targetConfig = targetConfig;\r
             Uri inputUri = new Uri(String.Format("{0}/{1}", sourceConfig.Local.Address.LocalPath, inputFileName));\r
-            inputFile = new FileInfo(inputUri.LocalPath); \r
+            inputFile = new FileInfo(inputUri.LocalPath);\r
             Input = inputFile.FullName;\r
             ID = id;\r
             workFlowAction = new WorkflowAction() { houseId = ID, tag = targetConfig.Tag, touched = DateTime.Now };\r
@@ -48,7 +50,7 @@ namespace Maestro.Targets {
             try {\r
                 SetSubFolder(targetConfig.Remote);\r
                 targetFTP = CreateClient(targetConfig.Remote);\r
-                EnsureDirectoryExistence(targetFTP);\r
+                EnsureDirectoryExistence(targetFTP, workingDir);\r
                 Status = ProcessStatus.Progress;\r
                 Output = CreateOutputFileName();\r
                 workFlowAction.destination = Path.Combine(workingDir, Output).Replace("\\", "/");\r
@@ -56,6 +58,8 @@ namespace Maestro.Targets {
                 UploadFile(Output);\r
                 if (targetConfig.KillDateDays > 0)\r
                     UploadKillDateFile(targetConfig.Remote, Output);\r
+                if (targetConfig.UseMetadata)\r
+                    UseMetadata();\r
                 ExecuteCompleted();\r
                 Status = ProcessStatus.Completed;\r
                 Message = SUCCESS;\r
@@ -77,11 +81,40 @@ namespace Maestro.Targets {
             return result;\r
         }\r
 \r
+        private void UseMetadata() {\r
+            if (model != null) {\r
+                string path = String.Format("{0}//.store", workingDir);\r
+                string fileName = "metadata.json";\r
+                EnsureDirectoryExistence(targetFTP, path);\r
+                string finalFileName = GetVersionedFileName(fileName);\r
+                using (Stream ostream = targetFTP.OpenWrite(finalFileName)) {\r
+                    string s = model.ToString();\r
+                    byte[] content = System.Text.Encoding.UTF8.GetBytes(s);\r
+                    ostream.Write(content, 0, content.Length);\r
+                }\r
+            }\r
+        }\r
+\r
+        private string GetVersionedFileName(string fileName) {\r
+            string result = fileName;\r
+            string nameWithoutExtension = String.Format(Path.GetFileNameWithoutExtension(fileName));\r
+            string extension = Path.GetExtension(fileName);\r
+            int version = 0;\r
+            while (targetFTP.FileExists(result)) {\r
+                string versioned = String.Format(VERSIONED_FILENAME, nameWithoutExtension, version, extension);\r
+                logger.Debug(ALREADY_EXISTS, result, versioned);\r
+                result = versioned;\r
+                version++;\r
+            }\r
+            return result;\r
+        }\r
+\r
         private void SendWorkFlowAction() {\r
             try {\r
                 mediaCubeApi.Create(workFlowAction);\r
-            } catch (Exception e) {\r
-                MessageBox.Show(parent , e.Message);\r
+            }\r
+            catch (Exception e) {\r
+                MessageBox.Show(parent, e.Message);\r
             }\r
         }\r
 \r
@@ -96,7 +129,7 @@ namespace Maestro.Targets {
         private void UploadKillDateFile(Connection connection, string output) {\r
             Uri address = connection.Address;\r
             string statusWorkDir = Path.Combine(address.PathAndQuery, STATUS_FOLDER).Replace("\\", "/");\r
-            EnsureDirectoryExistence(targetFTP);\r
+            EnsureDirectoryExistence(targetFTP, workingDir);\r
             DateTime date = DateTime.Now;\r
             date = date.AddDays(targetConfig.KillDateDays);\r
             string fileName = String.Format(KILLDATE_FILE, output, date.ToString("yyyyMMdd"));\r
@@ -142,10 +175,10 @@ namespace Maestro.Targets {
         }\r
 \r
 \r
-        private void EnsureDirectoryExistence(FtpClient client) {\r
-            if (!client.DirectoryExists(workingDir))\r
-                client.CreateDirectory(workingDir, true);\r
-            client.SetWorkingDirectory(workingDir);\r
+        private void EnsureDirectoryExistence(FtpClient client, string path) {\r
+            if (!client.DirectoryExists(path))\r
+                client.CreateDirectory(path, true);\r
+            client.SetWorkingDirectory(path);\r
         }\r
 \r
         protected FtpClient CreateClient(Connection connection) {\r
index 5d405dca9bbe58b628431b28220273cbe0058a11..abdb796b395eebdb399b0bbaf681cd82a0b2fe74 100644 (file)
@@ -9,6 +9,7 @@ using System.Windows.Forms;
 using System.Collections.Generic;\r
 using TrafficClient;\r
 using JobEngineClient;\r
+using Maestro.Metadata;\r
 \r
 namespace Maestro.Targets {\r
 \r
@@ -16,8 +17,8 @@ namespace Maestro.Targets {
         private Logger logger = LogManager.GetCurrentClassLogger();\r
         private Source sourceConfig;\r
 \r
-        public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi ) :\r
-            base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi) {\r
+        public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List<Segment> segments, MediaCubeApi mediaCubeApi, ArchiveMetadataModel model) :\r
+            base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi, model) {\r
             this.sourceConfig = sourceConfig;\r
         }\r
 \r
index 1488d3c1554d32a1eaffcad3a9713bad19b63810..18b935d0e827ceaff90c7d7d7d431697eee5b61c 100644 (file)
@@ -7,7 +7,7 @@ using System.Windows.Forms;
 using System.Collections.Generic;\r
 using Maestro.Configuration;\r
 using TrafficClient;\r
-using DxPlay;\r
+using Maestro.Metadata;\r
 \r
 namespace Maestro.Targets {\r
     public abstract class TargetProcessor : ITargetProcessor {\r
@@ -23,8 +23,11 @@ namespace Maestro.Targets {
         protected Target targetConfig;\r
         protected TrafficAPI client;\r
         protected List<Segment> segments;\r
-        public TargetProcessor(Control parent, Target targetConfig, List<Segment> segments) {\r
+        protected ArchiveMetadataModel model;\r
+\r
+        public TargetProcessor(Control parent, Target targetConfig, List<Segment> segments, ArchiveMetadataModel model) {\r
             this.parent = parent;\r
+            this.model = model;\r
             MaestroForm maestroForm = parent as MaestroForm;\r
             TrafficMetadata metadata = maestroForm.Configuration.Metadatas.Where(m => { return m is TrafficMetadata; }).FirstOrDefault() as TrafficMetadata;\r
             client = new TrafficAPI(metadata.Server.Address.OriginalString, metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout);\r
index 6cf734a17d6fb3aed9e7f259c31b5aa03d88e307..abda2f3f5718830e34117207dfb076c5eef183d5 100644 (file)
@@ -69,6 +69,15 @@ namespace OctopusClient {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to Archive.\r
+        /// </summary>\r
+        internal static string ARCHIVE {\r
+            get {\r
+                return ResourceManager.GetString("ARCHIVE", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to Global ID.\r
         /// </summary>\r
index 7fde695dee2160f23a252ca28a5cbd42f1d78043..3baa3ae925184a2cf8d6609ac1e1ed9d3d8abe69 100644 (file)
   <data name="ADASTUKOR" xml:space="preserve">\r
     <value>Adástükör</value>\r
   </data>\r
+  <data name="ARCHIVE" xml:space="preserve">\r
+    <value>Archive</value>\r
+  </data>\r
   <data name="GLOBAL_ID" xml:space="preserve">\r
     <value>Global ID</value>\r
   </data>\r
index 9b3c8441a382dc58537a4b37dd3e08f267451ef7..fdbcc86244b075a848c4c19be0db6d6eb2ff1f2c 100644 (file)
@@ -29,6 +29,7 @@
         private void InitializeComponent()\r
         {\r
             this.components = new System.ComponentModel.Container();\r
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
             this.trafficAPIBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
             this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();\r
             this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();\r
             this.dataGridView1.BackgroundColor = System.Drawing.Color.White;\r
             this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
             this.dataGridView1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;\r
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;\r
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;\r
+            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+            this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;\r
             this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
             this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;\r
             this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
             this.dataGridView1.Location = new System.Drawing.Point(0, 0);\r
             this.dataGridView1.MultiSelect = false;\r
             this.dataGridView1.Name = "dataGridView1";\r
+            this.dataGridView1.RowHeadersVisible = false;\r
             this.dataGridView1.Size = new System.Drawing.Size(263, 217);\r
             this.dataGridView1.TabIndex = 0;\r
             this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);\r
index 724f73abe85b0c9e630d6782e1b59d0240356696..9b8f48cfa86ef9ab602f383ad1f952c7b1ed64d1 100644 (file)
@@ -2,6 +2,8 @@
 using System;\r
 using System.Drawing;\r
 using System.ComponentModel;\r
+using System.Linq;\r
+using System.Collections.Generic;\r
 \r
 namespace TrafficClient {\r
     public delegate void OnSelectedIDChanged(string ID, int variantID);\r
@@ -38,7 +40,8 @@ namespace TrafficClient {
                     new DataGridViewTextBoxColumn() {\r
                             AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells,\r
                             DataPropertyName = "MediaID",\r
-                            HeaderText = Resources.TRAFFIC_ID\r
+                            HeaderText = Resources.TRAFFIC_ID,\r
+                            \r
                     },\r
                     new DataGridViewTextBoxColumn() {\r
                         AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells,\r
@@ -88,8 +91,12 @@ namespace TrafficClient {
                 dataGridView1.DataSource = null;\r
                 return;\r
             }\r
-            dataGridView1.DataSource = result;\r
-            //dataGridView1.Sort(dataGridView1.Columns[5], ListSortDirection.Ascending);\r
+            List<MamResultWrapper> list = new List<MamResultWrapper>();\r
+            foreach (MamResultWrapper actual in result) {\r
+                list.Add(actual);\r
+            }\r
+            list.Sort((x, y) => DateTime.Compare(x.NextBroadcastDate.Value, y.NextBroadcastDate.Value));\r
+            dataGridView1.DataSource = list;\r
         }\r
 \r
         private void textBox1_KeyDown(object sender, KeyEventArgs e) {\r
@@ -126,16 +133,13 @@ namespace TrafficClient {
                 return;\r
             //nincs multiselect\r
             DataGridViewCell checkBoxCell = gridView.SelectedCells[0];\r
+            bool selected = checkBoxCell.Value.Equals(false);\r
             clearCheckBox?.Invoke();\r
             ClearSelectionSource();\r
             //checkBoxCell.Value = checkBoxCell.Value.Equals(true) ? true : false;\r
             MamResultWrapper res = dataGridView1.Rows[e.RowIndex].DataBoundItem as MamResultWrapper;\r
-            if (checkBoxCell.Value.Equals(false))\r
-                res.Selected = true;\r
-            else\r
-                res.Selected = false;\r
-            if (checkBoxCell.Value.Equals(true)) {\r
-\r
+            res.Selected = selected;\r
+            if (selected) {\r
                 IDChangedEvent?.Invoke(res.MediaID, res.VariantID);\r
             } else\r
                 IDChangedEvent?.Invoke(string.Empty, 0);\r