示例#1
0
 protected override IEnumerable <Suggestion> TryProvideSuggestions(BeginTagToken tagToken, AttributeToken attributeToken)
 {
     if (string.Equals(attributeToken.GetValue(), "server", StringComparison.CurrentCultureIgnoreCase))
     {
         yield return(new Suggestion()
         {
             Description = @"DotVVM doesn't need <code>runat=""server""</code> attributes.",
             Fixes = new[]
             {
                 new RemoveAttributeFix(tagToken, attributeToken)
             }
         });
     }
 }
        protected override IEnumerable <Suggestion> TryProvideSuggestions(BeginTagToken tagToken, AttributeToken attributeToken)
        {
            if (attributeToken.GetValue().StartsWith("{value"))
            {
                yield break;
            }

            var enabledProperty = tagToken.FindOrGenerateId() + "Enabled";

            yield return(new Suggestion()
            {
                Description = "Add viewmodel property to guide the <code>Enabled</code> state",
                Fixes = new FixAction[]
                {
                    new SetAttributeValueBindingFix(tagToken, "Enabled", enabledProperty),
                    new AddViewModelPropertyFix(enabledProperty, "bool")
                }
            });
        }