public void Test_GenericBinding_NullValueSelector()
 {
     Assert.ThrowsException <ArgumentNullException>(() => {
         GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>();
         binding.ValueSelector = null;
     });
 }
 public void Test_GenericBinding_UnspecifiedValueSelector()
 {
     Assert.ThrowsException <InvalidOperationException>(() => {
         GenericDataPointBinding <int, int> binding = new GenericDataPointBinding <int, int>();
         binding.GetValue(0);
     });
 }
 public void Test_GenericBinding_UnexpectedInstance()
 {
     Assert.ThrowsException <ArgumentNullException>(() => {
         GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>();
         binding.ValueSelector = (o) => o.Value.Value;
         binding.GetValue(null);
     });
 }
        public BaseInterpolationViewModel()
        {
            Init();

            _categroriesSelector = new GenericDataPointBinding <KeyValuePair <String, float>, String>();
            _categroriesSelector.ValueSelector = pair => pair.Key;

            _valuesSelector = new GenericDataPointBinding <KeyValuePair <String, float>, float>();
            _valuesSelector.ValueSelector = pair => pair.Value;

            FillRatesTableColumns();
        }
        public void Test_GenericBinding()
        {
            GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>();

            binding.ValueSelector = (o) => o.Value.Value;

            BusinessObject obj = new BusinessObject()
            {
                Value = 1
            };

            Assert.AreEqual <double>(1, (double)binding.GetValue(obj), "Value not looked-up correctly");
        }
        public void Test_GenericBinding_PropertyChanged()
        {
            GenericDataPointBinding <BusinessObject, double> binding = new GenericDataPointBinding <BusinessObject, double>();

            bool propertyChangedCalled = false;

            binding.PropertyChanged += (sender, args) =>
            {
                propertyChangedCalled = true;
                Assert.AreEqual <string>("ValueSelector", args.PropertyName);
            };

            binding.ValueSelector = (o) => o.Value.Value;

            Assert.IsTrue(propertyChangedCalled);
        }
示例#7
0
        public ScoreChangeViewModel()
        {
            _model = new ScoreChangeModel();

            _changesDataSource = new DataTable();

            _dates = _model.GetDates();

            _selectedDate1 = _dates[0];
            _selectedDate2 = _dates[1];

            _categroriesSelectorQuint = new GenericDataPointBinding <KeyValuePair <String, int>, String>();
            _categroriesSelectorQuint.ValueSelector = pair => pair.Key;
            _valuesSelectorQuint = new GenericDataPointBinding <KeyValuePair <String, int>, int>();
            _valuesSelectorQuint.ValueSelector = pair => pair.Value;
        }
        private void ProceedDatas()
        {
            var dpb = new GenericDataPointBinding <KeyValuePair <int, double>, int>();

            dpb.ValueSelector = pair => pair.Key;

            if (SelectedDate == null || SelectedUniverse == null ||
                SelectedSuperSector == null || SelectedSuperSector == "")
            {
                return;
            }

            _valuesDataSource = new DataTable();

            InvokeOnUIThread(() =>
            {
                this.BusyContent = string.Concat("Loading Values And Cleaning Companies\n");
            });

            DataTable tmp = cleaner.CleanCompanyName(_model.FillValeursAnalyse(SelectedDate, SelectedUniverse,
                                                                               SelectedSuperSector, SelectedSector), "TICKER", "Company Name");

            for (int i = 0; i < tmp.Columns.Count; i++)
            {
                _valuesDataSource.Columns.Add(tmp.Columns[i].ToString());
                _valuesDataSource.Columns[i].DataType = typeof(String);
            }


            this.ValuesDataSource = FillAndSetFormat(tmp, this._valuesDataSource);
            this.ValuesDataSource.DefaultView.Sort = ("Note DESC");

            GlobalInfos.tickerQuintQaunt = new Dictionary <string, int>();
            foreach (DataRow dr in ValuesDataSource.Rows)
            {
                GlobalInfos.tickerQuintQaunt.Add(dr["Ticker"].ToString(), int.Parse(dr["Quint Quant"].ToString()));
            }

            InvokeOnUIThread(() =>
            {
                this.BusyContent += string.Concat("Recreating all tables for filters\n");
            });

            FillColsValid();
            ValuesDataSource = RecreateTables(ValuesDataSource);
        }
示例#9
0
        public IndicateurViewModel()
        {
            _model = new IndicateurModel();

            _isin = _model.getIsin();

            _dateD = _model.getDateD();

            _dateF = _model.getDateF();

            _source         = _model.getSource();
            _selectedSource = _source[0];

            _categroriesSelector = new GenericDataPointBinding <KeyValuePair <String, float>, String>();
            _categroriesSelector.ValueSelector = pair => pair.Key;
            _valuesSelector = new GenericDataPointBinding <KeyValuePair <String, float>, float>();
            _valuesSelector.ValueSelector = pair => pair.Value;
        }