Beispiel #1
0
        private void CreateWeightGraph(int numberOfEntries)
        {
            var weight     = json.DeserializeGewichtTag();
            var jsonLenght = weight.Count;

            MyValues.Clear();
            TypeOfGraph.Title = "Gewicht";

            if (jsonLenght == 0)
            {
                return;
            }
            var helper = jsonLenght - numberOfEntries - 1;

            for (int i = 0; i <= numberOfEntries - 1; i++)
            {
                if (i >= jsonLenght)
                {
                    break;
                }

                if (jsonLenght <= numberOfEntries)
                {
                    MyValues.Add(new ObservableValue(weight[i].TodaysWeight));
                }
                else
                {
                    MyValues.Add(new ObservableValue(weight[helper + i].TodaysWeight));
                }
            }
        }
Beispiel #2
0
        private void WriteWeight()
        {
            var weightList = json.DeserializeGewichtTag();
            int counter    = 0;

            foreach (var item in weightList)
            {
                if (item.Day == DateTime.Today)
                {
                    weightList[counter].TodaysWeight = double.Parse(Gewicht.Text);
                    json.Serializer(weightList);
                    return;
                }
                counter++;
            }
            weightList.Add(new GewichtTag()
            {
                Day          = DateTime.Today,
                TodaysWeight = double.Parse(Gewicht.Text)
            });
            json.Serializer(weightList);
        }