Ejemplo n.º 1
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            int count = 0;

            var instrumentSource = new InstrumentManager();

            foreach (FredUtils.FredSeries series in InstrumentGrid.SelectedItems)
            {
                var newInstrument = FredUtils.SeriesToInstrument(series);
                newInstrument.Datasource = _thisDS;

                try
                {
                    if (instrumentSource.AddInstrument(newInstrument) != null)
                    {
                        count++;
                    }
                    AddedInstruments.Add(newInstrument);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            StatusLabel.Content = string.Format("{0}/{1} instruments added.", count, InstrumentGrid.SelectedItems.Count);
        }
Ejemplo n.º 2
0
        private async void Search()
        {
            Series.Clear();
            StatusLabel.Content = "Searching...";

            var foundSeries = await FredUtils.FindSeries(SymbolTextBox.Text, ApiKey);

            foreach (var i in foundSeries)
            {
                Series.Add(i);
            }

            StatusLabel.Content = foundSeries.Count() + " contracts found";
        }