Esempio n. 1
0
 public ICharacteristic FindCharacteristic(KnownCharacteristic characteristic)
 {
     foreach (var item in NativeService.Characteristics)
     {
         if (item.UUID.GuidFromUuid() == characteristic.ID)
         {
             return new Characteristic(item, ParentDevice);
         }
     }
     return null;
 }
 public static void LoadItemsFromJson()
 {
     _items = new Dictionary<Guid, KnownCharacteristic> ();
     //TODO: switch over to CharacteristicStack.Text when it gets bound.
     KnownCharacteristic characteristic;
     string itemsJson = ResourceLoader.GetEmbeddedResourceString (typeof(KnownCharacteristics).GetTypeInfo ().Assembly, "KnownCharacteristics.json");
     var json = JValue.Parse (itemsJson);
     foreach (var item in json.Children() ) {
         JProperty prop = item as JProperty;
         characteristic = new KnownCharacteristic () { Name = prop.Value.ToString(), ID = Guid.ParseExact (prop.Name, "d") };
         _items.Add (characteristic.ID, characteristic);
     }
 }
        public static void LoadItemsFromJson()
        {
            _items = new Dictionary <Guid, KnownCharacteristic> ();
            //TODO: switch over to CharacteristicStack.Text when it gets bound.
            KnownCharacteristic characteristic;
            string itemsJson = ResourceLoader.GetEmbeddedResourceString(typeof(KnownCharacteristics).GetTypeInfo().Assembly, "KnownCharacteristics.json");
            var    json      = JValue.Parse(itemsJson);

            foreach (var item in json.Children())
            {
                JProperty prop = item as JProperty;

                characteristic = new KnownCharacteristic()
                {
                    Name = prop.Value.ToString(), ID = Guid.ParseExact(prop.Name, "d")
                };
                _items.Add(characteristic.ID, characteristic);
            }
        }