示例#1
0
        private void button_removeholding_Click(object sender, RoutedEventArgs e)
        {
            string toRemove = listBox_holding.SelectedValue.ToString();

            foreach (FScoreHolding fsh in Holdings)
            {
                if (fsh.StockTicker.Equals(toRemove))
                {
                    Holdings.Remove(fsh);
                    break;
                }
            }
            FScoreHoldingXmlHelper.ToXmlFile(Holdings, _holdingFileName);
            UpdateHoldingStocks();
        }
示例#2
0
        private void button_addholding_Click(object sender, RoutedEventArgs e)
        {
            string addme = textBox_holding.Text;
            // eventually add stock checker and object filler

            FScoreHolding hold = new FScoreHolding();

            hold.StockName   = addme;
            hold.StockTicker = addme;

            Holdings.Add(hold);

            FScoreHoldingXmlHelper.ToXmlFile(Holdings, _holdingFileName);

            UpdateHoldingStocks();
        }
示例#3
0
        // update the list in the UI by reading the xml file
        private void UpdateHoldingStocks()
        {
            Holdings.Clear();
            List <FScoreHolding> holdings = FScoreHoldingXmlHelper.FromXmlFile <List <FScoreHolding> >(_holdingFileName);

            if (holdings != null)
            {
                Holdings = holdings;
            }

            // now populate the listbox
            listBox_holding.Items.Clear();
            foreach (FScoreHolding fsh in Holdings)
            {
                listBox_holding.Items.Add(fsh.StockTicker);
            }
        }