예제 #1
0
        private void MoveConsoleWindow()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            ConsoleWindow consoleWindow = ConsoleWindow.Instance;

            if (!this.IsVisible || this.WindowState == WindowState.Minimized)
            {
                consoleWindow.Hide();
                return;
            }
            if (!consoleWindow.IsVisible)
            {
                consoleWindow.Show();
            }
            if (consoleWindow.WindowState != this.WindowState)
            {
                consoleWindow.WindowState = this.WindowState;
            }
            // -2 -1是因为主窗口有圆角,但下层的控制台窗口不能透明所以不能圆角,把下层的控制台窗口的宽高缩小一点点从而避免看见下层控制台窗口的棱角
            if (consoleWindow.Width != this.Width - 2)
            {
                consoleWindow.Width = this.Width - 2;
            }
            if (consoleWindow.Height != this.Height - 2)
            {
                consoleWindow.Height = this.Height - 2;
            }
            if (this.WindowState == WindowState.Normal)
            {
                if (consoleWindow.Left != this.Left + 1)
                {
                    consoleWindow.Left = this.Left + 1;
                }
                if (consoleWindow.Top != this.Top + 1)
                {
                    consoleWindow.Top = this.Top + 1;
                }
            }
            if (ConsoleRectangle != null && ConsoleRectangle.IsVisible)
            {
                Point     point        = ConsoleRectangle.TransformToAncestor(this).Transform(new Point(0, 0));
                const int paddingLeft  = 4;
                const int paddingRight = 5;
                int       marginLeft   = paddingLeft + (int)point.X;
                int       width        = (int)this.ActualWidth - marginLeft - paddingRight;
                consoleWindow.MoveWindow(marginLeft: marginLeft, marginTop: (int)point.Y, width, height: (int)ConsoleRectangle.ActualHeight);
            }
        }
예제 #2
0
        private void MoveConsoleWindow()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            ConsoleWindow consoleWindow = ConsoleWindow.Instance;

            if (!this.IsVisible || this.WindowState == WindowState.Minimized)
            {
                consoleWindow.Hide();
                NTMinerConsole.Hide();
                return;
            }
            if (!consoleWindow.IsVisible)
            {
                consoleWindow.Show();
            }
            if (MainArea.SelectedItem == ConsoleTabItem)
            {
                NTMinerConsole.Show();
            }
            if (consoleWindow.WindowState != this.WindowState)
            {
                consoleWindow.WindowState = this.WindowState;
            }
            if (consoleWindow.Width != this.Width)
            {
                consoleWindow.Width = this.Width;
            }
            if (consoleWindow.Height != this.Height)
            {
                consoleWindow.Height = this.Height;
            }
            if (this.WindowState == WindowState.Normal)
            {
                if (consoleWindow.Left != this.Left)
                {
                    consoleWindow.Left = this.Left;
                }
                if (consoleWindow.Top != this.Top)
                {
                    consoleWindow.Top = this.Top;
                }
            }
            if (ConsoleRectangle != null && ConsoleRectangle.IsVisible)
            {
                Point point = ConsoleRectangle.TransformToAncestor(this).Transform(new Point(0, 0));
                consoleWindow.MoveWindow(marginLeft: (int)point.X, marginTop: (int)point.Y, height: (int)ConsoleRectangle.ActualHeight);
            }
        }
예제 #3
0
        private void MoveConsoleWindow()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            ConsoleWindow consoleWindow = ConsoleWindow.Instance;

            if (!this.IsVisible || this.WindowState == WindowState.Minimized)
            {
                consoleWindow.Hide();
                return;
            }
            if (!consoleWindow.IsVisible)
            {
                consoleWindow.Show();
            }
            if (consoleWindow.WindowState != this.WindowState)
            {
                consoleWindow.WindowState = this.WindowState;
            }
            // -2 -1是因为主窗口有圆角,但下层的控制台窗口不能透明所以不能圆角,把下层的控制台窗口的宽高缩小一点点从而避免看见下层控制台窗口的棱角
            if (consoleWindow.Width != this.Width - 2)
            {
                consoleWindow.Width = this.Width - 2;
            }
            if (consoleWindow.Height != this.Height - 2)
            {
                consoleWindow.Height = this.Height - 2;
            }
            if (this.WindowState == WindowState.Normal)
            {
                if (consoleWindow.Left != this.Left + 1)
                {
                    consoleWindow.Left = this.Left + 1;
                }
                if (consoleWindow.Top != this.Top + 1)
                {
                    consoleWindow.Top = this.Top + 1;
                }
            }
            if (ConsoleRectangle != null && ConsoleRectangle.IsVisible)
            {
                GetMoveToValues(out int marginLeft, out int marginTop, out int width, out int height);
                consoleWindow.MoveWindow(marginLeft: marginLeft, marginTop: marginTop, width, height: height);
            }
        }