コード例 #1
0
        public void GetAllExchanges(ExchangeListCallback exchangeListCallback)
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += new DoWorkEventHandler((object sender, DoWorkEventArgs e) =>
            {
                try
                {
                    this.AllExchanges = GoogleFinanceDataBL.GetExchanges();
                    exchangeListCallback(this.AllExchanges);
                }
                catch (Exception ex)
                {
                    string str = "Error in getting the exchange info.\n";
                    statusManager.SetStatus(new Status(str, ex));
                    logger.Write(str + ex.Message);
                }
            });
            bw.RunWorkerAsync();
        }
コード例 #2
0
        public ExchangeTabViewModel()
        {
            try
            {
                ListOfAllExchanges = new ObservableCollection <string>();
                ListOfExchanges    = new ObservableCollection <string>();


                AddExchCommand    = new RelayCommand(ExecuteAddExchCommand);
                DeleteExchCommand = new RelayCommand(ExecuteDeleteExchCommand);
                ExchangeListCallback exchangeListCallback = new ExchangeListCallback((List <string> list) =>
                {
                    this.currentDispatcher.BeginInvoke((Action) delegate()
                    {
                        list.ForEach(i => ListOfAllExchanges.Add(i));
                    });
                });
                this.PropertyChanged += (obj, args) =>
                {
                    if (args.PropertyName == "SelectedExchange")
                    {
                        mediator.Action = new PropertyAction()
                        {
                            PropertyName = "SelectedExchange", value = SelectedExchange
                        };
                    }
                };

                dataManager.GetAllExchanges(exchangeListCallback);
                dataManager.GetExchangesConfigured().ForEach(i => ListOfExchanges.Add(i));

                mediator.RegisterForAction("SelectedExchange", true, this);
            }
            catch (Exception ex)
            {
                string str = "Failed to initialize ExchangeTabViewModel";
                statusManager.SetStatus(new Status(str, ex));
                logger.Write(str + ex.Message);
            }
        }
コード例 #3
0
 public void GetAllExchanges(ExchangeListCallback exchangeListCallback)
 {
     exchangeListCallback(this.AllExchanges);
 }