private void TreeView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (myTreeView.SelectedItem != null) { if (myTreeView.SelectedItem is IBlocksFolder) { IBlocksFolder fld = (IBlocksFolder)myTreeView.SelectedItem; DockableContentBlockList tmp = new DockableContentBlockList(fld); tmp.parentDockingManager = parentDockingManager; tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); if (myTreeView.SelectedItem is BlocksOfflineFolder) { tmp.ToolTip = ((BlocksOfflineFolder)myTreeView.SelectedItem).Folder; } else { tmp.ToolTip = fld.ToString(); } tmp.Show(parentDockingManager); tmp.ToggleAutoHide(); //Set size of the parent DockablePane (it's automaticly been created!) DockablePane tmpPane = tmp.TryFindParent <DockablePane>(); ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0)); parentDockingManager.ActiveDocument = tmp; } else if (myTreeView.SelectedItem is ISymbolTable) { ISymbolTable fld = (ISymbolTable)myTreeView.SelectedItem; ContentWindowSymbolTable tmp = new ContentWindowSymbolTable(fld); tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); tmp.ToolTip = fld.ToString(); tmp.Show(parentDockingManager); parentDockingManager.ActiveDocument = tmp; } else if (myTreeView.SelectedItem is ReferenceData) { ReferenceData fld = (ReferenceData)myTreeView.SelectedItem; ContentWindowReferenceData tmp = new ContentWindowReferenceData(fld); tmp.parentDockingManager = parentDockingManager; tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); tmp.ToolTip = fld.ToString(); tmp.Show(parentDockingManager); parentDockingManager.ActiveDocument = tmp; } else if (myTreeView.SelectedItem is S7VATBlock) { S7VATBlock fld = (S7VATBlock)myTreeView.SelectedItem; ContentWindowVarTab tmp = new ContentWindowVarTab(fld); tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); tmp.ToolTip = fld.ToString(); tmp.Show(parentDockingManager); parentDockingManager.ActiveDocument = tmp; } } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { lstProjectFolder.Items.Clear(); if (treeStep7Project.SelectedNode is myTreeNode) { var tmp = (myTreeNode)treeStep7Project.SelectedNode; if (tmp.myObject is IBlocksFolder) { IBlocksFolder blkFld = (IBlocksFolder)tmp.myObject; if ((int)SelectPart > 1000) { List <ProjectBlockInfo> blocks = blkFld.readPlcBlocksList(); foreach (ProjectBlockInfo step7ProjectBlockInfo in blocks) { if (step7ProjectBlockInfo.BlockType == PLCBlockType.VAT && SelectPart == SelectPartType.VariableTable) { lstProjectFolder.Items.Add(step7ProjectBlockInfo); } if (step7ProjectBlockInfo.BlockType == PLCBlockType.DB && (SelectPart == SelectPartType.DataBlock || SelectPart == SelectPartType.DataBlocks || SelectPart == SelectPartType.IDataBlock || SelectPart == SelectPartType.IDataBlocks)) { lstProjectFolder.Items.Add(step7ProjectBlockInfo); } if (step7ProjectBlockInfo.BlockType == PLCBlockType.UDT && SelectPart == SelectPartType.DataType) { lstProjectFolder.Items.Add(step7ProjectBlockInfo); } if ((step7ProjectBlockInfo.BlockType == PLCBlockType.FB || step7ProjectBlockInfo.BlockType == PLCBlockType.FC) && SelectPart == SelectPartType.FunctionBlock) { lstProjectFolder.Items.Add(step7ProjectBlockInfo); } } } } } else if (treeStep7Project.SelectedNode is DBValueTreeNode) { //Maybe a DBTreeNode is not yet Expanded, then it need to be filled after select! if (treeStep7Project.SelectedNode is DBTreeNode) { AddDBValueNodes((DBTreeNode)treeStep7Project.SelectedNode); } DBValueTreeNode tmp = (DBValueTreeNode)treeStep7Project.SelectedNode; foreach (S7DataRow s7DataRow in tmp.s7datarow.Children) { if (s7DataRow.DataType != S7DataRowType.STRUCT && s7DataRow.DataType != S7DataRowType.UDT) { lstProjectFolder.Items.Add(new DBRowValue() { myRow = s7DataRow }); } } } }
private void mnuOnlineBlocks_Click(object sender, RoutedEventArgs e) { OnlineBlocksFolder onl = new OnlineBlocksFolder(Connection); IBlocksFolder fld = (IBlocksFolder)onl; DockableContentBlockList tmp = new DockableContentBlockList(fld); tmp.parentDockingManager = DockManager; tmp.Title = fld.ToString(); tmp.ToolTip = fld.ToString(); tmp.Show(DockManager); tmp.ToggleAutoHide(); //Set size of the parent DockablePane (it's automaticly been created!) DockablePane tmpPane = tmp.TryFindParent <DockablePane>(); ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0)); DockManager.ActiveDocument = tmp; }
private void myConnectionsList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (myConnectionsList.SelectedItem != null) { OnlineBlocksFolder onl = new OnlineBlocksFolder((string)myConnectionsList.SelectedItem); IBlocksFolder fld = (IBlocksFolder)onl; DockableContentBlockList tmp = new DockableContentBlockList(fld); tmp.parentDockingManager = parentDockingManager; tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1); tmp.ToolTip = fld.ToString(); tmp.Show(parentDockingManager); tmp.ToggleAutoHide(); //Set size of the parent DockablePane (it's automaticly been created!) DockablePane tmpPane = tmp.TryFindParent <DockablePane>(); ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0)); parentDockingManager.ActiveDocument = tmp; } }
public DockableContentBlockList(IBlocksFolder fld) { InitializeComponent(); myFld = fld; this.DataContext = this; try { var tmp = fld.readPlcBlocksList(); tmp.Sort(new NumericComparer <ProjectBlockInfo>()); var groupedItems = new ListCollectionView(tmp); groupedItems.GroupDescriptions.Add(new PropertyGroupDescription("BlockTypeString")); this.myDataGrid.ItemsSource = groupedItems; } catch (Exception ex) { //parentDockingManager. App.clientForm.lblStatus.Text = ex.Message; } }
public DockableContentBlockList(IBlocksFolder fld) { InitializeComponent(); myFld = fld; this.DataContext = this; try { var tmp = fld.readPlcBlocksList(); tmp.Sort(new NumericComparer<ProjectBlockInfo>()); var groupedItems = new ListCollectionView(tmp); groupedItems.GroupDescriptions.Add(new PropertyGroupDescription("BlockTypeString")); this.myDataGrid.ItemsSource = groupedItems; } catch (Exception ex) { //parentDockingManager. App.clientForm.lblStatus.Text = ex.Message; } }
public virtual Block GetBlock() { IBlocksFolder blkFld = (IBlocksFolder)ParentFolder; return(blkFld.GetBlock(this)); }
private void AddNodes(TreeNode nd, List <ProjectFolder> lst) { foreach (var subitem in lst) { myTreeNode tmpNode = new myTreeNode(); tmpNode.Text = subitem.Name; tmpNode.myObject = subitem; tmpNode.ImageIndex = 0; //nd.ImageKey //Set the Image for the Folders... if (subitem.GetType() == typeof(StationConfigurationFolder)) { if (((StationConfigurationFolder)subitem).StationType == PLCType.Simatic300) { tmpNode.ImageIndex = 4; } else if (((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400 || ((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400H) { tmpNode.ImageIndex = 5; } } else if (subitem.GetType() == typeof(CPUFolder)) { if (((CPUFolder)subitem).CpuType == PLCType.Simatic300) { tmpNode.ImageIndex = 2; } else if (((CPUFolder)subitem).CpuType == PLCType.Simatic400 || ((CPUFolder)subitem).CpuType == PLCType.Simatic400H) { tmpNode.ImageIndex = 3; } } nd.Nodes.Add(tmpNode); if (subitem.SubItems != null) { AddNodes(tmpNode, subitem.SubItems); } if (subitem is IBlocksFolder && this.SelectPart == SelectPartType.Tag) { IBlocksFolder blkFld = (IBlocksFolder)subitem; foreach (ProjectPlcBlockInfo projectBlockInfo in blkFld.readPlcBlocksList()) { if (projectBlockInfo.BlockType == PLCBlockType.DB || projectBlockInfo.BlockType == PLCBlockType.S5_DB || projectBlockInfo.BlockType == PLCBlockType.S5_DX) { string nm = projectBlockInfo.BlockName; if (projectBlockInfo.SymbolTabelEntry != null) { nm += " (" + projectBlockInfo.SymbolTabelEntry.Symbol + ")"; } DBTreeNode trnd = new DBTreeNode() { Text = nm, PLCBlockInfo = projectBlockInfo }; trnd.Nodes.Add(new FakeNode()); tmpNode.Nodes.Add(trnd); } } } } }
public ContentWindowChart(IBlocksFolder fld) { InitializeComponent(); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (myConn != null) myConn.Disconnect(); viewBlockList.Visible = false; dtaSymbolTable.Visible = false; hexBox.Visible = false; txtTextBox.Visible = false; lblToolStripFileSystemFolder.Text = ""; lblStatus.Text = ""; tableLayoutPanelVisu.ColumnStyles[1].Width = 0; datablockView.Visible = false; dtaPnPbList.Visible = false; lblToolStripFileSystemFolder.Text = ""; blkFld = null; if (treeStep7Project.SelectedNode != null) { ProjectFolder fld = (ProjectFolder) ((myTreeNode) treeStep7Project.SelectedNode).myObject; lblProjectName.Text = fld.Project.ProjectName; lblProjectInfo.Text = fld.Project.ProjectDescription; var tmp = (myTreeNode) treeStep7Project.SelectedNode; if (tmp.myObject is IBlocksFolder) blkFld = (IBlocksFolder) tmp.myObject; if (tmp.myObject is ISymbolTable) { var tmp2 = (ISymbolTable) tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { dtaSymbolTable.Rows.Clear(); foreach (var step7SymbolTableEntry in tmp2.SymbolTableEntrys) { //var tiaRow = step7SymbolTableEntry as TIASymbolTableEntry; //if (tiaRow != null) //{ // dtaSymbolTable.Rows.Add(new object[] // { // step7SymbolTableEntry.Symbol, step7SymbolTableEntry.DataType, // step7SymbolTableEntry.Operand, step7SymbolTableEntry.OperandIEC, // step7SymbolTableEntry.Comment, tiaRow.TIATagAccessKey // }); //} //else { dtaSymbolTable.Rows.Add(new object[] { step7SymbolTableEntry.Symbol, step7SymbolTableEntry.DataType, step7SymbolTableEntry.Operand, step7SymbolTableEntry.OperandIEC, step7SymbolTableEntry.Comment }); } } } dtaSymbolTable.Visible = true; lblToolStripFileSystemFolder.Text = tmp2.Folder; } else if (tmp.myObject is MasterSystem) { var tmp2 = (MasterSystem) tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { dtaPnPbList.Rows.Clear(); foreach (var s in tmp2.Children) { dtaPnPbList.Rows.Add(new object[] {s.NodeId, s.Name,}); } } dtaPnPbList.Visible = true; } else if (blkFld != null) { if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); //ProjectBlockInfo[] arr = //NumericComparer nc = new NumericComparer(); //Array.Sort(arr, nc); lstListBox.Items.AddRange(blkFld.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; if (tmp.myObject.GetType() == typeof (BlocksOfflineFolder)) lblToolStripFileSystemFolder.Text = ((BlocksOfflineFolder) blkFld).Folder; } //else if (tmp.myObject is TIAProjectFolder) //{ // var afld = tmp.myObject as TIAProjectFolder; // if (oldNode != treeStep7Project.SelectedNode) // { // lstListBox.Items.Clear(); // //lstListBox.Items.Add("ID: " + afld.ID); // //lstListBox.Items.Add("InstID: " + afld.InstID); // } // viewBlockList.Visible = true; //} else if (tmp.myObject.GetType() == typeof (SourceFolder)) { src = (SourceFolder) tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.AddRange(src.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; lblToolStripFileSystemFolder.Text = src.Folder; } else if (tmp.myObject is CPUFolder) { var cpu = tmp.myObject as CPUFolder; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.Add("Password: "******"CpuType: " + cpu.CpuType); if (cpu.NetworkInterfaces != null) { foreach (var networkInterface in cpu.NetworkInterfaces) { lstListBox.Items.Add("Network-Interface: " + networkInterface.ToString()); } } } viewBlockList.Visible = true; } else if (tmp.myObject is CPFolder) { var cp = tmp.myObject as CPFolder; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); var rd = new StringReader(cp.ToString()); string line = null; while ((line = rd.ReadLine()) != null) { lstListBox.Items.Add(line); } } viewBlockList.Visible = true; } } oldNode = treeStep7Project.SelectedNode; }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (myConn != null) myConn.Disconnect(); viewBlockList.Visible = false; dtaSymbolTable.Visible = false; hexBox.Visible = false; txtTextBox.Visible = false; lblToolStripFileSystemFolder.Text = ""; lblStatus.Text = ""; tableLayoutPanelVisu.ColumnStyles[1].Width = 0; datablockView.Visible = false; lblToolStripFileSystemFolder.Text = ""; blkFld = null; if (treeStep7Project.SelectedNode != null) { ProjectFolder fld = (ProjectFolder)((myTreeNode)treeStep7Project.SelectedNode).myObject; lblProjectName.Text = fld.Project.ProjectName; lblProjectInfo.Text = fld.Project.ProjectDescription; var tmp = (myTreeNode)treeStep7Project.SelectedNode; if (tmp.myObject is IBlocksFolder) blkFld = (IBlocksFolder)tmp.myObject; if (tmp.myObject is ISymbolTable) { var tmp2 = (ISymbolTable)tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { dtaSymbolTable.Rows.Clear(); foreach (var step7SymbolTableEntry in tmp2.SymbolTableEntrys) { dtaSymbolTable.Rows.Add(new object[] { step7SymbolTableEntry.Symbol, step7SymbolTableEntry.DataType, step7SymbolTableEntry.Operand, step7SymbolTableEntry.OperandIEC, step7SymbolTableEntry.Comment }); } } dtaSymbolTable.Visible = true; lblToolStripFileSystemFolder.Text = tmp2.Folder; } else if (blkFld != null) { if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); //ProjectBlockInfo[] arr = //NumericComparer nc = new NumericComparer(); //Array.Sort(arr, nc); lstListBox.Items.AddRange(blkFld.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; if (tmp.myObject.GetType() == typeof(BlocksOfflineFolder)) lblToolStripFileSystemFolder.Text = ((BlocksOfflineFolder)blkFld).Folder; } else if (tmp.myObject is TIAProjectFolder) { var afld = tmp.myObject as TIAProjectFolder; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); //lstListBox.Items.Add("ID: " + afld.ID); //lstListBox.Items.Add("InstID: " + afld.InstID); } viewBlockList.Visible = true; } else if (tmp.myObject.GetType() == typeof(SourceFolder)) { src = (SourceFolder)tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.AddRange(src.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; lblToolStripFileSystemFolder.Text = src.Folder; } else if (tmp.myObject is CPUFolder) { var cpu = tmp.myObject as CPUFolder; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.Add("Password: "******"CpuType: " + cpu.CpuType); } viewBlockList.Visible = true; } } oldNode = treeStep7Project.SelectedNode; }
public ContentWindowChart(IBlocksFolder fld) { InitializeComponent(); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (myConn != null) { myConn.Disconnect(); } viewBlockList.Visible = false; dtaSymbolTable.Visible = false; hexBox.Visible = false; txtTextBox.Visible = false; lblToolStripFileSystemFolder.Text = ""; lblStatus.Text = ""; tableLayoutPanelVisu.ColumnStyles[1].Width = 0; datablockView.Visible = false; lblToolStripFileSystemFolder.Text = ""; blkFld = null; if (treeStep7Project.SelectedNode != null) { ProjectFolder fld = (ProjectFolder)((myTreeNode)treeStep7Project.SelectedNode).myObject; lblProjectName.Text = fld.Project.ProjectName; lblProjectInfo.Text = fld.Project.ProjectDescription; var tmp = (myTreeNode)treeStep7Project.SelectedNode; if (tmp.myObject is IBlocksFolder) { blkFld = (IBlocksFolder)tmp.myObject; } if (tmp.myObject.GetType() == typeof(SymbolTable)) { var tmp2 = (SymbolTable)tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { dtaSymbolTable.Rows.Clear(); foreach (var step7SymbolTableEntry in tmp2.SymbolTableEntrys) { dtaSymbolTable.Rows.Add(new object[] { step7SymbolTableEntry.Symbol, step7SymbolTableEntry.DataType, step7SymbolTableEntry.Operand, step7SymbolTableEntry.Comment }); } } dtaSymbolTable.Visible = true; lblToolStripFileSystemFolder.Text = tmp2.Folder; } else if (blkFld != null) { if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); //ProjectBlockInfo[] arr = //NumericComparer nc = new NumericComparer(); //Array.Sort(arr, nc); lstListBox.Items.AddRange(blkFld.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; if (tmp.myObject.GetType() == typeof(BlocksOfflineFolder)) { lblToolStripFileSystemFolder.Text = ((BlocksOfflineFolder)blkFld).Folder; } } else if (tmp.myObject.GetType() == typeof(SourceFolder)) { src = (SourceFolder)tmp.myObject; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.AddRange(src.readPlcBlocksList().ToArray()); } viewBlockList.Visible = true; lblToolStripFileSystemFolder.Text = src.Folder; } else if (tmp.myObject is CPUFolder) { var cpu = tmp.myObject as CPUFolder; if (oldNode != treeStep7Project.SelectedNode) { lstListBox.Items.Clear(); lstListBox.Items.Add("Password: "******"CpuType: " + cpu.CpuType); } viewBlockList.Visible = true; } } oldNode = treeStep7Project.SelectedNode; }