Exemplo n.º 1
0
        private void UpdateList(LogBook_Model data)
        {
            var index = private_list.IndexOf(data);

            private_list.Remove(data);
            private_list.Insert(index, data);
        }
Exemplo n.º 2
0
        private void UpdateData()
        {
            List <LogBook_Model> _data = new List <LogBook_Model>();

            Profil = DataStore.GetSettingsAsync().First();
            foreach (var item in DataStore.GetGlucosAsync())
            {
                var glucose = new LogBook_Model
                {
                    Data            = item,
                    DataValue       = GlycemiaConverter.Convert(item, Profil.GlycemiaUnit).Glycemia.ToString(),
                    Date            = item.Date,
                    Activity        = item.Activity,
                    Take_Medication = item.Taking_Medication,
                    Type            = "Glucose",
                    Unit            = Profil.GlycemiaUnit,
                    PicturePath     = item.PicturePathe
                };
                _data.Add(glucose);
            }
            foreach (var item in DataStore.GetHb1acAsync())
            {
                var drug = new LogBook_Model
                {
                    Data        = item,
                    DataValue   = item.Hb1Ac.ToString(),
                    Date        = item.Date,
                    Type        = "Hb1Ac",
                    Unit        = "%",
                    PicturePath = item.PicturePathe
                };
                _data.Add(drug);
            }

            foreach (var item in DataStore.GetPressionAsync())
            {
                var drug = new LogBook_Model
                {
                    Data        = item,
                    DataValue   = item.Diastolique.ToString() + "/" + item.Systolique.ToString(),
                    Date        = item.Date,
                    At_Home     = (item.Where == "home") ? true : false,
                    At_Doctor   = (item.Where == "clinic") ? true : false,
                    Type        = "Pression",
                    Unit        = "mmgH",
                    PicturePath = item.PicturePathe
                };
                _data.Add(drug);
            }
            foreach (var item in DataStore.GetWeightAsync())
            {
                var drug = new LogBook_Model
                {
                    Data        = item,
                    DataValue   = WeightConverter.Convert(item, Profil.WeightUnit).Weight.ToString(),
                    Date        = item.Date,
                    Type        = "Weight",
                    Unit        = Profil.WeightUnit,
                    PicturePath = item.PicturePathe
                };
                _data.Add(drug);
            }
            private_list  = new ObservableCollection <LogBook_Model>(_data);
            Selected_item = null;
            old_selected  = null;
            var sorted = from data in _data
                         orderby data.Date descending
                         group data by data.DateSort into DataGroup
                         select new Grouping <string, LogBook_Model>(DataGroup.Key, DataGroup);

            DataGrouped = new ObservableCollection <Grouping <string, LogBook_Model> >(sorted);
        }