private void Remove(ISensor sensor, bool deleteConfig) { if (deleteConfig) { settings.Remove( new Identifier(sensor.Identifier, "tray").ToString()); settings.Remove( new Identifier(sensor.Identifier, "traycolor").ToString()); } SensorNotifyIcon instance = null; foreach (SensorNotifyIcon icon in list) { if (icon.Sensor == sensor) { instance = icon; } } if (instance != null) { list.Remove(instance); UpdateMainIconVisibilty(); instance.Dispose(); } }
public void DeleteFromSettings() { settings.Remove(new Identifier(identifier, "name").ToString()); settings.Remove(new Identifier(identifier, "controlled").ToString()); settings.Remove(new Identifier(identifier, "enabled").ToString()); settings.Remove(new Identifier(identifier, "valueString").ToString()); settings.Remove(new Identifier(identifier, "hysteresis").ToString()); settings.Remove(new Identifier(identifier, "curve", "values").ToString()); settings.Remove(new Identifier(identifier, "sourceSensor").ToString()); settings.Remove(new Identifier(identifier, "inputSource").ToString()); }
public bool RemoveSensorString(int id) { if (text.Count == 1) { return(false); } // Update IDs for all following SensorStrings for (int i = text.Count - 1; i > id; i--) { settings.SetValue(new Identifier(identifier, i - 1 + "", "text").ToString(), text[i].Input); } text.RemoveAt(id); settings.Remove(new Identifier(identifier, text.Count + "", "text").ToString()); if (curText >= id) { curText--; } return(true); }