private void ButtonLoad_Click(object sender, EventArgs e)
        {
            this.OpenFileDialogStock.InitialDirectory = GetRegistryOpenFilePath_Open();

            if (this.OpenFileDialogStock.ShowDialog(this) == DialogResult.OK)
            {
                SetRegistryOpenFilePath_Open(this.OpenFileDialogStock.InitialDirectory);

                StockFileInfo[] stockFileInfoArray = GlobalSetting.LoadConfigSetting(this.OpenFileDialogStock.FileName);

                foreach (ListViewItem item in this.ListViewStock.Items)
                {
                    m_ListDelete.Add(item);
                }

                for (int iIndex = 0; iIndex < stockFileInfoArray.Length; iIndex++)
                {
                    StockFileInfo stockFileInfo = stockFileInfoArray[iIndex];
                    string        securityInfo  = GlobalSetting.GetStockCode(stockFileInfo.StockName, stockFileInfo.StockSymbol);

                    ListViewItem listViewItem = new ListViewItem(stockFileInfo.StockName);
                    ListViewItem.ListViewSubItem listViewSubItem1 = new ListViewItem.ListViewSubItem(listViewItem, stockFileInfo.StockSymbol);
                    ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem(listViewItem, stockFileInfo.StockFilePath);

                    listViewItem.SubItems.Add(listViewSubItem1);
                    listViewItem.SubItems.Add(listViewSubItem2);

                    bool bIsOK = true;
                    foreach (ListViewItem item in this.ListViewStock.Items)
                    {
                        string securityInfo2 = GlobalSetting.GetStockCode(item.Text, item.SubItems[1].Text);

                        if (securityInfo == securityInfo2)
                        {
                            bIsOK = false;
                            break;
                        }
                    }

                    if (bIsOK == true)
                    {
                        m_ListAdd.Add(listViewItem);
                        this.ListViewStock.Items.Add(listViewItem);
                    }
                }

                if (ButtonSaveChanged != null)
                {
                    ButtonSaveChanged(this, EventArgs.Empty);
                }
            }
        }
Beispiel #2
0
        private void ButtonLoad_Click(object sender, EventArgs e)
        {
            //this.OpenFileDialogStock.InitialDirectory = GetRegistryOpenFilePath_Open();

            if (this.OpenFileDialogStock.ShowDialog() == DialogResult.OK)
            {
                //SetRegistryOpenFilePath_Open( this.OpenFileDialogStock.InitialDirectory );

                StockFileInfo[] stockFileInfoArray = GlobalSetting.LoadConfigSetting(this.OpenFileDialogStock.FileName);

                this.SetStockFileInfos(stockFileInfoArray);

                //if ( ButtonSaveChanged != null )
                //    ButtonSaveChanged( this, EventArgs.Empty );
            }
        }