public void Load() { if (File.Exists(_userDataFile)) { using (StreamReader sr = new StreamReader(_userDataFile)) { try { System.Xml.Serialization.XmlSerializer xml = new System.Xml.Serialization.XmlSerializer(typeof(TaskbarProperties)); Properties = xml.Deserialize(sr) as TaskbarProperties; } catch { // properties file may be corrupt, ignore it } } UpgradeRulesFromDualMonitorVersion(Properties); } else { Properties.SmallIcons = RegistryProxy.GetKey <int>("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\", "TaskbarSmallIcons") != 0; Properties.ShowLabels = RegistryProxy.GetKey <int>("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\", "TaskbarGlomLevel") != 0; } }
/// <summary> /// Returns whether auto start is enabled. /// </summary> /// <param name="keyName">Registry Key Name</param> /// <param name="assemblyLocation">Assembly location (e.g. Assembly.GetExecutingAssembly().Location)</param> public static bool IsAutoStartEnabled() { string value = RegistryProxy.GetKey <string>(RunLocation, KeyName); if (value == null) { return(false); } return(string.Equals(value, Application.ExecutablePath, StringComparison.OrdinalIgnoreCase)); }
/// <summary> /// Unsets the autostart value for the assembly. /// </summary> /// <param name="keyName">Registry Key Name</param> public static void UnSetAutoStart() { RegistryProxy.DeleteKey(RunLocation, KeyName); }
/// <summary> /// Sets the autostart value for the assembly. /// </summary> /// <param name="keyName">Registry Key Name</param> /// <param name="assemblyLocation">Assembly location (e.g. Assembly.GetExecutingAssembly().Location)</param> public static void SetAutoStart() { string assemblyLocation = Application.ExecutablePath; RegistryProxy.SetKey(RunLocation, KeyName, assemblyLocation); }