예제 #1
0
 public void HandleScreenAdded(AppBarScreen screen)
 {
     if (EnableService && (EnableMultiMon || screen.Primary))
     {
         OpenWindow(screen);
     }
 }
예제 #2
0
        public Taskbar(ICairoApplication cairoApplication,
                       ShellManager shellManager,
                       IWindowManager windowManager,
                       IDesktopManager desktopManager,
                       IAppGrabber appGrabber,
                       AppBarScreen screen,
                       AppBarEdge edge)
            : base(cairoApplication, shellManager, windowManager, screen, edge, 0)
        {
            object taskBarWindowAllowsTransparencyResource = CairoApplication.Current.Resources["TaskBarWindowAllowsTransparency"];

            if (taskBarWindowAllowsTransparencyResource is bool resourceValue)
            {
                AllowsTransparency = resourceValue;
            }

            InitializeComponent();
            _appGrabber     = appGrabber;
            _desktopManager = desktopManager;
            _shellManager   = shellManager;

            if (!Screen.Primary && !Settings.Instance.EnableMenuBarMultiMon)
            {
                ProcessScreenChanges = true;
            }
            else
            {
                ProcessScreenChanges = false;
            }

            setupTaskbar();
            setupTaskbarAppearance();
        }
예제 #3
0
        public void ResetPosition()
        {
            double top           = System.Windows.Forms.SystemInformation.WorkingArea.Top / DpiHelper.DpiScale;
            double taskbarHeight = 0;

            if (Settings.Instance.TaskbarMode == 1)
            {
                // special case, since work area is not reduced with this setting
                // this keeps the desktop going beneath the TaskBar

                // get the TaskBar's height
                double             dpiScale     = 1;
                AppBarScreen       screen       = AppBarScreen.FromPrimaryScreen();
                NativeMethods.Rect workAreaRect = _appBarManager.GetWorkArea(ref dpiScale, screen, false, false);
                taskbarHeight = (screen.Bounds.Bottom - workAreaRect.Bottom) / dpiScale;

                // top TaskBar means we should push down
                if (Settings.Instance.TaskbarPosition == 1)
                {
                    top = workAreaRect.Top / dpiScale;
                }
            }

            Width  = WindowManager.PrimaryMonitorWorkArea.Width / DpiHelper.DpiScale;
            Height = (WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale) - taskbarHeight;

            grid.Width  = Width;
            grid.Height = Height;

            Top  = top;
            Left = System.Windows.Forms.SystemInformation.WorkingArea.Left / DpiHelper.DpiScale;
        }
예제 #4
0
        public void RefreshWindows(WindowManagerEventArgs args)
        {
            // update screens of stale windows
            if (!EnableService)
            {
                return;
            }

            if (EnableMultiMon)
            {
                foreach (AppBarScreen screen in _windowManager.ScreenState)
                {
                    CairoAppBarWindow window = WindowManager.GetScreenWindow(Windows, screen);

                    if (window != null)
                    {
                        window.Screen = screen;
                        window.SetScreenPosition();
                    }
                }
            }
            else if (Windows.Count > 0)
            {
                Windows[0].Screen = AppBarScreen.FromPrimaryScreen();
                Windows[0].SetScreenPosition();
            }
        }
예제 #5
0
        protected override void OpenWindow(AppBarScreen screen)
        {
            MenuBar newMenuBar = new MenuBar(_cairoApplication, _shellManager, _windowManager, _appGrabber, _updateService, _settingsUiService, screen, AppBarEdge.Top);

            Windows.Add(newMenuBar);
            newMenuBar.Show();
        }
예제 #6
0
        protected override void OpenWindow(AppBarScreen screen)
        {
            Taskbar newTaskbar = new Taskbar(_cairoApplication, _shellManager, _windowManager, _desktopManager, _appGrabber, screen, Settings.Instance.TaskbarPosition == 1 ? AppBarEdge.Top : AppBarEdge.Bottom);

            Windows.Add(newTaskbar);
            newTaskbar.Show();
        }
예제 #7
0
        private void openTaskbar(AppBarScreen screen)
        {
            ShellLogger.Debug($"WindowManager: Opening taskbar on screen {screen.DeviceName}");
            Taskbar taskbar = new Taskbar(this, _shellManager, _startMenuMonitor, _updater, screen, (AppBarEdge)Settings.Instance.Edge);

            taskbar.Show();

            _taskbars.Add(taskbar);
        }
예제 #8
0
        private void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ShowMultiMon")
            {
                // Update screen state in case it has changed since last checked
                _screenState = AppBarScreen.FromAllScreens();

                if (_screenState.Count < 2)
                {
                    return;
                }

                ReopenTaskbars();
            }
        }
예제 #9
0
        private void openTaskbars()
        {
            _screenState = AppBarScreen.FromAllScreens();

            ShellLogger.Debug($"WindowManager: Opening taskbars");

            if (Settings.Instance.ShowMultiMon)
            {
                foreach (var screen in _screenState)
                {
                    openTaskbar(screen);
                }
            }
            else
            {
                openTaskbar(AppBarScreen.FromPrimaryScreen());
            }
        }
