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

Implement also in floating Test Explorer windows #5

Open
AndySteelApd opened this issue Aug 5, 2022 · 5 comments
Open

Implement also in floating Test Explorer windows #5

AndySteelApd opened this issue Aug 5, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@AndySteelApd
Copy link

Thanks for this great extension :)

I always have the Text Explorer window pulled out onto separate monitors.
Can this colourisation also be implemented at the bottom of this window as well so it's easier to identify which solution the window applies to.

thanks

@madskristensen madskristensen added the enhancement New feature or request label Aug 19, 2022
@lsoft
Copy link
Contributor

lsoft commented Aug 24, 2022

@AndySteelApd I took a look. There are 2 questions.

  1. Is it beatify enough? :)

image

  1. You need manually set solution color AFTER Test Explorer window is opened, otherwise it will colorless or has previous color. At the time, I don't know how to overcome it. will this feature be helpful in such conditions? (not very user friendly, so I'm not sure)

@mkornreder
Copy link
Contributor

Hello @lsoft, how did you manage that the frame is displayed like this?

@lsoft
Copy link
Contributor

lsoft commented Sep 5, 2022

@mkornreder are you interested for the code? if so, PTAL:

...
                if (options.ShowTaskBarThumbnails || options.ShowTaskBarOverlay)
                {
                    ShowInTaskBar(brush, options);
                }

                if (options.ShowTestExplorer) // <-- added an option
                {
                    ShowInTestExplorer(brush); // <-- show that border
                }

...
        private static void ShowInTestExplorer(SolidColorBrush color)
        {
            foreach (System.Windows.Window w in Application.Current.Windows)
            {
                if (!w.GetType().Name.Contains("FloatingWindow")) //at the moment we support only floating window
                {
                    continue;
                }

                FrameworkElement fe = w.FindChildByItsType("TestWindowToolWindowControl");
                if (fe == null)
                {
                    continue;
                }

                if(fe is Control c)
                {
                    c.BorderBrush = color;
                    c.BorderThickness = new Thickness(General.Instance.Width);
                    break;
                }
            }
        }

and

    public static class WpfExtensions
    {
        public static FrameworkElement FindChildByItsType(
            this DependencyObject root,
            string type
            )
        {
            if (root == null)
            {
                throw new ArgumentNullException(nameof(root));
            }

            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            int childrenCount = VisualTreeHelper.GetChildrenCount(root);

            for (int cc = 0; cc < childrenCount; cc++)
            {
                DependencyObject control = VisualTreeHelper.GetChild(
                    root,
                    cc
                    );

                if (control is FrameworkElement fe)
                {
                    if (fe.GetType().Name == type)
                    {
                        return fe;
                    }
                }

                var result = control.FindChildByItsType(type);
                if (result != null)
                {
                    return result;
                }
            }

            return null;
        }

...

@mkornreder
Copy link
Contributor

mkornreder commented Oct 11, 2022 via email

@ghhv
Copy link

ghhv commented Apr 8, 2024

+1
seems any separate code window also loses the colour.

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

5 participants