public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { if (!Launched) { // Create a new speckle binding instance var bindings = new SpeckleUiBindingsRevit(commandData.Application); // Create an external event handler to raise actions var eventHandler = ExternalEvent.Create(new SpeckleRevitExternalEventHandler(bindings)); // Give it to our bindings so we can actually do stuff with revit bindings.SetExecutorAndInit(eventHandler); // Initialise the window #if DEBUG //SpeckleWindow = new SpeckleUiWindow( bindings, @"http://*****:*****@"https://matteo-dev.appui.speckle.systems/#/"); #else SpeckleWindow = new SpeckleUiWindow(bindings, @"https://matteo-dev.appui.speckle.systems/#/"); // On release, default to the latest ci-ed version from https://appui.speckle.systems #endif var helper = new System.Windows.Interop.WindowInteropHelper(SpeckleWindow); helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; // TODO: find a way to set the parent/owner of the speckle window so it minimises/maximises etc. together with the revit window. SpeckleWindow.Show(); Launched = true; } SpeckleWindow.Show(); SpeckleWindow.Focus(); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { if (!Launched) { // Create a new speckle binding instance var bindings = new SpeckleUiBindingsRevit(commandData.Application); // Create an external event handler to raise actions var eventHandler = ExternalEvent.Create(new SpeckleRevitExternalEventHandler(bindings)); // Give it to our bindings so we can actually do stuff with revit bindings.SetExecutorAndInit(eventHandler); // Initialise the window SpeckleWindow = new SpeckleUiWindow(bindings); var helper = new System.Windows.Interop.WindowInteropHelper(SpeckleWindow); helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; // TODO: find a way to set the parent/owner of the speckle window so it minimises/maximises etc. together with the revit window. SpeckleWindow.Show(); Launched = true; } SpeckleWindow.Show(); SpeckleWindow.Focus(); return(Result.Succeeded); }