Пример #1
0
        private void ReloadOptionFormInfo()
        {
            this.SuspendLayout();
            {
                m_AllOptionControlInfo.Clear();
                m_CurrentOptionControl = null;

                List <Control> controlList = new List <Control>();
                foreach (Control control in this.Panel.Controls)
                {
                    if (control != m_SettingControl && control != m_SearchControl)
                    {
                        controlList.Add(control);
                    }
                }

                foreach (Control control in controlList)
                {
                    this.Panel.Controls.Remove(control);
                }

                this.TreeView.Nodes.Clear();

                this.m_AllOptionControlInfo.Add(m_TreeNodeSetting, m_SettingControl);
                this.m_AllOptionControlInfo.Add(m_TreeNodeSettingSub, m_SettingControl);

                this.TreeView.Nodes.Add(m_TreeNodeSetting);

                PlateInfo[] plateInfos = GlobalSetting.PlateInfos;
                for (int iIndex = 0; iIndex < plateInfos.Length; iIndex++)
                {
                    PlateInfo plateInfo = plateInfos[iIndex];

                    TreeNode newTreeNodePlate     = new TreeNode(plateInfo.Name);
                    TreeNode newTreeNodePlateSub  = new TreeNode("常规");
                    TreeNode newTreeNodePlateSub2 = new TreeNode("所有股票");

                    newTreeNodePlate.Nodes.Add(newTreeNodePlateSub);
                    newTreeNodePlate.Nodes.Add(newTreeNodePlateSub2);

                    OptionBControl optionBControl = new OptionBControl {
                        Dock = DockStyle.Fill, Visible = false
                    };

                    this.m_AllOptionControlInfo.Add(newTreeNodePlate, optionBControl);
                    this.m_AllOptionControlInfo.Add(newTreeNodePlateSub, optionBControl);

                    this.Panel.Controls.Add(optionBControl);

                    OptionFControl optionFControl = new OptionFControl {
                        Dock = DockStyle.Fill, Visible = false
                    };

                    this.m_AllOptionControlInfo.Add(newTreeNodePlateSub2, optionFControl);

                    this.Panel.Controls.Add(optionFControl);

                    for (int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++)
                    {
                        VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2];

                        TreeNode newTreeNodePlateSub3 = new TreeNode(varietyInfo.Name);
                        newTreeNodePlate.Nodes.Add(newTreeNodePlateSub3);

                        OptionCControl optionCControlSub3 = new OptionCControl {
                            Dock = DockStyle.Fill, Visible = false
                        };

                        this.m_AllOptionControlInfo.Add(newTreeNodePlateSub3, optionCControlSub3);

                        this.Panel.Controls.Add(optionCControlSub3);

                        for (int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++)
                        {
                            Demo.Stock.X.Common.FileInfo fileInfo = varietyInfo.FileInfos[iIndex3];

                            StockManager stockManager = GlobalStockManager.GetStockManagerByPlateAndVariety(plateInfo.Name, varietyInfo.Name);
                            StockInfo    stockInfo    = stockManager.GetStockDataByStockCode(GlobalSetting.GetStockCode(fileInfo.StockName, fileInfo.StockSymbol));
                            if (stockInfo == null)
                            {
                                continue;
                            }

                            ListViewItem listViewItem = new ListViewItem(stockInfo.StockName, 0);
                            listViewItem.SubItems.Add(stockInfo.StockSymbol);
                            listViewItem.SubItems.Add(stockInfo.Periodicity.ToString());
                            listViewItem.SubItems.Add(stockInfo.FirstDate.ToShortDateString());
                            listViewItem.SubItems.Add(stockInfo.LastDate.ToShortDateString());
                            listViewItem.SubItems.Add(stockInfo.FirstTime.ToLongTimeString());
                            listViewItem.SubItems.Add(stockInfo.LastTime.ToLongTimeString());
                            listViewItem.SubItems.Add(stockInfo.StartTime.ToShortTimeString());
                            listViewItem.SubItems.Add(stockInfo.EndTime.ToShortTimeString());
                            listViewItem.SubItems.Add(stockInfo.CollectionDate.ToShortDateString());

                            optionCControlSub3.ListViewStockInfo.Items.Add(listViewItem);
                        }
                    }

                    this.TreeView.Nodes.Add(newTreeNodePlate);
                }

                // 搜索结果
                this.m_AllOptionControlInfo.Add(m_TreeNodeSearch, m_SearchControl);
                this.m_AllOptionControlInfo.Add(m_TreeNodeSearchSub, m_SearchControl);

                m_TreeNodeSearch.Nodes.Clear();
                m_TreeNodeSearch.Nodes.Add(m_TreeNodeSearchSub);

                this.TreeView.Nodes.Add(m_TreeNodeSearch);

                this.TreeView.SelectedNode = m_TreeNodeSetting;
            }
            this.ResumeLayout(false);
        }
