public void Test() { var source = new Source(); Subscribe(source); source.AddItem(12); source.RemoveItem(1); Unsubscribe(source); source.AddItem(12); }
Source areaControl_GetSource(string arg) { if (toolStripDictionary.ContainsKey(arg)) { CustomToolStripMenuItem ctsmi = toolStripDictionary[arg]; PreProcessDumper(ctsmi.Dumper); var source = new Source(ctsmi.Dumper.AssemblyAndType) { Name = ctsmi.Dumper.SourceName, FullName = ctsmi.Dumper.FullName, ToolTip = $"({ctsmi.Dumper.SourceName})\n{ctsmi.Dumper.FlowToolTipText}", Warning = ctsmi.Dumper.Warning }; foreach (Item item in ctsmi.Dumper.InEvents.Concat(ctsmi.Dumper.OutEvents.Concat(ctsmi.Dumper.InProperties.Concat(ctsmi.Dumper.OutProperties)))) { source.AddItem(item.Clone()); } foreach (KeyValuePair <string, AssemblyAndTypeAndSource[]> asms in sourceCache.Where(p => p.Key == ctsmi.Dumper.SourceName)) { foreach (AssemblyAndTypeAndSource asm in asms.Value) { source.AddSameNameSource(asm.AssemblyAndType); } } return(source); } return(null); }
/// <summary> /// Create push button on the panel /// </summary> /// <param name="name">Internal name of the button</param> /// <param name="text">Text user will see</param> /// <param name="externalCommandType">Class which implements IExternalCommand interface. /// This command will be execute when user push the button</param> /// <param name="action">Additional action with whe button</param> /// <returns>Panel where button were created</returns> public Panel CreateButton(string name, string text, Type externalCommandType, Action <Button> action) { var button = new Button(name, text, externalCommandType); action?.Invoke(button); RibbonItemData buttonData = button.Finish(); Source.AddItem(buttonData); return(this); }
public Panel CreatePullDownButton(string name, string text, Action <PulldownButton> action) { var button = new PulldownButton(name, text, nameConvention); action?.Invoke(button); RibbonItemData buttonData = button.Finish(); var ribbonItem = Source.AddItem(buttonData) as Autodesk.Revit.UI.PulldownButton; button.BuildButtons(ribbonItem); return(this); }