//IDictionary<string, object> GetCurrentUIInfo() //{ // if (!UIService.IsUIThread) // { // return UIService.Run(GetCurrentUIInfo); // } // var result = new Dictionary<string, object>(); // System.Windows.Media.Color accentColor = Colors.White; // //if (Config.ShouldUseVisualStudioTheme) // { // var windowColorKey = Microsoft.VisualStudio.PlatformUI.EnvironmentColors.SystemWindowColorKey; // var windowColor = (System.Windows.Media.Color)Application.Current.MainWindow.FindResource(windowColorKey); // accentColor = windowColor; // } // return result; //} void InvalidateCurrentBadge() { if (!UIService.IsUIThread) { UIService.Run(InvalidateCurrentBadge); return; } if (MainWindowHandle == IntPtr.Zero) { return; } dwmapi.DwmInvalidateIconicBitmaps(MainWindowHandle); }
public void RegisterVisualStudioUILoadedAction(Action action) { //! this methid must run on UI thread // because it accesses Main Window if (!UIService.IsUIThread) { UIService.Run(() => RegisterVisualStudioUILoadedAction(action)); return; } if (Application.Current.MainWindow == null) { UILoadedActions.Enqueue(action); // Main Window not yet created, listen to Activated event and perform actions when it is raised // make sure the handler is added only once (it is safe to try to remove handler even if it's not there) Application.Current.Activated -= UILOADED__CurrentApplication_Activated; Application.Current.Activated += UILOADED__CurrentApplication_Activated; } else { HwndSource hwndSource = HwndSource.FromDependencyObject(Application.Current.MainWindow) as HwndSource; if (hwndSource == null) { // Main Window created but not yet ready UILoadedActions.Enqueue(action); // make sure the handler is added only once (it is safe to try to remove handler even if it's not there) Application.Current.MainWindow.LayoutUpdated -= UILOADED__MainWindow_LayoutUpdated; Application.Current.MainWindow.LayoutUpdated += UILOADED__MainWindow_LayoutUpdated; } else { action(); } } }