Interaction logic for UserControl1.xaml
Наследование: System.Windows.Controls.UserControl
Пример #1
0
        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);
            }
        }
        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);
            }
        }
 /// <summary>
 /// Cleanup progress control
 /// </summary>
 /// <param name="ctrlProgress"> Input the progress control to clear. </param>
 static public void ClearProgressControl(ExplodeGeomUserControl1 ctrlProgress)
 {
     m_bUsingProgress = false;
     m_ctrlProgress   = null;
 }
 /// <summary>
 /// Used to initialize a progress control
 /// </summary>
 /// <param name="ctrlProgress"> Input the progress control to use. </param>
 static public void SetProgressControl(ExplodeGeomUserControl1 ctrlProgress)
 {
     m_bUsingProgress = true;
     m_ctrlProgress   = ctrlProgress;
 }
 /// <summary>
 /// Used to initialize a progress control
 /// </summary>
 /// <param name="ctrlProgress"> Input the progress control to use. </param>
 public static void SetProgressControl(ExplodeGeomUserControl1 ctrlProgress)
 {
     m_bUsingProgress = true;
     m_ctrlProgress = ctrlProgress;
 }
 /// <summary>
 /// Cleanup progress control
 /// </summary>
 /// <param name="ctrlProgress"> Input the progress control to clear. </param>
 public static void ClearProgressControl(ExplodeGeomUserControl1 ctrlProgress)
 {
     m_bUsingProgress = false;
     m_ctrlProgress = null;
 }