if (Configuration.Targets == null)\r
return;\r
foreach (Target target in Configuration.Targets) {\r
+ if (target.Reference != null && target.Label.Equals(target.Reference)) {\r
+ MessageBox.Show(Parent, String.Format(StringResources.HIBAS_TARGET_REFERENCE_CONFIG, target.Label));\r
+ Dispose();\r
+ }\r
CreateTarget(target);\r
}\r
\r
Appearance = Appearance.Normal,\r
Text = target.Label,\r
UseVisualStyleBackColor = true,\r
- Dock = DockStyle.Top\r
+ Dock = DockStyle.Top,\r
+ Tag = target\r
};\r
checkBox.CheckStateChanged += (s, e) => {\r
OnChecked(checkBox, target);\r
};\r
\r
- panelActions.Controls.Add(checkBox);\r
+ panelActions.Controls.Add(checkBox);\r
panelActions.RowCount = panelActions.Controls.Count;\r
\r
}\r
if (checkBox.Checked) {\r
List<ITargetProcessor> processors = new List<ITargetProcessor>();\r
foreach (DataGridViewRow actualRow in selectedRows) {\r
+\r
string fileName = actualRow.Cells[1].Value as string;\r
string typeName = string.Format("{0}.{1}", typeof(ITargetProcessor).Namespace, target.Processor);\r
Type type = Type.GetType(typeName);\r
ISourceItem selectedFile = GetSourceItemFromBindingSource(fileName);\r
string id = selectedMetadata == null ? textSelectedMetadata.Text : selectedMetadata.ID;\r
- if (target.SaveSegments && segments == null) {\r
- segments = trafficIDSelector.trafficAPI.GetSegments(selectedMetadata.VariantID);\r
- if (segments == null) {\r
- //todo error report küldés?\r
- }\r
-\r
+ if (segments == null) {\r
+ if (target.SaveSegments) {\r
+ segments = trafficIDSelector.trafficAPI.GetSegments(selectedMetadata.VariantID);\r
+ if (segments == null) {\r
+ //todo error report küldés?\r
+ }\r
+ } else segments = new List<Segment>();\r
}\r
TargetProcessorParameter processorParameter = new TargetProcessorParameter() {\r
ArchiveMetadata = ArchiveMetadata.DeepClone(archiveMetadatamodel),\r
object[] parameters = new object[] { this, processorParameter };\r
ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters);\r
processors.Add(processor);\r
+ if (!String.IsNullOrEmpty(target.Reference))\r
+ SetCheckBoxReferences(target.Reference, true);\r
}\r
currentProcessors.Add(checkBox, processors);\r
- } else\r
+ } else {\r
+ SetCheckBoxReferences(target.Reference, false);\r
currentProcessors.Remove(checkBox);\r
+ }\r
btnExecute.Enabled = currentProcessors.Count > 0;\r
}\r
\r
+ private bool IsOffCheckAble(String text) {\r
+ List<CheckBox> checkBoxes = new List<CheckBox>(currentProcessors.Keys);\r
+ foreach (CheckBox actual in checkBoxes) {\r
+ Target target = actual.Tag as Target;\r
+ if (text.Equals(target.Reference))\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ private void SetCheckBoxReferences(string reference, bool check) {\r
+ var controlls = panelActions.Controls;\r
+ foreach (Control actual in controlls) {\r
+ CheckBox actualCheckbox = actual as CheckBox;\r
+ if (actualCheckbox != null && actualCheckbox.Text.Equals(reference)) {\r
+ if (check)\r
+ actualCheckbox.Checked = check;\r
+ else\r
+ currentProcessors.Remove(actualCheckbox);\r
+ actualCheckbox.Enabled = !check;\r
+ }\r
+ }\r
+ }\r
+\r
private ISourceItem GetSourceItemFromBindingSource(string actual) {\r
ISourceItem result = null;\r
- foreach (ISourceItem actualSource in bindingSource) {\r
+ foreach (ISourceItem actualSource in bindingSource) \r
if (actualSource.Name.Equals(actual))\r
result = actualSource;\r
- }\r
return result;\r
}\r
\r
else {\r
String calculatedHouseID = selectedRows[0].Cells[1].Value as String;\r
foreach (DataGridViewRow actual in selectedRows) {\r
- string actualName = actual.Cells[1].Value as string;\r
+ string actualName = actual.Cells[2].Value as string;\r
if (!actualName.StartsWith(startingName))\r
buttonMetadata.Enabled = false;\r
}\r
match = Regex.Match(startingName, pattern);\r
IDType = match.Success ? IDTypes.OctopusID : IDTypes.None;\r
}\r
- buttonMetadata.Enabled = IDType != IDTypes.None;// ? false : true;\r
- //if (IDType == IDTypes.None)\r
- // buttonMetadata.Enabled = false;\r
- //else\r
- // buttonMetadata.Enabled = true;\r
+ buttonMetadata.Enabled = IDType != IDTypes.None;\r
}\r
\r
public void OnTargetPanelsMouseClick(object sender, MouseEventArgs e) {\r