public async Task LoadConditions() { Conditions.Clear(); _conditionManager = Context.Current.ConditionManager; if (_conditionManager != null) { if (_conditionManager.IsConnected) { var conds = await _conditionManager.GetConditions(); foreach (var cond in conds) { Conditions.Add(new ConditionViewModel() { SourceDeviceType = cond.SourceDeviceType, SourceDeviceName = cond.SourceDeviceName, TargetDeviceName = cond.TargetDeviceName, RequiredValue = cond.RequiredValue, ConditionType = cond.ConditionType, TargetValue = cond.TargetValue }); } } else { Conditions.Clear(); } } }
private Context() { _devices = new ObservableCollection <Device>(); _readings = new ObservableCollection <Reading>(); _condMgr = new ClientConditionManager(); _users = new ObservableCollection <User>(); Locks = new Dictionary <string, object>(); Locks.Add("Global", new object()); Locks.Add("Devices", new object()); Locks.Add("Readings", new object()); Locks.Add("Conditions", new object()); Locks.Add("Users", new object()); }