Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement : Set parent to Revit #5

Open
MarkAckerley opened this issue Jul 6, 2020 · 1 comment
Open

Enhancement : Set parent to Revit #5

MarkAckerley opened this issue Jul 6, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@MarkAckerley
Copy link

MarkAckerley commented Jul 6, 2020

This keeps the window ontop of Revit when it is opened, minimises it with Revit and additionally stops the window showing on the task bar.

Test code originally from here https://stackoverflow.com/questions/55339082/is-this-a-way-to-show-a-modeless-dialog-from-a-dockable-pane-using-wpf (I'm sure you will improve it!)

public void ShowForm(UIApplication uiapp)
        {
            // If we do not have a dialog yet, create and show it
            if (_mMyForm != null && _mMyForm == null) return;
            //EXTERNAL EVENTS WITH ARGUMENTS
            EventHandlerWithStringArg evStr = new EventHandlerWithStringArg();
            EventHandlerWithWpfArg evWpf = new EventHandlerWithWpfArg();

            _mMyForm = new Ui(uiapp, evStr, evWpf);

            HwndSource hwndSource = HwndSource.FromHwnd(uiapp.MainWindowHandle);
            System.Windows.Window wnd = hwndSource.RootVisual as System.Windows.Window;
            if (wnd != null)
            {
                _mMyForm.Owner = wnd;
                _mMyForm.ShowInTaskbar = false;
                _mMyForm.Show();
            }
        }

Cheers,

Mark

@mitevpi mitevpi self-assigned this Jul 6, 2020
@mitevpi mitevpi added the enhancement New feature or request label Jul 6, 2020
@mitevpi
Copy link
Owner

mitevpi commented Jul 6, 2020

@MarkAckerley thanks for getting this up here - I'll build and test locally when I have a chance. If you want, feel free to open up a pull request with those changes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants