コード例 #1
0
        private void Load()
        {
            var dialog = new OpenFileDialog
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Inside MMA",
                Multiselect      = true
            };

            if (dialog.ShowDialog() != true)
            {
                return;
            }
            foreach (var fileName in dialog.FileNames)
            {
                var file = File.Open(fileName, FileMode.Open);
                var list = (List <TradeItem>) new XmlSerializer(typeof(List <TradeItem>)).Deserialize(file);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    foreach (var item in list)
                    {
                        if (AllTradesCounters.Select(c => c.Quantity).Contains(item.Quantity))
                        {
                            var val = AllTradesCounters.First(t => t.Quantity == item.Quantity);
                            val.Count++;
                            if (item.Buysell == "B")
                            {
                                val.Buy++;
                            }
                            else
                            {
                                val.Sell++;
                            }
                            val.Delta = val.Buy - val.Sell;
                        }
                        else
                        {
                            var val = new AllTradesCounterItem(item.Quantity, 1, 0, 0, 0);
                            if (item.Buysell == "B")
                            {
                                val.Buy++;
                            }
                            else
                            {
                                val.Sell++;
                            }
                            val.Delta = val.Buy - val.Sell;
                            AllTradesCounters.Add(val);
                        }
                    }
                });
                Seccode += fileName.Split('\\').Last().Replace(".xml", "") + " ";
                file.Close();
            }
        }
コード例 #2
0
 private void BarChart()
 {
     if (_barChart == null)
     {
         _barChart = new TradesCounterBarChart(this)
         {
             DataContext = new TradesCounterBarChartViewModel(AllTradesCounters.ToList())
         };
         _barChart.Show();
     }
     else
     {
         _barChart.WindowState = WindowState.Normal;
         _barChart.Activate();
     }
 }