Exemplo n.º 1
0
        private void button_screen_sort_Click(object sender, EventArgs e)
        {
            AppGlobalCache.getInstance().setTargetList(AppStockData.getInstance().m_screenedList);
            SortForm form = new SortForm();

            form.ShowDialog();
            AppGlobalCache.getInstance().setTargetList(null);
            refreshScreenedList();
        }
Exemplo n.º 2
0
        private void button_select_add_Click(object sender, EventArgs e)
        {
            AppGlobalCache.getInstance().setTargetList(AppStockData.getInstance().m_selfSelectedList);
            AddStockForm addForm = new AddStockForm();

            addForm.ShowDialog();
            AppGlobalCache.getInstance().setTargetList(null);
            refreshSelfSelectList();
        }
Exemplo n.º 3
0
        private void button_add_ok_Click(object sender, EventArgs e)
        {
            string code = textBox_addstock_name.Text;

            if (!StockIDUtil.isValidCode(code))
            {
                if (!StockIDUtil.isValidPureCode(code))
                {
                    MessageBox.Show("无效的股票代码!");
                    this.Close();
                    return;
                }

                code = StockIDUtil.complementCode(code);
            }

            AppStockUtil.addItem(AppGlobalCache.getInstance().getTargetList(), code);
            this.Close();
        }
Exemplo n.º 4
0
        private void runSort()
        {
            AppStockList  targetList = AppGlobalCache.getInstance().getTargetList();
            List <string> src        = new List <string>();

            src.AddRange(targetList.stocks);

            List <StockSortableMetadata> target = new List <StockSortableMetadata>();
            bool reverse = true;

            foreach (string stockID in src)
            {
                StockSortableMetadata sd = null;
                switch (m_sortType)
                {
                case AppStockSortType.SST_AnnualCost:
                    sd = new SSMDAnnualCostPerf(stockID);
                    break;

                case AppStockSortType.SST_DynamicCost:
                    sd = new SSMDCostPerf(stockID);
                    break;

                case AppStockSortType.SST_PriceScale:
                    string refDate = textBox_pricescale_refdate.Text;
                    if (!DateUtil.isDateValid(refDate))
                    {
                        refDate = m_defaultRefDate;
                    }
                    sd = new SSDMPriceScale(stockID, refDate);
                    break;

                case AppStockSortType.SST_QuarterCost:
                    sd = new SSMDQuarterCostPerf(stockID);
                    break;

                case AppStockSortType.SST_SpecCost:
                    string y = textBox_spec_year.Text;
                    string q = textBox_spec_quarter.Text;
                    sd = new SSMDSpecCostPerf(stockID, y, q);
                    break;

                case AppStockSortType.SST_YoyCost:
                    sd = new SSMDYoyCostPerf(stockID);
                    break;

                default:
                    break;
                }

                if (sd != null)
                {
                    target.Add(sd);
                }
            }

            target.Sort();
            if (reverse)
            {
                target.Reverse();
            }

            List <string> result = new List <string>();

            for (int i = 0; i < target.Count; i++)
            {
                result.Add(target[i].stockID);
            }

            targetList.copy(result);
        }