using ExcelDna.Integration.CustomUI; namespace ExcelAddIn.Tools; public static class ToolFactory { public static Tool GetTool(IRibbonControl control) { return control.Id switch { "Button1" => new Button1Tool(), "Button2" => new Button2Tool(), "Button3" => new Button3Tool(), _ => throw new NotImplementedException(control.Id) }; } }