From: Bellai Ádám Date: Mon, 16 Oct 2017 13:53:50 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=21347cc77ffbf058726d3a85534bb1eff191a514;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30627 --- diff --git a/client/Maestro/Configuration/ConfigurationInfo.cs b/client/Maestro/Configuration/ConfigurationInfo.cs index a46fb7a6..eab032f7 100644 --- a/client/Maestro/Configuration/ConfigurationInfo.cs +++ b/client/Maestro/Configuration/ConfigurationInfo.cs @@ -55,6 +55,7 @@ namespace Maestro.Configuration { public bool SendEmailOnSuccess { get; set; } public string SuccessEmailRecipient { get; set; } public string SuccessEmailPattern { get; set; } + public string Reference { get; set; } } public class Connection { diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index f17730f0..02cf026f 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -36,6 +36,10 @@ namespace Maestro { if (Configuration.Targets == null) return; foreach (Target target in Configuration.Targets) { + if (target.Reference != null && target.Label.Equals(target.Reference)) { + MessageBox.Show(Parent, String.Format(StringResources.HIBAS_TARGET_REFERENCE_CONFIG, target.Label)); + Dispose(); + } CreateTarget(target); } @@ -49,13 +53,14 @@ namespace Maestro { Appearance = Appearance.Normal, Text = target.Label, UseVisualStyleBackColor = true, - Dock = DockStyle.Top + Dock = DockStyle.Top, + Tag = target }; checkBox.CheckStateChanged += (s, e) => { OnChecked(checkBox, target); }; - panelActions.Controls.Add(checkBox); + panelActions.Controls.Add(checkBox); panelActions.RowCount = panelActions.Controls.Count; } @@ -67,17 +72,19 @@ namespace Maestro { if (checkBox.Checked) { List processors = new List(); foreach (DataGridViewRow actualRow in selectedRows) { + string fileName = actualRow.Cells[1].Value as string; string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor); Type type = Type.GetType(typeName); ISourceItem selectedFile = GetSourceItemFromBindingSource(fileName); string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID; - if (target.SaveSegments && segments == null) { - segments = trafficIDSelector.trafficAPI.GetSegments(selectedMetadata.VariantID); - if (segments == null) { - //todo error report küldés? - } - + if (segments == null) { + if (target.SaveSegments) { + segments = trafficIDSelector.trafficAPI.GetSegments(selectedMetadata.VariantID); + if (segments == null) { + //todo error report küldés? + } + } else segments = new List(); } TargetProcessorParameter processorParameter = new TargetProcessorParameter() { ArchiveMetadata = ArchiveMetadata.DeepClone(archiveMetadatamodel), @@ -93,19 +100,46 @@ namespace Maestro { object[] parameters = new object[] { this, processorParameter }; ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters); processors.Add(processor); + if (!String.IsNullOrEmpty(target.Reference)) + SetCheckBoxReferences(target.Reference, true); } currentProcessors.Add(checkBox, processors); - } else + } else { + SetCheckBoxReferences(target.Reference, false); currentProcessors.Remove(checkBox); + } btnExecute.Enabled = currentProcessors.Count > 0; } + private bool IsOffCheckAble(String text) { + List checkBoxes = new List(currentProcessors.Keys); + foreach (CheckBox actual in checkBoxes) { + Target target = actual.Tag as Target; + if (text.Equals(target.Reference)) + return false; + } + return true; + } + + private void SetCheckBoxReferences(string reference, bool check) { + var controlls = panelActions.Controls; + foreach (Control actual in controlls) { + CheckBox actualCheckbox = actual as CheckBox; + if (actualCheckbox != null && actualCheckbox.Text.Equals(reference)) { + if (check) + actualCheckbox.Checked = check; + else + currentProcessors.Remove(actualCheckbox); + actualCheckbox.Enabled = !check; + } + } + } + private ISourceItem GetSourceItemFromBindingSource(string actual) { ISourceItem result = null; - foreach (ISourceItem actualSource in bindingSource) { + foreach (ISourceItem actualSource in bindingSource) if (actualSource.Name.Equals(actual)) result = actualSource; - } return result; } @@ -125,7 +159,7 @@ namespace Maestro { else { String calculatedHouseID = selectedRows[0].Cells[1].Value as String; foreach (DataGridViewRow actual in selectedRows) { - string actualName = actual.Cells[1].Value as string; + string actualName = actual.Cells[2].Value as string; if (!actualName.StartsWith(startingName)) buttonMetadata.Enabled = false; } @@ -245,11 +279,7 @@ namespace Maestro { match = Regex.Match(startingName, pattern); IDType = match.Success ? IDTypes.OctopusID : IDTypes.None; } - buttonMetadata.Enabled = IDType != IDTypes.None;// ? false : true; - //if (IDType == IDTypes.None) - // buttonMetadata.Enabled = false; - //else - // buttonMetadata.Enabled = true; + buttonMetadata.Enabled = IDType != IDTypes.None; } public void OnTargetPanelsMouseClick(object sender, MouseEventArgs e) { diff --git a/client/Maestro/Sources/NexioRESTSource.cs b/client/Maestro/Sources/NexioRESTSource.cs index a9c3ce87..3e98734d 100644 --- a/client/Maestro/Sources/NexioRESTSource.cs +++ b/client/Maestro/Sources/NexioRESTSource.cs @@ -167,15 +167,31 @@ namespace Maestro.Sources { private void OnChanged(JToken token) { string id = token[ID].ToString(); var item = Items.Where(x => x.ID == id).SingleOrDefault(); - if (item == null || !item.CanHandle(acceptableAgencies)) - return; + if (item == null) { + var newItem = CreateItem(token, true); + item = newItem; + } SetItem(ref item, token); + if (!item.CanHandle(acceptableAgencies)) { + if (Contains(item)) { + parent.SafeCall(() => { + Remove(item); + cache.Remove(item); + }); + } + return; + } parent.SafeCall(() => { messageBus.Send(new ModifyFileActionMsg() { FileName = item.Name, Source = parent }); }); + if (!Contains(item)) + parent.SafeCall(() => { + Add(item); + cache.Add(item); + }); Debug.WriteLine(string.Format("Changed {0}", item.Name)); } diff --git a/client/Maestro/StringResources.Designer.cs b/client/Maestro/StringResources.Designer.cs index 4bfe1385..c482b46d 100644 --- a/client/Maestro/StringResources.Designer.cs +++ b/client/Maestro/StringResources.Designer.cs @@ -177,6 +177,15 @@ namespace Maestro { } } + /// + /// Looks up a localized string similar to Hibás reference configuráció a(z) {0} targetba. + /// + internal static string HIBAS_TARGET_REFERENCE_CONFIG { + get { + return ResourceManager.GetString("HIBAS_TARGET_REFERENCE_CONFIG", resourceCulture); + } + } + /// /// Looks up a localized string similar to Idő. /// diff --git a/client/Maestro/StringResources.resx b/client/Maestro/StringResources.resx index 6ba10450..d7a78709 100644 --- a/client/Maestro/StringResources.resx +++ b/client/Maestro/StringResources.resx @@ -156,6 +156,9 @@ Forrás fájl + + Hibás reference configuráció a(z) {0} targetba + Idő