示例#1
0
文件: SugzWindow.cs 项目: Sugz/CSharp
        public SugzWindow()
        {
            Loaded       += SugzWindow_Loaded;
            ShowInTaskbar = false;
            WindowInteropHelper windowHandle = new WindowInteropHelper(this);

            windowHandle.Owner = AppSDK.GetMaxHWND();
            AppSDK.ConfigureWindowForMax(this);
            Show();
        }
示例#2
0
        public void Show()
        {
            // Create an interop helper
            System.Windows.Interop.WindowInteropHelper windowHandle =
                new System.Windows.Interop.WindowInteropHelper(_wnd);

            // Assign the 3ds Max HWnd handle to the interop helper
            windowHandle.Owner = AppSDK.GetMaxHWND();

            // Setup 3ds Max to handle the WPF correctly
            AppSDK.ConfigureWindowForMax(_wnd);

            _wnd.Show();
        }
        public static void OpenMainWindow()
        {
            mainWindow = new MainWindow();
            mainWindow.ShowInTaskbar = false;

            // ReSharper disable once ObjectCreationAsStatement
            new WindowInteropHelper(mainWindow)
            {
                Owner = AppSDK.GetMaxHWND()
            };

            AppSDK.ConfigureWindowForMax(mainWindow);

            Interactions.Setup(mainWindow, new MaxProvider());
            mainWindow.Show();
        }
        /// <summary>
        /// This will be called when the utility plugin is activated
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="iu"></param>
        public override void BeginEditParams(IInterface ip, IIUtil iu)
        {
            //the window will stay open regardless if you close the utility plugin
            //if a running instance of the mianwindow is found it will just do nothing
            //else it will create a window and show it
            if (MainWindow.Instance != null)
            {
                return;
            }

            // attach the window to the window handling of max
            // that way the window itself wont loose its order
            // but now it wont go to system tray if you minimize it
            MainWindow window = new MainWindow();

            AppSDK.ConfigureWindowForMax(window);

            window.Show();
        }
示例#5
0
        private void OpenJobConfigWindow()
        {
            try
            {
                var dialog = new Window
                {
                    Title                 = Strings.SubmitJob_Title,
                    SizeToContent         = SizeToContent.WidthAndHeight,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner,
                    ResizeMode            = ResizeMode.CanResizeWithGrip,
                    ShowInTaskbar         = true
                };

                _maxRequestInterceptor = new MaxRequestInterceptor();
                var jobSubmissionForm = new JobSubmissionForm(LabsRequestHandler, _maxRequestInterceptor, Log.Instance);
                dialog.Content = jobSubmissionForm;

#if !DEBUG
                // only works in the context of 3ds Max
                var maxIcon = GetMaxIcon();
                if (maxIcon != null)
                {
                    dialog.Icon = maxIcon;
                }

                var windowHandle = new WindowInteropHelper(dialog);
                windowHandle.Owner = AppSDK.GetMaxHWND();
                AppSDK.ConfigureWindowForMax(dialog);
#endif
                dialog.Show();
            }
            catch (Exception ex)
            {
                Log.Instance.Error($"{ex.Message}\n{ex}", Strings.SubmitJob_Error, true);
                MessageBox.Show($"{Strings.SubmitJob_Error}.\n{ex.Message}\n{ex}");
            }
        }