Пример #2
0
        private void InitOptionFormInfo()
        {
            this.SuspendLayout();
            {
                m_TreeNodeSetting.Nodes.Add(m_TreeNodeSettingSub);

                m_SettingControl         = new OptionAControl();
                m_SettingControl.Dock    = DockStyle.Fill;
                m_SettingControl.Visible = false;

                this.m_AllOptionControlInfo.Add(m_TreeNodeSetting, m_SettingControl);
                this.m_AllOptionControlInfo.Add(m_TreeNodeSettingSub, m_SettingControl);

                this.Panel.Controls.Add(m_SettingControl);

                m_SettingControl.CheckBoxPopupInfo.Checked = GlobalSetting.IsPopStartupInfo;
                m_SettingControl.NumericUpDownKLine.Value  = (decimal)GlobalSetting.ShowKLineLength;
                m_SettingControl.TrackBarKLine.Value       = (int)GlobalSetting.ShowKLineLength;
                m_SettingControl.SetConfigFile            += new EventHandlerNone(SettingControl_SetConfigFile);

                this.TreeView.Nodes.Add(m_TreeNodeSetting);
                //-------------------------------------

                PlateInfo[] plateInfos = GlobalSetting.PlateInfos;
                for (int iIndex = 0; iIndex < plateInfos.Length; iIndex++)
                {
                    PlateInfo plateInfo = plateInfos[iIndex];

                    TreeNode newTreeNodePlate     = new TreeNode(plateInfo.Name);
                    TreeNode newTreeNodePlateSub  = new TreeNode("常规");
                    TreeNode newTreeNodePlateSub2 = new TreeNode("所有股票");

                    newTreeNodePlate.Nodes.Add(newTreeNodePlateSub);
                    newTreeNodePlate.Nodes.Add(newTreeNodePlateSub2);

                    OptionBControl optionBControl = new OptionBControl {
                        Dock = DockStyle.Fill, Visible = false
                    };

                    this.m_AllOptionControlInfo.Add(newTreeNodePlate, optionBControl);
                    this.m_AllOptionControlInfo.Add(newTreeNodePlateSub, optionBControl);

                    this.Panel.Controls.Add(optionBControl);

                    OptionFControl optionFControl = new OptionFControl {
                        Dock = DockStyle.Fill, Visible = false
                    };

                    this.m_AllOptionControlInfo.Add(newTreeNodePlateSub2, optionFControl);

                    this.Panel.Controls.Add(optionFControl);

                    //
                    for (int iIndex2 = 0; iIndex2 < plateInfo.VarietyInfos.Length; iIndex2++)
                    {
                        VarietyInfo varietyInfo = plateInfo.VarietyInfos[iIndex2];

                        TreeNode newTreeNodePlateSub3 = new TreeNode(varietyInfo.Name);
                        newTreeNodePlate.Nodes.Add(newTreeNodePlateSub3);

                        OptionCControl optionCControlSub3 = new OptionCControl {
                            Dock = DockStyle.Fill, Visible = false
                        };

                        this.m_AllOptionControlInfo.Add(newTreeNodePlateSub3, optionCControlSub3);

                        this.Panel.Controls.Add(optionCControlSub3);

                        for (int iIndex3 = 0; iIndex3 < varietyInfo.FileInfos.Length; iIndex3++)
                        {
                            Demo.Stock.X.Common.FileInfo fileInfo = varietyInfo.FileInfos[iIndex3];

                            StockManager stockManager = GlobalStockManager.GetStockManagerByPlateAndVariety(plateInfo.Name, varietyInfo.Name);
                            StockInfo    stockInfo    = stockManager.GetStockDataByStockCode(fileInfo.StockName + "[" + fileInfo.StockSymbol + "]");

                            ListViewItem listViewItem = new ListViewItem(stockInfo.StockName, 0);
                            listViewItem.SubItems.Add(stockInfo.StockSymbol);
                            listViewItem.SubItems.Add(stockInfo.Periodicity.ToString());
                            listViewItem.SubItems.Add(stockInfo.FirstDate.ToShortDateString());
                            listViewItem.SubItems.Add(stockInfo.LastDate.ToShortDateString());
                            listViewItem.SubItems.Add(stockInfo.FirstTime.ToLongTimeString());
                            listViewItem.SubItems.Add(stockInfo.LastTime.ToLongTimeString());
                            listViewItem.SubItems.Add(stockInfo.StartTime.ToShortTimeString());
                            listViewItem.SubItems.Add(stockInfo.EndTime.ToShortTimeString());
                            listViewItem.SubItems.Add(stockInfo.CollectionDate.ToShortDateString());

                            optionCControlSub3.ListViewStockInfo.Items.Add(listViewItem);
                        }
                    }

                    this.TreeView.Nodes.Add(newTreeNodePlate);
                }
                //----------------------------------------------

                // 搜索结果
                m_TreeNodeSearch.Nodes.Add(m_TreeNodeSearchSub);

                m_SearchControl         = new OptionDControl();
                m_SearchControl.Dock    = DockStyle.Fill;
                m_SearchControl.Visible = false;

                this.m_AllOptionControlInfo.Add(m_TreeNodeSearch, m_SearchControl);
                this.m_AllOptionControlInfo.Add(m_TreeNodeSearchSub, m_SearchControl);

                this.Panel.Controls.Add(m_SearchControl);

                this.TreeView.Nodes.Add(m_TreeNodeSearch);
                //----------------------------------------------

                this.TreeView.SelectedNode = m_TreeNodeSettingSub;
            }
            this.ResumeLayout(false);
        }
        private void SaveConfigFormInfo()
        {
            List<PlateInfo> plateInfoList = new List<PlateInfo>();

            for ( int iIndex = 0; iIndex < this.TreeView.Nodes.Count; iIndex++ )
            {
                TreeNode treeNodeParent = this.TreeView.Nodes[iIndex];
                if ( treeNodeParent == null )
                    continue;

                PlateInfo plateInfo = new PlateInfo();
                plateInfo.Name = treeNodeParent.Text;
                plateInfo.VarietyInfos = new VarietyInfo[0];

                plateInfoList.Add( plateInfo );

                List<VarietyInfo> varietyInfoList = new List<VarietyInfo>();

                for ( int iIndex2 = 1; iIndex2 < treeNodeParent.Nodes.Count; iIndex2++ )
                {
                    TreeNode treeNodeParentSub = treeNodeParent.Nodes[iIndex2];
                    if ( treeNodeParentSub == null )
                        continue;

                    VarietyInfo varietyInfo = new VarietyInfo();
                    varietyInfo.Name = treeNodeParentSub.Text;
                    varietyInfo.FileInfos = new FileInfo[0];

                    varietyInfoList.Add( varietyInfo );

                    UserControl outUserControl = null;
                    if ( m_AllConfigControlInfo.TryGetValue( treeNodeParentSub, out outUserControl ) == true )
                    {
                        ConfigAControl outConfigAControl = outUserControl as ConfigAControl;
                        if ( outConfigAControl != null )
                        {
                            List<FileInfo> fileInfoList = new List<FileInfo>();

                            for ( int iIndex3 = 0; iIndex3 < outConfigAControl.ListView.Items.Count; iIndex3++ )
                            {
                                ListViewItem listViewItem = outConfigAControl.ListView.Items[iIndex3];

                                FileInfo fileInfo = new FileInfo();
                                fileInfo.StockName = listViewItem.Text;
                                fileInfo.StockSymbol = listViewItem.SubItems[1].Text;
                                fileInfo.FilePath = listViewItem.SubItems[2].Text;

                                fileInfoList.Add( fileInfo );
                            }

                            varietyInfo.FileInfos = fileInfoList.ToArray();
                        }
                    }
                }

                plateInfo.VarietyInfos = varietyInfoList.ToArray();
            }

            GlobalSetting.SaveConfigSetting( GlobalSetting.ConfigFilePath, plateInfoList.ToArray() );
        }