public async Task AddIfNotExists(CustomIcon icon)
        {
            var existing = await _customIconRepository.GetAsync(icon.Id);

            if (existing == null)
            {
                await _customIconRepository.CreateAsync(icon);
            }
        }
Esempio n. 2
0
        private async Task GetCustomIcon(string customIconId, string nodeId)
        {
            var icon = await _customIconRepository.GetAsync(customIconId);

            var data = Array.Empty <byte>();

            if (icon != null)
            {
                var response = new WearCustomIcon(icon.Id, icon.Data);
                var json     = JsonConvert.SerializeObject(response);
                data = Encoding.UTF8.GetBytes(json);
            }

            await WearableClass.GetMessageClient(this).SendMessageAsync(nodeId, GetCustomIconCapability, data);
        }