Exemple #1
0
        public DialogForOneGraphic(string title, string currentSelected, string timeSeriesType, string interval, string market, Controller con, MainWindowViewModel mwvm)
        {
            InitializeComponent();

            this.currentSelected = currentSelected;
            //selektujOdgovarajuciRadioButton();

            if (!market.Equals(""))
            {
                if (timeSeriesType.Equals("INTRADAY"))
                {
                    addRadioButtons(contentsForRadioButtonsIntraday, this.currentSelected);
                }
                else
                {
                    addRadioButtons(contentsForRadioButtonsAnother, this.currentSelected);
                }
            }
            else
            {
                addRadioButtons(contentsForRadioButtonsForShares, currentSelected);
            }

            Title = title;
            TimeSeriesTypeComboBox.Text = timeSeriesType;
            if (!interval.Equals(""))
            {
                IntervalComboBox.Visibility = Visibility.Visible;
                IntervalComboBox.Text       = interval;
            }

            Mwvm = mwvm;
            Gvm  = new GraphicViewModel(con, Title);

            this.DataContext = Gvm;

            Gvm.addSeriesWithOutCheck(currentSelected.ToUpper());

            string contentOfTimeSeriesComboBox = TimeSeriesTypeComboBox.Text;

            string symbol;

            if (Title.Contains("__"))
            {
                string[] tokens = Title.Split(new string[] { "__" }, System.StringSplitOptions.None);
                symbol = tokens[0];
            }
            else
            {
                symbol = Title;
            }

            List <DataPoint> dataPoints = Mwvm.getSpecificData(symbol, contentOfTimeSeriesComboBox, currentSelected, interval, market);

            if (dataPoints != null)
            {
                Gvm.addPoints(currentSelected.ToUpper(), dataPoints);
            }
            else
            {
                MessageBox.Show("Problem with data delivery for " + Title, "Error");
            }

            PlotView.InvalidatePlot(true); // refresh
        }