private void RefreshSpinControl() { DevSpinCtrl.Reset(); if (currentDomoticzServer == null) { int ServerStatus = 0; currentDomoticzServer = new DomoticzServer(); ServerStatus = currentDomoticzServer.InitServer(_serveradress, _serverport, _username, _password); if (ServerStatus != 1) return; } AllDevResponse = currentDomoticzServer.GetAllDevices(); List<DomoticzServer.Device> res = null; DeviceFilter F = new DeviceFilter(CurrentFilterBy); res = AllDevResponse.result.Where(x => F.Filter(x)).ToList(); OnSort(); DevSpinCtrl.SetRange(0, res.Count - 1); int i = 0; foreach (DomoticzServer.Device d in res) { DevSpinCtrl.AddLabel(d.Name + " (" + d.idx + ")", i); if (DeviceIdx == d.idx) { DevSpinCtrl.Value = i; } i++; } DevSpinCtrl.Focus = true; }
protected virtual void OnFilter() { OnSort(); listDevices.Clear(); List<DomoticzServer.Device> res = null; DeviceFilter F = new DeviceFilter(CurrentFilterBy); res = DevResponse.result.Where(x => F.Filter(x)).ToList(); if(DevResponse.result==null) { Log.Info("OnFilter() DevResponse.result NULL"); return; } foreach (DomoticzServer.Device dev in res) { AddListItem(dev); } }