public override void CustomExecute(object parameter)
{
try
{
IGlobal global = Autodesk.Max.GlobalInterface.Instance;
IInterface14 ip = global.COREInterface14;
int nNumSelNodes = ip.SelNodeCount;
if (nNumSelNodes <= 0)
{
ip.PushPrompt("No nodes are selected. Please select at least one node to convert, before running the command.");
return;
}
System.Windows.Window dialog = new System.Windows.Window();
dialog.Title = "Explode It!";
dialog.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
ExplodeGeomUserControl1 ctlExplode = new ExplodeGeomUserControl1(dialog);
dialog.Content = ctlExplode;
dialog.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
dialog.ShowInTaskbar = false;
dialog.ResizeMode = System.Windows.ResizeMode.NoResize;
System.Windows.Interop.WindowInteropHelper windowHandle =
new System.Windows.Interop.WindowInteropHelper(dialog);
windowHandle.Owner = ManagedServices.AppSDK.GetMaxHWND();
ManagedServices.AppSDK.ConfigureWindowForMax(dialog);
dialog.ShowDialog(); //modal version; this prevents changes being made to model while our dialog is running, etc.
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}