Example #1
0
        public static List <IFilterWheel> GetFilterWheels(IProfileService profileService)
        {
            var l = new List <IFilterWheel>();

            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("FilterWheel"))
                {
                    try {
                        AscomFilterWheel fw = new AscomFilterWheel(device.Key, device.Value);
                        l.Add(fw);
                    } catch (Exception) {
                        //only add filter wheels which are supported. e.g. x86 drivers will not work in x64
                    }
                }
                return(l);
            }
        }
Example #2
0
        private void GetFilterWheels()
        {
            using (var ascomDevices = new ASCOM.Utilities.Profile()) {
                foreach (ASCOM.Utilities.KeyValuePair device in ascomDevices.RegisteredDevices("FilterWheel"))
                {
                    try {
                        AscomFilterWheel cam = new AscomFilterWheel(device.Key, device.Value);
                        Devices.Add(cam);
                    } catch (Exception) {
                        //only add filter wheels 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.FilterWheelSettings.Id select device).First();
                    SelectedDevice = selected;
                }
            }
        }