public static List <ITelescope> GetTelescopes(IProfileService profileService) { var l = new List <ITelescope>(); using (var ascomDevices = new ASCOM.Utilities.Profile()) { foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Telescope")) { try { AscomTelescope telescope = new AscomTelescope(device.Key, device.Value, profileService); l.Add(telescope); } catch (Exception) { //only add telescopes which are supported. e.g. x86 drivers will not work in x64 } } return(l); } }
private void GetTelescopes() { using (var ascomDevices = new ASCOM.Utilities.Profile()) { foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("Telescope")) { try { AscomTelescope cam = new AscomTelescope(device.Key, device.Value, profileService); Devices.Add(cam); } catch (Exception) { //only add telescopes which are supported. e.g. x86 drivers will not work in x64 } } if (Devices.Count > 0) { var selected = (from device in Devices where device.Id == profileService.ActiveProfile.TelescopeSettings.Id select device).First(); SelectedDevice = selected; } } }