本文整理汇总了C#中Profile.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Profile.GetValue方法的具体用法?C# Profile.GetValue怎么用?C# Profile.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setupFocuserCommunicator
private static void setupFocuserCommunicator()
{
// Make sure any old eventListeners are disconnected
try
{
focuserCommunicator.HubInfoReceived -= new EventHandler(parseHubInfo);
focuserCommunicator.FirmwareErrorOccurred -= new EventHandler(focuserCommunicator_FirmwareErrorOccurred);
focuserCommunicator.FocConfigReceived -= new EventHandler(instance1.parseConfigData);
focuserCommunicator.RotConfigReceived -= new EventHandler(instance2.parseConfigData);
focuserCommunicator.FocStatusReceived -= new EventHandler(instance1.parseStatusData);
focuserCommunicator.RotStatusReceived -= new EventHandler(instance2.parseStatusData);
EventLogger.LogMessage("Successfully removed event listeners in HubFocuser class", TraceLevel.Info);
}
catch { }
// Make sure any old focuser communicator is disconnected
try { if (focuserCommunicator != null) focuserCommunicator.DisconnectAndNullify(); }
catch { }
// Set the old focuser communicator to null
try{focuserCommunicator = null;}
catch { }
// Create the new focuser Communicator based on the connectionMethod value
Profile p = new Profile();
p.DeviceType = "Focuser";
string cpName = p.GetValue(pDriverID, pCOMPortName, "", "COM1");
string ipAddr = p.GetValue(pDriverID, pIPAddress, "", "192.168.1.100");
switch (connectionMethod)
{
default:
case ConnectionMethods.Serial:
focuserCommunicator = new SerialCommunicatorAsync(cpName);
break;
case ConnectionMethods.WiredEthernet:
string tcpipPortNumber = pWiredEthPort;
focuserCommunicator = new EthernetCommunicatorAsync(ipAddr, tcpipPortNumber);
break;
case ConnectionMethods.WiFi:
string tcpipPortNumberW = pWiFiEthPort;
focuserCommunicator = new EthernetCommunicatorAsync(ipAddr, tcpipPortNumberW);
break;
}
// Add the new event listeners
focuserCommunicator.HubInfoReceived += new EventHandler(parseHubInfo);
focuserCommunicator.FirmwareErrorOccurred += new EventHandler(focuserCommunicator_FirmwareErrorOccurred);
focuserCommunicator.FocConfigReceived += new EventHandler(instance1.parseConfigData);
focuserCommunicator.RotConfigReceived += new EventHandler(instance2.parseConfigData);
focuserCommunicator.FocStatusReceived += new EventHandler(instance1.parseStatusData);
focuserCommunicator.RotStatusReceived += new EventHandler(instance2.parseStatusData);
EventLogger.LogMessage("Successfully added event listeners in HubFocuser class", TraceLevel.Info);
}
示例2: connect
public void connect(string driverID)
{
// DMW connect to the device
// get the port name from the profile
string portName;
using (ASCOM.Utilities.Profile p = new Profile())
{
p.DeviceType = "Focuser";
portName = p.GetValue(driverID, "ComPort");
}
if (string.IsNullOrEmpty(portName))
{
throw new ASCOM.NotConnectedException("No COM Port Selected");
}
// try to connect to port
try
{
serialPort = new Serial();
serialPort.PortName = portName;
serialPort.Speed = SerialSpeed.ps9600;
serialPort.StopBits = SerialStopBits.One;
serialPort.ReceiveTimeout = 15;
serialPort.Connected = true;
}
catch (Exception ex)
{
throw new ASCOM.NotConnectedException("Serial Port Connection error", ex);
}
System.Threading.Thread.Sleep(2000); // Wait 2s for connection to settle
}
示例3: HubFocRot
static HubFocRot()
{
// Get the connections settings from profile.
EventLogger.LogMessage("Constructing STATIC HubFocuser class.", System.Diagnostics.TraceLevel.Info);
Profile p = new Profile();
p.DeviceType = "Focuser";
PopulateFocuserTypes();
Trace.WriteLine("Setting connection method");
connectionMethod = (ConnectionMethods)Enum.Parse(typeof(ConnectionMethods),
p.GetValue(pDriverID, pConnMeth, "", ConnectionMethods.Serial.ToString()));
Trace.WriteLine("Finished setting connection method");
//// Add note to inform users that the second profile item is not used to hold settings...
//string msg = "This profile item is not used to store any settings. It's only purpose is to link " +
// " the Gemini Focuser 2, shown in the chooser, to a ProgID used for COM object creation.";
//p.WriteValue(pUnusedDriverID, "Note:", msg);
// Initialize the hubFocusers
instance1 = new HubFocRot(FOC_ROT_DEVICE.FOC);
instance2 = new HubFocRot(FOC_ROT_DEVICE.ROT);
setupFocuserCommunicator();
}
示例4: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Camera";
traceState = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));
gainState = Convert.ToInt16(driverProfile.GetValue(driverID, gainStateProfileName, string.Empty, gainStateDefault));
offsetState = Convert.ToInt16(driverProfile.GetValue(driverID, offsetStateProfileName, string.Empty, offsetStateDefault));
onTopState = Convert.ToBoolean(driverProfile.GetValue(driverID, onTopStateProfileName, string.Empty, onTopStateDefault));
coolerEnabledState = Convert.ToBoolean(driverProfile.GetValue(driverID, coolerEnabledStateProfileName, string.Empty, coolerEnabledStateDefault));
coolerComPortState = driverProfile.GetValue(driverID, coolerComPortStateProfileName, string.Empty, coolerComPortStateDefault);
baudrateAdjustState = Convert.ToInt16(driverProfile.GetValue(driverID, baudrateAdjustStateProfileName, string.Empty, baudrateAdjustStateDefault));
}
}
示例5: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Dome";
traceState = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));
comPort = driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
}
}
示例6: readSettings
/// <summary>
/// Read settings from ASCOM profile storage
/// </summary>
public void readSettings()
{
tl.LogMessage("Switch_readSettings", "Enter");
using (ASCOM.Utilities.Profile p = new Profile())
{
//System.Collections.ArrayList T = p.RegisteredDeviceTypes;
p.DeviceType = "Switch";
//General settings
try
{
ip_addr = p.GetValue(IP9212_switch_id, ip_addr_profilename, string.Empty, ip_addr_default);
}
catch (Exception e)
{
//p.WriteValue(driverID, ip_addr_profilename, ip_addr_default);
ip_addr = ip_addr_default;
tl.LogMessage("readSettings", "Wrong input string for [ip_addr]: [" + e.Message + "]");
}
try
{
ip_port = p.GetValue(IP9212_switch_id, ip_port_profilename, string.Empty, ip_port_default);
}
catch (Exception e)
{
//p.WriteValue(driverID, ip_port_profilename, ip_port_default);
ip_port = ip_port_default;
tl.LogMessage("readSettings", "Wrong input string for [ip_port]: [" + e.Message + "]");
}
try
{
ip_login = p.GetValue(IP9212_switch_id, ip_login_profilename, string.Empty, ip_login_default);
}
catch (Exception e)
{
//p.WriteValue(driverID, ip_login_profilename, ip_login_default);
ip_login = ip_login_default;
tl.LogMessage("readSettings", "Wrong input string for [ip_login]: [" + e.Message + "]");
}
try
{
ip_pass = p.GetValue(IP9212_switch_id, ip_pass_profilename, string.Empty, ip_pass_default);
}
catch (Exception e)
{
//p.WriteValue(driverID, ip_pass_profilename, ip_pass_default);
ip_pass = ip_pass_default;
tl.LogMessage("readSettings", "Wrong input string for [ip_pass]: [" + e.Message + "]");
}
try
{
switch_roof_port = Convert.ToInt16(p.GetValue(IP9212_switch_id, switch_port_profilename, string.Empty, switch_port_default));
}
catch (Exception e)
{
switch_roof_port = Convert.ToInt16(switch_port_default);
tl.LogMessage("Switch_readSettings", "Input string [switch_roof_port] is not a sequence of digits [" + e.Message + "]");
//ASCOM_ERROR_MESSAGE = "Switch_readSettings(): [switch_roof_port] is not a numeric value";
//throw new ASCOM.InvalidValueException(ASCOM_ERROR_MESSAGE);
}
try
{
opened_sensor_port = Convert.ToInt16(p.GetValue(IP9212_switch_id, opened_port_profilename, string.Empty, opened_port_default));
}
catch (Exception e)
{
opened_sensor_port = Convert.ToInt16(opened_port_default);
tl.LogMessage("Switch_readSettings", "Input string [opened_sensor_port] is not a sequence of digits [" + e.Message + "]");
//ASCOM_ERROR_MESSAGE = "Switch_readSettings(): [opened_sensor_port] is not a numeric value";
//throw new ASCOM.InvalidValueException(ASCOM_ERROR_MESSAGE);
}
try
{
closed_sensor_port = Convert.ToInt16(p.GetValue(IP9212_switch_id, closed_port_profilename, string.Empty, closed_port_default));
}
catch (Exception e)
{
closed_sensor_port = Convert.ToInt16(closed_port_default);
tl.LogMessage("Switch_readSettings", "Input string [closed_sensor_port] is not a sequence of digits [" + e.Message + "]");
//ASCOM_ERROR_MESSAGE = "Switch_readSettings(): [closed_sensor_port] is not a numeric value";
//throw new ASCOM.InvalidValueException(ASCOM_ERROR_MESSAGE);
}
try
{
switch_port_state_type = Convert.ToBoolean(p.GetValue(IP9212_switch_id, switch_port_state_type_profilename, string.Empty, switch_port_state_type_default));
}
catch (Exception e)
{
switch_port_state_type = Convert.ToBoolean(switch_port_state_type_default);
tl.LogMessage("Switch_readSettings", "Input string [switch_port_state_type] is not a boolean value [" + e.Message + "]");
//ASCOM_ERROR_MESSAGE = "Switch_readSettings(): [switch_port_state_type] is not a boolean value";
//throw new ASCOM.InvalidValueException(ASCOM_ERROR_MESSAGE);
}
//.........这里部分代码省略.........
示例7: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = this.deviceType;
traceState = Convert.ToBoolean(driverProfile.GetValue(this.driverId, traceStateProfileName, string.Empty, traceStateDefault));
tcpPort = -1;
try
{
tcpPort = int.Parse(driverProfile.GetValue(this.driverId, tcpPortProfileName, string.Empty, tcpPortDefault));
}
catch
{
}
}
}
示例8: GetTempOffset
public string GetTempOffset()
{
Profile p = new Profile();
p.DeviceType = "Focuser";
return p.GetValue(FocusLynx.SharedResources.SharedProfileDriverID, "Focuser-" + this.focuserNumber.ToString() + " Temp Offset", "", "0");
}
示例9: ReadStringFromProfile
internal String ReadStringFromProfile(Profile driverProfile, String profileName, String defaultValue)
{
return driverProfile.GetValue(driverID, profileName, string.Empty, defaultValue);
}
示例10: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Video";
m_traceState = Convert.ToBoolean(driverProfile.GetValue(m_driverID, m_traceStateProfileName, string.Empty, m_traceStateDefault));
m_ccdDriverProgId = driverProfile.GetValue(m_driverID, m_ccdDriverProgIdProfileName, string.Empty, string.Empty);
}
}
示例11: Dome
/// <summary>
/// Initializes a new instance of the <see cref="Arduino"/> class.
/// Must be public for COM registration.
/// </summary>
public Dome()
{
ReadProfile(); // Read device configuration from the ASCOM Profile store
tl = new TraceLogger("", "Arduino");
tl.Enabled = traceState;
tl.LogMessage("Doem", "Starting Dome");
tl.LogMessage("Dome", "Setting Chooser Form");
try
{
SetupDialog();
}
catch (Exception ex)
{
if (ex.Message.Contains("Cancel")) return;
else throw ex;
}
tl.LogMessage("Dome", "Starting initialisation");
connectedState = false; // Initialise connected to false
utilities = new Util(); //Initialise util object
astroUtilities = new AstroUtils(); // Initialise astro utilities object
//TODO: Implement your additional construction here
using (Profile p = new Profile())
{
p.DeviceType = "Dome";
comPort = p.GetValue(driverID, "comPort");
_arduino = new ArduinoDome(comPort, isArduinoBootLoader);
}
RegisterASCOM((Type)null);
_position = 0.0;
Parked = true;
ParkPosition = 0.0;
IsSlewing = false;
Threshold = 2.0;
connectedState = false;
// Braking = 0.0;
DomeTimer = new System.Windows.Threading.DispatcherTimer();
DomeTimer.Interval = TimeSpan.FromSeconds(3);//new TimeSpan(0, 0, 3);
DomeTimer.Tick += DomeTimer_Tick;
DomeTimer.IsEnabled = true;
DomeTimer.Stop();
slewThread.WorkerReportsProgress = true;
slewThread.WorkerSupportsCancellation = true;
slewThread.DoWork += new DoWorkEventHandler(slewThread_Body);
slewThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(slewThread_Completed);
//slewThread.DoWork += slewThread_Body;
//slewThread.RunWorkerCompleted += slewThread_Completed;
tl.LogMessage("Dome", "Completed initialisation");
}
示例12: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Camera";
traceState = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));
gainState = Convert.ToInt16(driverProfile.GetValue(driverID, gainStateProfileName, string.Empty, gainStateDefault));
offsetState = Convert.ToInt16(driverProfile.GetValue(driverID, offsetStateProfileName, string.Empty, offsetStateDefault));
onTopState = Convert.ToBoolean(driverProfile.GetValue(driverID, onTopStateProfileName, string.Empty, onTopStateDefault));
slowCoolingEnabledState = Convert.ToBoolean(driverProfile.GetValue(driverID, slowCoolingEnabledProfileName, string.Empty, slowCoolingEnabledStateDefault));
slowCoolingSpeedState = Convert.ToInt16(driverProfile.GetValue(driverID, slowCoolingSpeedProfileName, string.Empty, slowCoolingSpeedStateDefault));
}
}
示例13: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Focuser";
traceState = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));
comPort = driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
TempCoeff = Convert.ToInt16(driverProfile.GetValue(driverID, TempCoeffProfileName, string.Empty, TempCoeffDefault));
TempCompEnabled = Convert.ToBoolean(driverProfile.GetValue(driverID, TempCompEnabledProfileName, string.Empty, TempCompEnabledDefault));
MaxVel = Convert.ToDouble(driverProfile.GetValue(driverID, MaxVelProfileName, string.Empty, MaxVelDefault));
Accel = Convert.ToDouble(driverProfile.GetValue(driverID, AccelProfileName, string.Empty, AccelDefault));
IdleOff = Convert.ToBoolean(driverProfile.GetValue(driverID, IdleOffProfileName, string.Empty, IdleOffDefault));
Reverse = Convert.ToBoolean(driverProfile.GetValue(driverID, ReverseProfileName, string.Empty, ReverseDefault));
Home = Convert.ToBoolean(driverProfile.GetValue(driverID, HomeProfileName, string.Empty, HomeDefault));
InvertHome = Convert.ToBoolean(driverProfile.GetValue(driverID, InvertHomeProfileName, string.Empty, InvertHomeDefault));
HomeDirection = Convert.ToBoolean(driverProfile.GetValue(driverID, HomeDirectionProfileName, string.Empty, HomeDirectionDefault));
HomeVel = Convert.ToDouble(driverProfile.GetValue(driverID, HomeVelProfileName, string.Empty, HomeVelDefault));
HomeUseSwitch = Convert.ToBoolean(driverProfile.GetValue(driverID, HomeUseSwitchProfileName, string.Empty, HomeUseSwitchDefault));
HomeDistance = Convert.ToInt32(driverProfile.GetValue(driverID, HomeDistanceProfileName, string.Empty, HomeDistanceDefault));
HomePosition = Convert.ToInt32(driverProfile.GetValue(driverID, HomePositionProfileName, string.Empty, HomePositionDefault));
}
}
示例14: GetTempCoeffName
public string GetTempCoeffName(char index)
{
if (index < 'A' || index > 'E')
{
throw new ApplicationException("GetTempCoeffName requires a mode parameter between 'A' and 'E'");
}
Profile p = new Profile();
p.DeviceType = "Focuser";
return p.GetValue(Gemini.SharedResources.SharedProfileDriverID, "Focuser Temp Coeff Name " + index, "", "Mode " + index);
}
示例15: ReadProfile
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
using (Profile driverProfile = new Profile())
{
driverProfile.DeviceType = "Telescope";
traceState = Convert.ToBoolean(driverProfile.GetValue(driverID, traceStateProfileName, string.Empty, traceStateDefault));
comPort = driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
//driverProfile.CreateSubKey(driverID, "Capabilities");
//driverProfile.WriteValue(driverID, "testName", "testValue");
//driverProfile.WriteValue(driverID, "SubkeytestName", "SubkeytestValue", "Capabilities");
//driverProfile.GetValue(driverID, "CanSlewAltAz", "Capabilities", CanSlewAltAz.ToString());
driverProfile.GetValue(driverID, siteElevationProfileName, string.Empty, siteElevationDefault);
driverProfile.GetValue(driverID, siteLatitudeProfileName, string.Empty, siteLatitudeDefault);
driverProfile.GetValue(driverID, siteLongitudeProfileName, string.Empty, siteLongitudeDefault);
driverProfile.GetValue(driverID, "CanSlewAltAz", "Capabilities", "false");
//driverProfile.GetValue(driverID, "CanSlewAltAz", "Capabilities", CanSlewAltAz.ToString());
//String tempstring = AlignmentMode.ToString();
driverProfile.GetValue(driverID, "AlignmentMode", string.Empty, "0");
}
}