// initialize verb public override void Initialize(IComponent component) { base.Initialize(component); Verbs.Add(new System.ComponentModel.Design.DesignerVerb( "Edit Renderer...", new EventHandler(EditRenderer))); }
private void InitializeVerbs() { foreach (var prop in typeof(T).GetTypeInfo().GetProperties() .Where(p => p.GetCustomAttributes <VerbAttribute>().Any())) { foreach (var attr in prop.GetCustomAttributes <VerbAttribute>()) { // TODO deduplicate this Verb Name generation logic var verbName = attr.Name ?? prop.Name.ToLowerInvariant(); if (verbName.StartsWith( ArgumentPrefix.ToString())) { throw new ArgumentIntegrityException(String.Format( "Verb {0} cannot begin with {1}", verbName, ArgumentPrefix)); } if (Verbs.ContainsKey(verbName)) { throw new DuplicateArgumentException(verbName); } // TODO allow verb to use other configuration types? var parserConfigType = typeof(AttributeParserConfig <>) .GetTypeInfo() .MakeGenericType(new[] { prop.PropertyType }); var verbParserConfig = Activator.CreateInstance( type: parserConfigType, args: new object[] { Options, null /* TODO add triggers inside verb configs */, VerbFactory }); var verbConfigWrapperType = typeof(VerbParserConfig <>) .GetTypeInfo() .MakeGenericType(new[] { prop.PropertyType }); var config = (IVerbParserConfig)Activator.CreateInstance( type: verbConfigWrapperType, args: new[] { verbParserConfig, new PropertyValueStore(prop), Options, VerbFactory, new[] { verbName } }); config.Name = verbName; config.Description = attr.Description; if (Options.IncludeHelpTriggerInVerbs) { var helpWrapperType = typeof(AutomaticHelpGenerator <>) .GetTypeInfo() .MakeGenericType(new[] { prop.PropertyType }); var triggers = new[] { (IHelpGenerator)Activator.CreateInstance( type: helpWrapperType, args: new object[] { }) }; config.AppendTriggers(triggers); } // TODO optimize this a bit foreach (var innerVerb in config.Verbs.Values) { innerVerb.PrecursorVerbs = Enumerable.Repeat(verbName, 1).Concat(innerVerb.PrecursorVerbs).ToArray(); } Verbs.Add(verbName, config); } } }
public override void Initialize(IComponent component) { base.Initialize(component); _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); _changeService.ComponentRemoving += OnRemoving; Verbs.Add(new DesignerVerb("Add page", OnAddTabPage)); Verbs.Add(new DesignerVerb("Remove page", OnRemoveTabPage)); }
public override void Initialize(System.ComponentModel.IComponent component) { base.Initialize(component); //Design services changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); //Bind design events changeService.ComponentRemoving += new ComponentEventHandler(OnRemoving); Verbs.Add(new DesignerVerb("Add TabStrip", new EventHandler(OnAddTabStrip))); Verbs.Add(new DesignerVerb("Remove TabStrip", new EventHandler(OnRemoveTabStrip))); }
public override void Initialize(System.ComponentModel.IComponent component) { base.Initialize(component); /* Design services */ _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); /* Bind design events */ if (_changeService != null) { _changeService.ComponentRemoving += OnRemoving; } Verbs.Add(new DesignerVerb("Add TabStrip", OnAddTabStrip)); Verbs.Add(new DesignerVerb("Remove TabStrip", OnRemoveTabStrip)); }
public override void Initialize(IComponent component) { base.Initialize(component); //Design services changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); //Bind design events changeService.ComponentRemoving += OnRemoving; Verbs.Add(new DesignerVerb("Add TabStrip", OnAddTabStrip)); Verbs.Add(new DesignerVerb("Remove TabStrip", OnRemoveTabStrip)); }
private void InitializeVerbs() { foreach (var prop in typeof(T).GetProperties() .Where(p => p.GetCustomAttributes <VerbAttribute>().Any())) { foreach (var attr in prop.GetCustomAttributes <VerbAttribute>()) { var verbName = attr.Name ?? prop.Name; if (verbName.StartsWith( ArgumentPrefix.ToString(CultureInfo.InvariantCulture))) { throw new ArgumentIntegrityException(String.Format( "Verb {0} cannot begin with {1}", verbName, ArgumentPrefix)); } if (Verbs.ContainsKey(verbName)) { throw new DuplicateArgumentException(verbName); } var parserConfigType = typeof(AttributeParserConfig <>) .MakeGenericType(new[] { prop.PropertyType }); var parserConfig = Activator.CreateInstance( parserConfigType, new object[] { Options, null /* TODO add triggers inside verb configs */ }, null); // Verb's settings object // Object must have default constructor var obj = Activator.CreateInstance(prop.PropertyType); var contextType = typeof(ParsingContext <>) .MakeGenericType(new[] { prop.PropertyType }); var context = (IParsingContext)Activator.CreateInstance( contextType, new [] { obj, parserConfig }, null); var verbConfig = new VerbConfig { Context = context, Object = obj, Store = new PropertyValueStore(prop) }; Verbs.Add(verbName, verbConfig); } } }
protected static bool InsertVerb(VerbModel verb) { string query = string.Format(InsertSQL + "'{1}', '{2}', '{3}', '{4}', '{5}')", Model.Verb.ToDesc(), verb.Infinitive, verb.Past, verb.PastParticiple, verb.Person, verb.Gerund); if (!SendQuery(query)) { return(false); } var inserted = GetLast(Model.Verb.ToDesc()); Verbs.Add(inserted.Tables[0].AsEnumerable(). Select(GetDatarowVerbs()).First()); return(true); }
private void InitializeVerbs() { foreach (var prop in typeof(T).GetTypeInfo().GetProperties() .Where(p => p.GetCustomAttributes <VerbAttribute>().Any())) { foreach (var attr in prop.GetCustomAttributes <VerbAttribute>()) { // TODO deduplicate this Verb Name generation logic var verbName = attr.Name ?? prop.Name.ToLowerInvariant(); if (verbName.StartsWith( ArgumentPrefix.ToString())) { throw new ArgumentIntegrityException(String.Format( "Verb {0} cannot begin with {1}", verbName, ArgumentPrefix)); } if (Verbs.ContainsKey(verbName)) { throw new DuplicateArgumentException(verbName); } // TODO allow verb to use other configuration types? var parserConfigType = typeof(AttributeParserConfig <>) .GetTypeInfo() .MakeGenericType(new[] { prop.PropertyType }); var verbParserConfig = Activator.CreateInstance( type: parserConfigType, args: new object[] { Options, null /* TODO add triggers inside verb configs */, VerbFactory }); var verbConfigWrapperType = typeof(VerbParserConfig <>) .GetTypeInfo() .MakeGenericType(new[] { prop.PropertyType }); var config = (IVerbParserConfig)Activator.CreateInstance( type: verbConfigWrapperType, args: new[] { verbParserConfig, new PropertyValueStore(prop), Options, VerbFactory }); Verbs.Add(verbName, config); } } }
/// FORMAT AS PASTED FROM SPANISHDICT.COM /// /* TRANSITIVE VERB * 1. (to arrange) * a. to place * ... * b. to put * ... * c. to lay * ... * 2. (finance) * a. to place * ... * b. to invest * ... * 3. (to get somebody a job) */ public static Verb Factory(string[] parts) // from verb master table VerbTable.csv { //id,verbo 1,gerund 2,partpasado 3,irregular 4,tipo 5,reflexivo 6,comun 7, trad_en8 var v = new Verb(parts[1], parts[8]) { Gerund = parts[2], //present participle PastParticiple = parts[3], Irregular = parts[4] == "1", Reflexive = parts[6] == "1", Common = parts[7] == "1" }; _verbDict[v.Infinitive] = v; //Add this infinirive to SpanishDict also Verbs.Add(v); Word.Factory(v); return(v); }
public override void Initialize(IComponent component) { base.Initialize(component); Verbs.Add(new DesignerVerb("Remove Attributes", OnRemoveAttributes)); }
public override void Initialize(IComponent component) { base.Initialize(component); Verbs.Add(new DesignerVerb("Multiline", new EventHandler(OnMultilineChange))); }
public override void Initialize(IComponent component) { base.Initialize(component); Verbs.Add(new DesignerVerb("Multiline", (sender, e) => OnMultilineChange())); }
public override void Initialize(IComponent component) { base.Initialize(component); Verbs.Add(new DesignerVerb("Edit MyCustomAttribute text", OnEditText)); }
public TestEditor() { Verbs.Add(new DesignerVerb("Add button", Handler)); }