public static void Hide_Objects() { // Will hide the frames (targets) and paths using the RobotStudio CommandBarButton // Frames (targets, workobjects, frames) bool FramesVisible = CommandBarButton.FromID("ViewShowAllFrames").IsChecked; // checks if the Command is checked if (FramesVisible) // if the option is active desactive it { CommandBarButton.FromID("ViewShowAllFrames").Execute(); } else // if the option is desactivated, active and desactive it. If some frame is creted with the option off, the frame is still visible { CommandBarButton.FromID("ViewShowAllFrames").Execute(); CommandBarButton.FromID("ViewShowAllFrames").Execute(); } // Paths bool PathsVisible = CommandBarButton.FromID("ViewShowAllPaths").IsChecked; // checks if the Command is checked if (PathsVisible) { CommandBarButton.FromID("ViewShowAllPaths").Execute(); } else { CommandBarButton.FromID("ViewShowAllPaths").Execute(); CommandBarButton.FromID("ViewShowAllPaths").Execute(); } }
public static void ResetFloor() { // Will Reset the floor size using the RobotStudio CommandBarButton CommandBarButton.FromID("ViewResetFloorSize").Execute(); // Hide the RobotStudio floor bool FloorVisible = CommandBarButton.FromID("ViewShowFloor").IsChecked; // check if the Command ShowFloor is checked if (FloorVisible) { CommandBarButton.FromID("ViewShowFloor").Execute(); } }
private static void OpenButtonClicked(object sender, ExecuteCommandEventArgs e) { if (Station.ActiveStation == null) { Logger.AddMessage("WZcalculator: There is no active station, add-in cannot be launched", LogMessageSeverity.Warning); return; } // Create a toolwindow that contains the WZcalculator UserControl and add it to the enviroment. ToolWindow toolWindow = new ToolWindow(MAIN_WINDOW_ID, new WZcalculatorToolWindow(), "WZcalculator"); toolWindow.Closed += MainWindowClosed; toolWindow.ActiveTab = true; toolWindow.CloseButtonBehavior = CloseButtonBehavior.Close; UIEnvironment.Windows.AddDocked(toolWindow, System.Windows.Forms.DockStyle.Left); // Disable the Open button CommandBarButton.FromID(OPEN_BUTTON_ID).DefaultEnabled = false; }
private static void MainWindowClosed(object sender, EventArgs e) { // Re-enable the button CommandBarButton.FromID(OPEN_BUTTON_ID).DefaultEnabled = true; }
public static void AddinMain() { CommandBarButton.FromID(OPEN_BUTTON_ID).ExecuteCommand += OpenButtonClicked; Project.ActiveProjectChanged += Project_ActiveProjectChanged; }