I'm having a little bit of difficulty understanding what you're trying to describe, it would be easier if you shared the code that you were talking about.
But I think you're just trying to have multiple buttons? If that's the case the general flow is that you have:
1. a class that implements IExternalApplication (i.e. has OnStartup, and OnShutdown methods). In your OnStartup method, you would add your ribbon buttons, and associate each one with a different class that implements IExternalCommand.
2. A different class that implements IExternalCommand (i.e. has an Execute method), for each button. When someone clicks on a ribbon button, it looks for that class and runs the Execute method.
3. Each of these Execute methods is passed some information about the current context (current active revit model, etc.) and you can choose to use this if you want. If you're just trying to edit an XML file you can ignore that context, and regardless you'd put the code for editing that XML file in there, or atleast call the code that does the XML editing from there.
Example Manifest:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>AddinTemplate</Name>
<!-- Assumes your .dll isn't in the top level Addins folder but
is in a sub folder called DefaultProjectNameFiles -->
<Assembly>DefaultProjectNameFiles/DefaultProjectName.dll</Assembly>
<AddInId> [GUID Goes Here] </AddInId>
<FullClassName>RibbonButtons</FullClassName>
<VendorId>MyComp</VendorId>
<VendorDescription>MyComp</VendorDescription>
</AddIn>
</RevitAddIns>
Then in your DefaultProjectName project, you'd have a file with a class called "RibbonButtons" that adds your ribbon buttons:
namespace DefaultProjectName.App.RevitApp
{
public class RibbonButtons : IExternalApplication
{
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
public Result OnStartup(UIControlledApplication application)
{
AddRibbonButtons(application);
return Result.Succeeded;
}
static void AddRibbonButtons(UIControlledApplication application)
{
string TabName = "My_TAB";
try
{
// Try to create a new tab.
application.CreateRibbonTab(TabName);
}
catch
{
// The tab already exists, so we don't need to create it, we'll just add to it.
}
RibbonPanel panel = application.CreateRibbonPanel(TabName, "MyProjectPanel");
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
// Create the main button.
string title = "BigMainButton" + Environment.NewLine + "The Sequel";
PushButtonData pbd = new PushButtonData("BigMainButtonUniqueID", title, thisAssemblyPath, "DefaultProjectName.App.RevitApp.ToggleAutoSync");
PushButton pb = panel.AddItem(pbd) as PushButton;
//if you want to add an image do the below 2 lines, set your image to be 64x64 pixels, png, and set the build action to "Resource".
BitmapImage pbImage = new BitmapImage(new Uri("pack://application:,,,/DefaultProjectName;component/Resources/Checklist_6464.png"));
pb.LargeImage = pbImage;
}
}
}
And then finally, you would have a your ToggleAutoSync class:
namespace DefaultProjectName.App.RevitApp
{
public class ToggleAutoSync : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//do xml stuff here, e.g.:
MyStaticXMLWorker.ToggleFile(@"C:\testFile.xml");
}
}
}
So if you wanted to have multiple buttons, doing different things, you'd create multiple classes that implement ExternalCommand, and then create multiple ribbons buttons.