private void ButtonNewItem_Click(object sender, EventArgs e) { TreeNodePlateName treeNodePlateName = new TreeNodePlateName(); do { treeNodePlateName.PlateName = string.Format("新建的板块{0}", m_PlateCount++); bool isOK = true; foreach (var item in m_PlateName) { if (item.Value.PlateName == treeNodePlateName.PlateName) { isOK = false; break; } } if (isOK == true) { break; } } while (true); TreeNode newTreeNodePlate = new TreeNode(treeNodePlateName.PlateName); TreeNode newTreeNodeAll = new TreeNode("所有的股票"); // m_PlateName.Add(newTreeNodePlate, treeNodePlateName); newTreeNodePlate.Nodes.Add(newTreeNodeAll); ConfigBControl configBControl = new ConfigBControl(); configBControl.Visible = false; configBControl.Dock = DockStyle.Fill; this.m_AllConfigControlInfo.Add(newTreeNodePlate, configBControl); this.m_AllConfigControlInfo.Add(newTreeNodeAll, configBControl); this.TreeView.Nodes.Add(newTreeNodePlate); this.Panel.Controls.Add(configBControl); this.TreeView.SelectedNode = newTreeNodeAll; this.ButtonSave.Enabled = true; }
private void LoadConfigFormInfo() { if (m_IsInitializing == false) { ConfigForm_Load(this, EventArgs.Empty); } this.TreeView.Nodes.Clear(); this.Panel.Controls.Clear(); PlateInfo[] plateInfos = GlobalSetting.PlateInfos; for (int iIndex = 0; iIndex < plateInfos.Length; iIndex++) { PlateInfo plateInfo = plateInfos[iIndex]; TreeNode newTreeNodeParent = new TreeNode(plateInfo.Name); // TreeNodePlateName treeNodePlateName = new TreeNodePlateName(); treeNodePlateName.PlateName = plateInfo.Name; TreeNode newTreeNodeAll = new TreeNode("所有的股票"); newTreeNodeParent.Nodes.Add(newTreeNodeAll); ConfigBControl configBControlAll = new ConfigBControl(); configBControlAll.Visible = false; configBControlAll.Dock = DockStyle.Fill; this.m_AllConfigControlInfo.Add(newTreeNodeParent, configBControlAll); this.m_AllConfigControlInfo.Add(newTreeNodeAll, configBControlAll); for (int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++) { VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2]; TreeNode newTreeNodeSub = new TreeNode(varietyInfo.Name); newTreeNodeParent.Nodes.Add(newTreeNodeSub); // treeNodePlateName.VarietyName.Add(newTreeNodeSub, varietyInfo.Name); ConfigAControl configAControlSub = new ConfigAControl(); configAControlSub.Visible = false; configAControlSub.Dock = DockStyle.Fill; configAControlSub.ButtonSaveChanged += new EventHandler(ConfigAControl_ButtonSaveChanged); this.m_AllConfigControlInfo.Add(newTreeNodeSub, configAControlSub); for (int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++) { FileInfo fileInfo = varietyInfo.FileInfos[iIndex3]; ListViewItem listViewItemSub = new ListViewItem(fileInfo.StockName); ListViewItem.ListViewSubItem listViewSubItemSub1 = new ListViewItem.ListViewSubItem(listViewItemSub, fileInfo.StockSymbol); ListViewItem.ListViewSubItem listViewSubItemSub2 = new ListViewItem.ListViewSubItem(listViewItemSub, fileInfo.FilePath); listViewItemSub.SubItems.Add(listViewSubItemSub1); listViewItemSub.SubItems.Add(listViewSubItemSub2); configAControlSub.ListView.Items.Add(listViewItemSub); ListViewItem listViewItemAll = new ListViewItem(fileInfo.StockName); ListViewItem.ListViewSubItem listViewSubItemAll1 = new ListViewItem.ListViewSubItem(listViewItemAll, fileInfo.StockSymbol); ListViewItem.ListViewSubItem listViewSubItemAll2 = new ListViewItem.ListViewSubItem(listViewItemAll, fileInfo.FilePath); listViewItemAll.SubItems.Add(listViewSubItemAll1); listViewItemAll.SubItems.Add(listViewSubItemAll2); configBControlAll.ListView.Items.Add(listViewItemAll); } this.Panel.Controls.Add(configAControlSub); } this.TreeView.Nodes.Add(newTreeNodeParent); this.Panel.Controls.Add(configBControlAll); m_PlateName.Add(newTreeNodeParent, treeNodePlateName); } }
private void LoadConfigFormInfo() { if ( m_IsInitializing == false ) ConfigForm_Load( this, EventArgs.Empty ); this.TreeView.Nodes.Clear(); this.Panel.Controls.Clear(); PlateInfo[] plateInfos = GlobalSetting.PlateInfos; for ( int iIndex = 0; iIndex < plateInfos.Length; iIndex++ ) { PlateInfo plateInfo = plateInfos[iIndex]; TreeNode newTreeNodeParent = new TreeNode( plateInfo.Name ); // TreeNodePlateName treeNodePlateName = new TreeNodePlateName(); treeNodePlateName.PlateName = plateInfo.Name; TreeNode newTreeNodeAll = new TreeNode( "所有的股票" ); newTreeNodeParent.Nodes.Add( newTreeNodeAll ); ConfigBControl configBControlAll = new ConfigBControl(); configBControlAll.Visible = false; configBControlAll.Dock = DockStyle.Fill; this.m_AllConfigControlInfo.Add( newTreeNodeParent, configBControlAll ); this.m_AllConfigControlInfo.Add( newTreeNodeAll, configBControlAll ); for ( int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++ ) { VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2]; TreeNode newTreeNodeSub = new TreeNode( varietyInfo.Name ); newTreeNodeParent.Nodes.Add( newTreeNodeSub ); // treeNodePlateName.VarietyName.Add( newTreeNodeSub, varietyInfo.Name ); ConfigAControl configAControlSub = new ConfigAControl(); configAControlSub.Visible = false; configAControlSub.Dock = DockStyle.Fill; configAControlSub.ButtonSaveChanged += new EventHandler( ConfigAControl_ButtonSaveChanged ); this.m_AllConfigControlInfo.Add( newTreeNodeSub, configAControlSub ); for ( int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++ ) { FileInfo fileInfo = varietyInfo.FileInfos[iIndex3]; ListViewItem listViewItemSub = new ListViewItem( fileInfo.StockName ); ListViewItem.ListViewSubItem listViewSubItemSub1 = new ListViewItem.ListViewSubItem( listViewItemSub, fileInfo.StockSymbol ); ListViewItem.ListViewSubItem listViewSubItemSub2 = new ListViewItem.ListViewSubItem( listViewItemSub, fileInfo.FilePath ); listViewItemSub.SubItems.Add( listViewSubItemSub1 ); listViewItemSub.SubItems.Add( listViewSubItemSub2 ); configAControlSub.ListView.Items.Add( listViewItemSub ); ListViewItem listViewItemAll = new ListViewItem( fileInfo.StockName ); ListViewItem.ListViewSubItem listViewSubItemAll1 = new ListViewItem.ListViewSubItem( listViewItemAll, fileInfo.StockSymbol ); ListViewItem.ListViewSubItem listViewSubItemAll2 = new ListViewItem.ListViewSubItem( listViewItemAll, fileInfo.FilePath ); listViewItemAll.SubItems.Add( listViewSubItemAll1 ); listViewItemAll.SubItems.Add( listViewSubItemAll2 ); configBControlAll.ListView.Items.Add( listViewItemAll ); } this.Panel.Controls.Add( configAControlSub ); } this.TreeView.Nodes.Add( newTreeNodeParent ); this.Panel.Controls.Add( configBControlAll ); m_PlateName.Add( newTreeNodeParent, treeNodePlateName ); } }
private void ButtonNewItem_Click( object sender, EventArgs e ) { TreeNodePlateName treeNodePlateName = new TreeNodePlateName(); do { treeNodePlateName.PlateName = string.Format( "新建的板块{0}", m_PlateCount++ ); bool isOK = true; foreach ( var item in m_PlateName ) { if ( item.Value.PlateName == treeNodePlateName.PlateName ) { isOK = false; break; } } if ( isOK == true ) break; } while ( true ); TreeNode newTreeNodePlate = new TreeNode( treeNodePlateName.PlateName ); TreeNode newTreeNodeAll = new TreeNode( "所有的股票" ); // m_PlateName.Add( newTreeNodePlate, treeNodePlateName ); newTreeNodePlate.Nodes.Add( newTreeNodeAll ); ConfigBControl configBControl = new ConfigBControl(); configBControl.Visible = false; configBControl.Dock = DockStyle.Fill; this.m_AllConfigControlInfo.Add( newTreeNodePlate, configBControl ); this.m_AllConfigControlInfo.Add( newTreeNodeAll, configBControl ); this.TreeView.Nodes.Add( newTreeNodePlate ); this.Panel.Controls.Add( configBControl ); this.TreeView.SelectedNode = newTreeNodeAll; this.ButtonSave.Enabled = true; }