Exemplo n.º 1
0
 /// <summary>
 /// Instancuje novou kolekci Stocks. Jako vstupní parametr požaduje pole akcií.
 /// </summary>
 /// <param name="InputArray">= new List<Stock>(new Stock[] { Stock a, b, c }</param>
 public Pack(Stock[] InputArray)
 {
     foreach(Stock item in InputArray)
     {
         this._Items.Add(item);
     }
     this.ID++;
 }
Exemplo n.º 2
0
 public void AddStock(Stock s)
 {
     foreach (Stock item in _Items)
     {
         if (item.id == s.id && item.l == s.l)
         {
             item.SetAmount(item.Amount + s.Amount);
             return;
         }
     }
     _Items.Add(s);
 }
 public PageBuyWindowAdd(List<Pack> data, Stock akcie)
 {
     InitializeComponent();
     this._Packs = data;
     this.LV_Stocks.ItemsSource = _Packs;
 }
Exemplo n.º 4
0
        private void RedrawChart(Stock input)
        {

        }
        //OK
        #region ContentActions
        //OK
        private void btn_search_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.tb_input_stock_name.Text) || !string.IsNullOrWhiteSpace(this.tb_input_stock_name.Text))
                {
                    WebCOM webc = WebCOM.GetInstance(this._Main);
                                        
                    string input = webc.DownloadString("http://finance.google.com/finance/info?client=ig&q=" + this.tb_input_stock_name.Text);

                    input = input.Replace("// ", "");
                    input = input.Replace("[", "");
                    input = input.Replace("]", "");

                    //Je tu nutné?
                    if (input == "httpserver.cc: Response Code 400" || input == "httpserver.cc: Response Code 400 ")
                    {
                        _Main.UpdateStatusBar("Akcie nenalezena!", 1);
                        return;
                    }

                    JavaScriptSerializer JSS = new JavaScriptSerializer();
                    this._DownloadedStock = JSS.Deserialize<Stock>(input);

                    decimal balance = Convert.ToDecimal(this._DownloadedStock.l);
                    this.Label_Price.Content = balance.ToString("C", CultureInfo.CreateSpecificCulture(_Main.User.Culture.ToString()));

                    if (this.IsWatched(this._DownloadedStock))
                    {
                        this.Label_watching.Content = "Ano";
                    }
                    else
                    {
                        this.Label_watching.Content = "Ne";
                        this.btn_watch.IsEnabled = true;
                    }
                }
                else
                {
                    MessageBox.Show("Zadejte tag vyhledávané akcie!", "Stockholder 2018");
                }
            }
            catch (Exception ex)
            {
                _Main.UpdateStatusBar("Vyhledávání akcie selhalo!", 1);
            }
        }
 //OK
 #region SupportMethods
 private bool IsWatched(Stock stock)
 {
     foreach (Stock item in this._Stocks)
     {
         if (item.id == stock.id)
         {
             return true;
         }
     }
     return false;
 }
        //OK
        private void btn_watch_Click(object sender, RoutedEventArgs e)
        {
            if (this.IsWatched(this._DownloadedStock))
                return;
            this._Stocks.Add(this._DownloadedStock);
            this._DownloadedStock = null;

            _Main.LV_Stocks.Items.Refresh();
            this.btn_watch.IsEnabled = false;
            this.Label_watching.Content = "Ano";
            this.tb_input_stock_name.Text = null;
        }
Exemplo n.º 8
0
 public static BuyWindow ReturnInstance(MainGUI main, Stock stock)
 {
     if (BuyWindow._Instance == null)
         BuyWindow._Instance = new BuyWindow(main, stock);
     return BuyWindow._Instance;
 }
Exemplo n.º 9
0
 private BuyWindow(MainGUI main, Stock st)
 {
     InitializeComponent();
     this._Main = main;
     this._Stock = st;
 }