﻿using GoldyProject.Project.Capture.GoldyCapture.Cameraman;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace GoldyProject.Project.Capture.GoldyCapture {
    public partial class MainForm : Form {
        public MainForm() { InitializeComponent(); }
        private List<Bitmap> screenshotList = new List<Bitmap>();

        private void MainForm_Load(object sender, EventArgs e) {
            button1.PerformClick();

        }
        private void button1_Click(object sender, EventArgs e) {
            this.Hide();
            System.Threading.Thread.Sleep(300);
            this.runCamera();
            this.Show();
        }

        private void runCamera() {

            CameraOption cameraOption = readCameraOption();
            CameramanAdmin cameraman = new CameramanAdmin(cameraOption);
            cameraman.ShowDialog();

            Bitmap image = cameraOption.resultImage;
            this.BackgroundImage = image;
            this.Bounds = cameraOption.resultBounds;
        }

        private CameraOption readCameraOption() {
            CameraOption returnTarget = new CameraOption();
            return returnTarget;
        }

        private void MainForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
            if (e.KeyCode.Equals(Keys.Escape)) {
                this.Close();
                this.Dispose();
            }
        }




    }
}
