private void btn_copy_Click(object sender, EventArgs e) { List <PlcSoftware> plcs = new List <PlcSoftware>(); foreach (TreeNode node in new TreeNodeDepthFirstEnumerator(toTreeView.Nodes)) { PlcSoftware sw = node.Tag as PlcSoftware; if (node.Checked && sw != null) { plcs.Add(sw); } } TaskDialog tasks = new TaskDialog(); List <PlcType> plc_types = new List <PlcType>(); List <PlcBlock> plc_blocks = new List <PlcBlock>(); List <Siemens.Engineering.Hmi.Screen.Screen> screens = new List <Siemens.Engineering.Hmi.Screen.Screen> (); List <TagTable> tag_tables = new List <TagTable>(); foreach (TreeNode node in new TreeNodeDepthFirstEnumerator(fromTreeView.Nodes)) { if (node.Checked) { PlcBlock block = node.Tag as PlcBlock; if (block != null) { plc_blocks.Add(block); } PlcType type = node.Tag as PlcType; if (type != null) { plc_types.Add(type); } Siemens.Engineering.Hmi.Screen.Screen screen = node.Tag as Siemens.Engineering.Hmi.Screen.Screen; if (screen != null) { screens.Add(screen); } TagTable tag_table = node.Tag as TagTable; if (tag_table != null) { tag_tables.Add(tag_table); } } } foreach (PlcBlock block in plc_blocks) { foreach (PlcSoftware plc in plcs) { tasks.AddTask(new CopyPlcBlockTask(portal, block, plc, check_overwrite.Checked)); } } foreach (PlcType type in plc_types) { foreach (PlcSoftware plc in plcs) { tasks.AddTask(new CopyPlcTypeTask(portal, type, plc, check_overwrite.Checked)); } } tasks.ShowDialog(this); }
internal TIAOpennessProjectDataTypeInfo(PlcType plcType) { this.plcType = plcType; }
// PLC types private static void HandleType(NodeHandler handler, PlcType type) { handler.Enter(type, type.Name); handler.Exit(type); }