// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Globalization;
namespace System.Diagnostics
{
/// Provides a simple on/off switch that controls debugging
/// and tracing output
/// </summary>
+#if NET_2_0
+ [SwitchLevel (typeof (bool))]
+#endif
public class BooleanSwitch : Switch
{
/// <summary>
{
}
+#if NET_2_0
+ /// <summary>
+ /// Initializes a new instance
+ /// </summary>
+ public BooleanSwitch(string displayName, string description, string defaultSwitchValue)
+ : base(displayName, description, defaultSwitchValue)
+ {
+ }
+#endif
+
/// <summary>
/// Specifies whether the switch is enabled or disabled
/// </summary>
SwitchSetting = Convert.ToInt32(value);
}
}
+
+#if NET_2_0
+ protected override void OnValueChanged ()
+ {
+ int i;
+ if (int.TryParse (Value, out i))
+ Enabled = i != 0;
+ else
+ Enabled = Convert.ToBoolean (Value);
+ }
+#endif
}
}