Example #1
0
 public async Task <bool> Delete(StateValueKey stateValueKey)
 {
     using (var client = new HomeConnectionClient(HomeHubConnection))
     {
         return(await client.Delete <bool>("statesvalues", stateValueKey.Key));
     }
 }
        public async Task <bool> UnSubscribe(string sentinelHost, string packageHost, string stateValueName)
        {
            using (var client = new HomeConnectionClient(HomeHubConnection))
            {
                var stateValueKey = new StateValueKey(sentinelHost, packageHost, stateValueName);
                if (_subscriptionsStore.ContainsKey(stateValueKey))
                {
                    var isSubscriptionDeleted = await client.Delete <bool>("subscription",
                                                                           $"{SentinelHost.GetName()}.{_subscriptionsStore[stateValueKey].Key}");

                    if (isSubscriptionDeleted)
                    {
                        RemoveSubscriptionToStore(stateValueKey);
                        await UnSubscribeOnValueChanged(new StateValueKey(sentinelHost, packageHost, stateValueName));
                    }
                    return(isSubscriptionDeleted);
                }
            }
            return(false);
        }