I'm working on an Office-Add in for Microsoft Visio. I am starting my Application by Clicking on a Button of the Ribbon-Control in MS Office. My problem is, that at a certain Point I want to call a StopButton_Click
Method located in the Ribbon-Class
(just like the Start-Button, clicked earlier) from another class Class2
. However this is not possible without creating another instance of the Ribbon-Class
in Class2
to which I refer by calling the StopButton_Click
.
Right now, my code looks like this:
public partial class Ribbon {
public void StopButton_Click(object sender, RibbonControlEventArgs e)
{
//Button to Stop Application
//enable/disable Ribbon Control Buttons
}
}
static class Class2 {
//some Code
Ribbon r = new Ribbon();
r.StopButton_Click;
// some more code
}
In the StopButton_Click
Method I am enabling/disabling certain Buttons of the Ribbon-Control of MS Office (depending on whether the app is started or stopped).The Problem now is, that the Application Stops, but the Buttons in the Ribbon-Control are not changing. I think it's because I am calling the StopButton_Click
on another Instance than the one I started the Application.
Is there a solution for this? Like calling the StopButton_Click
in Class2
without creating another Instance?
Thanks in Advance!