Ejemplo n.º 1
0
        private void MoveConsoleWindow()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            ConsoleWindow consoleWindow = ConsoleWindow.Instance;

            if (!this.IsVisible || this.WindowState == WindowState.Minimized || MainArea.SelectedItem != ConsoleTabItem)
            {
                consoleWindow.Hide();
                NTMinerConsole.Hide();
                return;
            }
            if (!consoleWindow.IsVisible)
            {
                consoleWindow.Show();
                NTMinerConsole.Show();
            }
            if (consoleWindow.WindowState != this.WindowState)
            {
                consoleWindow.WindowState = this.WindowState;
            }
            if (consoleWindow.Width != this.ActualWidth)
            {
                consoleWindow.Width = this.ActualWidth;
            }
            if (consoleWindow.Height != this.ActualHeight)
            {
                consoleWindow.Height = this.ActualHeight;
            }
            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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 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)
            {
                Point point = ConsoleRectangle.TransformToAncestor(this).Transform(new Point(0, 0));
                consoleWindow.MoveWindow(marginLeft: (int)point.X, marginTop: (int)point.Y, height: (int)ConsoleRectangle.ActualHeight);
            }
        }