public static Serial.WaitType GetWaitType(string p_Name, Serial.WaitType p_DefaultValue)
        {
            RegistryKey currentUser = Registry.CurrentUser;

            currentUser.CreateSubKey("Software\\ASCOM\\Utilities");
            RegistryKey registryKey = currentUser.OpenSubKey("Software\\ASCOM\\Utilities", true);

            Serial.WaitType waitType = Serial.WaitType.Sleep;
            try
            {
                if (registryKey.GetValueKind(p_Name) == RegistryValueKind.String)
                {
                    waitType = (Serial.WaitType)Conversions.ToInteger(Enum.Parse(typeof(Serial.WaitType), registryKey.GetValue(p_Name).ToString()));
                }
            }
            catch (IOException ex1)
            {
                //ProjectData.SetProjectError((Exception) ex1);
                try
                {
                    RegistryCommonCode.SetName(p_Name, p_DefaultValue.ToString());
                    waitType = p_DefaultValue;
                }
                catch (Exception ex2)
                {
                    //ProjectData.SetProjectError(ex2);
                    waitType = p_DefaultValue;
                    //ProjectData.ClearProjectError();
                }
                //ProjectData.ClearProjectError();
            }
            catch (Exception ex)
            {
                //ProjectData.SetProjectError(ex);
                waitType = p_DefaultValue;
                //ProjectData.ClearProjectError();
            }
            registryKey.Flush();
            registryKey.Close();
            currentUser.Flush();
            currentUser.Close();
            return(waitType);
        }
Ejemplo n.º 2
0
 public static Serial.WaitType GetWaitType(string p_Name, Serial.WaitType p_DefaultValue)
 => cbase.GetWaitType(p_Name, p_DefaultValue);
Ejemplo n.º 3
0
 public Serial.WaitType GetWaitType(string p_Name, Serial.WaitType p_DefaultValue)
 => GetEnum(null, null, p_Name, p_DefaultValue);
Ejemplo n.º 4
0
 public Serial.WaitType GetWaitType(string sysName, string userName, string p_Name, Serial.WaitType p_DefaultValue)
 => GetEnum(sysName, userName, p_Name, p_DefaultValue);