예제 #1
0
        private void SetPosition()
        {
            var screens        = WpfScreen.AllScreens().ToArray();
            var farBottomRight =
                screens.OrderByDescending(scr => scr.WorkingArea.Right).First();

            Left = farBottomRight.WorkingArea.BottomRight.X - Width;
            Top  = farBottomRight.WorkingArea.BottomRight.Y - Height;
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();

            var screenCount = WpfScreen.AllScreens().Count();

            currentScreen = screenCount;
            moveCount     = screenCount * 2;

            Browser.Address = Settings.Default.TargetUri;

            SetPosition();
            Visibility = Visibility.Visible;
        }
예제 #3
0
        public void Move()
        {
            var screens = WpfScreen.AllScreens().ToArray();

            // determine target locations
            var nextScreenSide = ++moveCount % 2 == 0;  // false == left, true == right

            // screenSide = left ? time to move onto the next screen. Make sure to rotate back to the first screen
            currentScreen = ((nextScreenSide == LEFT ? ++currentScreen : currentScreen) % screens.Length);

            var screen    = screens[currentScreen];
            var dockPoint = nextScreenSide == RIGHT
                ? screen.WorkingArea.BottomRight
                : screen.WorkingArea.BottomLeft;

            Left = nextScreenSide == RIGHT
                ? dockPoint.X - Width
                : dockPoint.X;
            Top = dockPoint.Y - Height;
        }