using Remontor.Setting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Remontor.Connector
{
    internal class DobleMonFull : IModeMon
    {
        [DllImport("user32.dll")]
        static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint);

        private bool Chanded = false;
        public int OldWidth, OldHeight;
        public Point OldPoint;
        public FormWindowState OldState;
        private int over = 0;
        public DobleMonFull()
        {
           // OldWidth = SConnector.FormMain.Bounds.Width;
            //OldHeight = SConnector.FormMain.Height;
            //OldState = SConnector.FormMain.WindowState;
            //OldPoint = SConnector.FormMain.Location;
            //System.Console.WriteLine(OldWidth.ToString());
            //System.Console.WriteLine(OldHeight.ToString());
          
        }
        public override void Set()
        {
          
        }
        public override void Resize(Process Proc, Control View)
        {
            if (Chanded) return;
            Chanded = true;
            if (over == 0)
            {
                over = 1;
            }
            else
            {
                over = 0;
            }
           
            
            SConnector.FormMain.WindowState = FormWindowState.Normal;
            SConnector.FormMain.Width = SGlobalSetting.settingApp.WidthDoble;
            SConnector.FormMain.Height = SGlobalSetting.settingApp.HeightDoble;
            SConnector.FormMain.Location = new System.Drawing.Point(SGlobalSetting.settingApp.xPosDoble, SGlobalSetting.settingApp.yPosDoble);
            Chanded = false;
            MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y + 9, View.Bounds.Width, View.Bounds.Height - 9 + over, true);
        }

        public override IModeMon Change(IModeMon Mode)
        {

            if (Mode == this) return this;
            return Mode;
        }
    }
}
