Пример #1
0
 /// <summary>
 /// Write the device configuration to the  ASCOM  Profile store
 /// </summary>
 internal void WriteProfile()
 {
     using (Profile driverProfile = new Profile())
     {
         driverProfile.DeviceType = "Camera";
         string cameraSettingsString = _settingsProvider.SaveSettings(CameraSettings);
         driverProfile.WriteValue(driverID, cameraSettingsProfileName, cameraSettingsString);
         ApiContainer.SetSettings(CameraSettings);
     }
 }
Пример #2
0
 /// <summary>
 /// Read the device configuration from the ASCOM Profile store
 /// </summary>
 private void ReadProfile()
 {
     using (Profile driverProfile = new Profile())
     {
         driverProfile.DeviceType = "Camera";
         string cameraSettingsString = driverProfile.GetValue(driverID, cameraSettingsProfileName, string.Empty, GetDefaultSettings());
         try
         {
             CameraSettings = _settingsProvider.ReadSettings(cameraSettingsString);
         }
         catch (Exception ex)
         {
             LogError(ErrorMessages.SettingsReadingError, ex);
         }
         ApiContainer.SetSettings(CameraSettings);
     }
 }
Пример #3
0
        /// <summary>
        /// Write the device configuration to the  ASCOM  Profile store
        /// </summary>
        internal void WriteProfile()
        {
            ApiContainer.SetSettings(CameraSettings);
            SetCameraSettings(ApiContainer.DslrCamera, CameraSettings);

            using (Profile driverProfile = new Profile())
            {
                var model = ApiContainer.DslrCamera.CameraModel;
                driverProfile.DeviceType = "Camera";
                if (model != null && !CameraSettings.CameraModelsHistory.Any(c => c.Name == model.Name))
                {
                    CameraSettings.CameraModelsHistory.Add(model);
                }
                string cameraSettingsString = _settingsProvider.SaveSettings(CameraSettings);
                driverProfile.WriteValue(driverID, cameraSettingsProfileName, cameraSettingsString);
                ApiContainer.SetSettings(CameraSettings);
            }
        }