private void Bridge_BridgeNotResponding(object sender, BridgeNotRespondingEventArgs e) { e.Bridge.BridgeNotResponding -= Bridge_BridgeNotResponding; MessageBox.Show(GlobalStrings.Error_Bridge_Not_Responding, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error); log.Error($"{sender}"); log.Error(Serializer.SerializeJsonObject(e.Exception.ToString())); log.Error($"{sender} : {e}"); Cursor_Tools.ShowNormalCursor(); e.Bridge.BridgeNotResponding += Bridge_BridgeNotResponding; }
public async Task RefreshCurrentListHueObject() { if (SelectedBridge == null) { return; } Cursor_Tools.ShowWaitCursor(); SelectedObject = null; if (!SelectedBridge.Virtual) { log.Info($"Getting list of objects from bridge at {SelectedBridge.IpAddress}."); List <IHueObject> hr = await SelectedBridge.GetAllObjectsAsync(false, true); if (hr != null) { List <IHueObject> listobj = hr; ObservableCollection <IHueObject> newlist = new ObservableCollection <IHueObject>(); switch (WinHueSettings.settings.Sort) { case WinHueSortOrder.Default: CurrentBridgeHueObjectsList = new ObservableCollection <IHueObject>(hr); break; case WinHueSortOrder.Ascending: newlist.AddRange(from item in listobj where item is Light orderby item.name select item); newlist.AddRange(from item in listobj where item is Group orderby item.name select item); newlist.AddRange(from item in listobj where item is Schedule orderby item.name select item); newlist.AddRange(from item in listobj where item is Scene orderby item.name select item); newlist.AddRange( from item in listobj where item is Sensor orderby item.name select item); newlist.AddRange(from item in listobj where item is Rule orderby item.name select item); newlist.AddRange(from item in listobj where item is Resourcelink orderby item.name select item); CurrentBridgeHueObjectsList = new ObservableCollection <IHueObject>(newlist); break; case WinHueSortOrder.Descending: newlist.AddRange(from item in listobj where item is Light orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Group orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Schedule orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Scene orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Sensor orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Rule orderby item.name descending select item); newlist.AddRange(from item in listobj where item is Resourcelink orderby item.name descending select item); CurrentBridgeHueObjectsList = new ObservableCollection <IHueObject>(newlist); break; default: goto case WinHueSortOrder.Default; } CreateExpanders(); } else { CurrentBridgeHueObjectsList = new ObservableCollection <IHueObject>(); log.Info("Bridge update required. Please update the bridge to use WinHue with this bridge."); } } else { log.Info("Virtual Bridge detected. Will skip refresh."); } Cursor_Tools.ShowNormalCursor(); }