Example #1
0
 protected void InitAttributeSet(IAttributeSet attrs)
 {
     for (int i = 0; i < attrs.AttributeCount; i++)
     {
         try
         {
             if (attrs.GetAttributeName(i) == "is_enabled")
             {
                 this.IsEnabled = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "is_name_visible")
             {
                 this.IsNameVisible = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "is_percent_visible")
             {
                 this.IsPercentVisible = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "is_value_visible")
             {
                 this.IsValueVisible = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "background_color")
             {
                 try
                 {
                     string value = attrs.GetAttributeValue(i);
                     var    color = Android.Graphics.Color.ParseColor(value);
                     this.BackgroundColor = new NGraphics.Color(color.R, color.G, color.B);
                 }
                 catch (Exception)
                 {
                 }
             }
             if (attrs.GetAttributeName(i) == "is_single_selectable")
             {
                 this.IsSingleSelectable = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "is_title_on_top")
             {
                 this.IsTitleOnTop = attrs.GetAttributeBooleanValue(i, true);
             }
             if (attrs.GetAttributeName(i) == "percent_color")
             {
                 try
                 {
                     string value = attrs.GetAttributeValue(i);
                     var    color = Android.Graphics.Color.ParseColor(value);
                     this.PercentColor = new NGraphics.Color(color.R, color.G, color.B);
                 }
                 catch (Exception)
                 {
                 }
             }
             if (attrs.GetAttributeName(i) == "text_color")
             {
                 try
                 {
                     string value = attrs.GetAttributeValue(i);
                     var    color = Android.Graphics.Color.ParseColor(value);
                     this.TextColor = new NGraphics.Color(color.R, color.G, color.B);
                 }
                 catch (Exception)
                 {
                 }
             }
             if (attrs.GetAttributeName(i) == "value_color")
             {
                 try
                 {
                     string value = attrs.GetAttributeValue(i);
                     var    color = Android.Graphics.Color.ParseColor(value);
                     this.ValueColor = new NGraphics.Color(color.R, color.G, color.B);
                 }
                 catch (Exception)
                 {
                 }
             }
             if (attrs.GetAttributeName(i) == "title_color")
             {
                 try
                 {
                     string value = attrs.GetAttributeValue(i);
                     var    color = Android.Graphics.Color.ParseColor(value);
                     this.TitleColor = new NGraphics.Color(color.R, color.G, color.B);
                 }
                 catch (Exception)
                 {
                 }
             }
             if (attrs.GetAttributeName(i) == "pull_ratio")
             {
                 this.PullRatio = attrs.GetAttributeFloatValue(i, 0.1f);
             }
             if (attrs.GetAttributeName(i) == "start_angle")
             {
                 this.StartAngle = attrs.GetAttributeFloatValue(i, 0.0f);
             }
             if (attrs.GetAttributeName(i) == "title")
             {
                 this.Title = attrs.GetAttributeValue(i);
             }
         }
         catch (Exception)
         {
         }
     }
 }