public static TelescopeSettings FromProfile()
        {
            string telescopeID;
            bool   loggerEnabled;
            double fastUpdatePeriod;

            using (Profile profile = new Profile())
            {
                profile.DeviceType = "Telescope";
                telescopeID        = profile.GetValue(DriverID, _telescopeIDProfileName, String.Empty, _telescopeIDDefault);
                loggerEnabled      = Convert.ToBoolean(profile.GetValue(DriverID, _traceStateProfileName, String.Empty, _traceStateDefault));
                fastUpdatePeriod   = Convert.ToDouble(profile.GetValue(DriverID, _fastUpdateProfileName, String.Empty, _fastUpdateDefault));
            }

            // Prevent the user from circumventing the valid fast update period range by setting the profile directly.

            fastUpdatePeriod = Math.Max(Globals.SCOPE_FAST_UPDATE_MIN, Math.Min(fastUpdatePeriod, Globals.SCOPE_FAST_UPDATE_MAX));

            TelescopeSettings settings = new TelescopeSettings
            {
                TelescopeID      = telescopeID,
                IsLoggingEnabled = loggerEnabled,
                FastUpdatePeriod = fastUpdatePeriod
            };

            return(settings);
        }
        private void SaveTelescopeSettings()
        {
            // Read the current settings and update them with the changes
            // to preserve the logging flag.

            TelescopeSettings settings = TelescopeSettings.FromProfile();

            settings.TelescopeID = TelescopeManager.TelescopeID;
            settings.ToProfile();
        }
Esempio n. 3
0
        private static void LoadDeviceSettings()
        {
            TelescopeSettings scopeSettings = TelescopeSettings.FromProfile();

            TelescopeManager.SetTelescopeID(scopeSettings.TelescopeID);

            DomeSettings domeSettings = DomeSettings.FromProfile();

            DomeManager.SetDomeID(domeSettings.DomeID);
            Globals.DomeLayout                  = domeSettings.DomeLayout;
            Globals.DomeAzimuthAdjustment       = domeSettings.AzimuthAdjustment;
            Globals.UsePOTHDomeSlaveCalculation = domeSettings.UsePOTHDomeSlaveCalculation;
            Globals.FindDomeHomeAtStartup       = domeSettings.FindDomeHomeAtStartup;
            FocuserSettings focuserSettings = FocuserSettings.FromProfile();

            FocuserManager.SetFocuserID(focuserSettings.FocuserID);
            Globals.FocuserTemperatureOffset = focuserSettings.TemperatureOffset;
        }
		public static TelescopeSettings FromProfile()
		{
			string telescopeID;
			bool loggerEnabled;

			using ( Profile profile = new Profile() )
			{
				profile.DeviceType = "Telescope";
				telescopeID = profile.GetValue( DriverID, _telescopeIDProfileName, string.Empty, _telescopeIDDefault );
				loggerEnabled = Convert.ToBoolean( profile.GetValue( DriverID, _traceStateProfileName, string.Empty, _traceStateDefault ) );
			}

			TelescopeSettings settings = new TelescopeSettings
			{
				TelescopeID = telescopeID,
				IsLoggingEnabled = loggerEnabled
			};

			return settings;
		}