Esempio n. 1
0
        public static Collection Parse(string JSON)
        {
            var collection = new Collection();

            var array = JArray.Parse(JSON);
            foreach (var item in array)
            {
                collection.Insert(Document.Parse(item.ToString()));
            }

            return collection;
        }
Esempio n. 2
0
 public void Assure_Documents_is_set()
 {
     var collection = new Collection();
     collection.Documents.ShouldNotBeNull();
 }
Esempio n. 3
0
	    private void LoadDataIntoViewModel(Collection collection)
	    {
            ViewModel.Data.Clear();
            int numberOfDataPointsAdded = 0;
	        var dataPoints = new List<DataPoint>();

	        try
	        {
                foreach (var doc in collection.Documents.OrderByDescending(d => d[graphConfig.XAxisProperty].Value<Object>()))
                {
                    dataPoints.Add(new DataPoint() { X = doc[graphConfig.XAxisProperty].Value<Object>(), Y = doc[graphConfig.YAxisProperty].Value<Object>() });
                    numberOfDataPointsAdded++;
                    if (numberOfDataPointsAdded >= graphConfig.MaxNumberOfDataPoints)
                        break;
                }
	        }
	        catch (Exception)
	        {
	        }

            if (numberOfDataPointsAdded > 0)
            {
                dataPoints.Reverse();
                foreach (var dataPoint in dataPoints)
                {
                    ViewModel.Data.Add(dataPoint);
                }
            }
	    }