Beispiel #1
0
        private static DependencyObject FindChild(DependencyObject parent, string childName)
        {
            if (parent == null)
            {
                return(null);
            }

            int childrenCount = VisualTreeHelper.GetChildrenCount(parent);

            for (int i = 0; i < childrenCount; i++)
            {
                DependencyObject child            = VisualTreeHelper.GetChild(parent, i);
                FrameworkElement frameworkElement = child as FrameworkElement;

                if (frameworkElement != null && frameworkElement.Name == childName)
                {
                    return(frameworkElement);
                }

                child = StatusBarInjector.FindChild(child, childName);

                if (child != null)
                {
                    return(child);
                }
            }

            return(null);
        }
        protected override void Initialize()
        {
            _dte = GetService(typeof(DTE)) as DTE2;
            Settings = (Settings)GetDialogPage(typeof(Settings));

            Logger.Initialize(this, Vsix.Name);
            InstallPackage.Initialize(this);

            _control = new StatusbarControl(Settings, _dte);

            var injector = new StatusBarInjector(Application.Current.MainWindow);
            injector.InjectControl(_control);
        }
Beispiel #3
0
        protected override void Initialize()
        {
            _dte     = GetService(typeof(DTE)) as DTE2;
            Settings = (Settings)GetDialogPage(typeof(Settings));

            Logger.Initialize(this, Vsix.Name);
            InstallPackage.Initialize(this);

            _control = new StatusbarControl(Settings, _dte);

            var injector = new StatusBarInjector(Application.Current.MainWindow);

            injector.InjectControl(_control);
        }
Beispiel #4
0
        protected override async task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync();

            _dte = await GetServiceAsync(typeof(DTE)) as DTE2;

            Settings = (Settings)GetDialogPage(typeof(Settings));

            Logger.Initialize(this, Vsix.Name);
            InstallPackage.Initialize(this);

            _control = new StatusbarControl(Settings, _dte);

            var injector = new StatusBarInjector(Application.Current.MainWindow);

            injector.InjectControl(_control);
        }
Beispiel #5
0
 private void FindStatusBar()
 {
     _statusBar = StatusBarInjector.FindChild(_window, "StatusBarContainer") as FrameworkElement;
     _panel     = _statusBar.Parent as DockPanel;
 }