예제 #10
0
        private void setGridPosition()
        {
            double top  = SystemInformation.WorkingArea.Top / DpiHelper.DpiScale;
            double left = SystemInformation.WorkingArea.Left / DpiHelper.DpiScale;

            if (_desktopManager.ShellWindow != null || _desktopManager.AllowProgmanChild)
            {
                top  = (0 - SystemInformation.VirtualScreen.Top + SystemInformation.WorkingArea.Top) / DpiHelper.DpiScale;
                left = (0 - SystemInformation.VirtualScreen.Left + SystemInformation.WorkingArea.Left) / DpiHelper.DpiScale;
            }

            grid.Width = WindowManager.PrimaryMonitorWorkArea.Width / DpiHelper.DpiScale;

            if (Settings.Instance.TaskbarMode == 1)
            {
                // special case, since work area is not reduced with this setting
                // this keeps the desktop going beneath the TaskBar
                // get the TaskBar's height
                double             dpiScale     = 1;
                AppBarScreen       screen       = AppBarScreen.FromPrimaryScreen();
                NativeMethods.Rect workAreaRect = _appBarManager.GetWorkArea(ref dpiScale, screen, false, false);

                grid.Height = (WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale) - ((screen.Bounds.Bottom - workAreaRect.Bottom) / dpiScale);

                if (Settings.Instance.TaskbarPosition == 1)
                {
                    top += (workAreaRect.Top - SystemInformation.WorkingArea.Top) / dpiScale;
                }
            }
            else
            {
                grid.Height = WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale;
            }

            grid.Margin = new Thickness(left, top, 0, 0);
        }
예제 #11
0
        public Taskbar(ShellManager shellManager, CloakMonitor cloakMonitor, AppBarScreen screen, AppBarEdge edge)
            : base(shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, 0)
        {
            _cloakMonitor = cloakMonitor;
            _shellManager = shellManager;

            InitializeComponent();
            DataContext        = _shellManager;
            DesiredHeight      = Application.Current.FindResource("TaskbarHeight") as double? ?? 0;
            AllowsTransparency = Application.Current.FindResource("AllowsTransparency") as bool? ?? false;
            SetFontSmoothing();
            SetupQuickLaunch();

            _explorerHelper.HideExplorerTaskbar = true;

            _cloakMonitor.PropertyChanged     += CloakMonitor_PropertyChanged;
            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            // Layout rounding causes incorrect sizing on non-integer scales
            if (DpiHelper.DpiScale % 1 != 0)
            {
                UseLayoutRounding = false;
            }
        }
예제 #12
0
        //private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings

        public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23)
        {
            _appGrabber = appGrabber;
            _applicationUpdateService = applicationUpdateService;
            _settingsUiService        = settingsUiService;

            object menuBarWindowAllowsTransparencyResource = CairoApplication.Current.Resources["MenuBarWindowAllowsTransparency"];

            if (menuBarWindowAllowsTransparencyResource is bool resourceValue)
            {
                AllowsTransparency = resourceValue;
            }

            InitializeComponent();

            RequiresScreenEdge = true;

            SetPosition();

            setupChildren();

            setupMenu();

            setupCairoMenu();

            setupPlacesMenu();

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;
        }
예제 #13
0
        public CairoAppBarWindow(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppBarScreen screen, AppBarEdge edge, double height) : base(
                shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, height)
        {
            _cairoApplication = cairoApplication;
            _windowManager    = windowManager;

            AllowsTransparency = true;
        }
예제 #14
0
 protected abstract void OpenWindow(AppBarScreen screen);
예제 #15
0
        public Taskbar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, DesktopManager desktopManager, AppGrabberService appGrabber, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 0)
        {
            InitializeComponent();
            _appGrabber     = appGrabber;
            _desktopManager = desktopManager;
            _shellManager   = shellManager;

            if (!Screen.Primary && !Settings.Instance.EnableMenuBarMultiMon)
            {
                ProcessScreenChanges = true;
            }
            else
            {
                ProcessScreenChanges = false;
            }

            setupTaskbar();
            setupTaskbarAppearance();
        }
예제 #16
0
        public Taskbar(WindowManager windowManager, ShellManager shellManager, StartMenuMonitor startMenuMonitor, Updater updater, AppBarScreen screen, AppBarEdge edge)
            : base(shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, 0)
        {
            _shellManager  = shellManager;
            _updater       = updater;
            _windowManager = windowManager;

            InitializeComponent();
            DataContext = _shellManager;
            StartButton.StartMenuMonitor = startMenuMonitor;

            DesiredHeight = Application.Current.FindResource("TaskbarHeight") as double? ?? 0;
            DesiredWidth  = Application.Current.FindResource("TaskbarWidth") as double? ?? 0;

            AllowsTransparency = Application.Current.FindResource("AllowsTransparency") as bool? ?? false;

            FlowDirection = Application.Current.FindResource("flow_direction") as FlowDirection? ?? FlowDirection.LeftToRight;

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            if (Settings.Instance.ShowQuickLaunch)
            {
                QuickLaunchToolbar.Visibility = Visibility.Visible;
            }

            // Hide the start button on secondary display(s)
            if (!Screen.Primary)
            {
                StartButton.Visibility = Visibility.Collapsed;
            }
        }
예제 #17
0
 private void openTaskbar()
 {
     _taskbar = new Taskbar(_shellManager, _cloakMonitor, AppBarScreen.FromPrimaryScreen(), AppBarEdge.Bottom);
     _taskbar.Show();
 }
예제 #18
0
        //private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings

        public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23)
        {
            _appGrabber = appGrabber;
            _applicationUpdateService = applicationUpdateService;
            _settingsUiService        = settingsUiService;

            InitializeComponent();

            RequiresScreenEdge = true;

            SetPosition();

            setupChildren();

            setupMenu();

            setupCairoMenu();

            setupPlacesMenu();

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;
        }
예제 #19
0
 public CairoAppBarWindow() : base(null, null, null, AppBarScreen.FromPrimaryScreen(), AppBarEdge.Bottom, 0)
 {
 }