Enable the System build for monodroid
[mono.git] / mcs / class / System / System.Diagnostics / BooleanSwitch.cs
old mode 100755 (executable)
new mode 100644 (file)
index d826c7a..30c7614
@@ -28,6 +28,7 @@
 // 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
 {
@@ -35,6 +36,9 @@ 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>
@@ -45,6 +49,16 @@ namespace System.Diagnostics
                {
                }
 
+#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>
@@ -55,6 +69,17 @@ namespace System.Diagnostics
                                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
        }
 }