﻿using System.Windows.Forms;
using System.Collections.Generic;

using Hexei.Controls;

namespace Hexei.Forms
{
    public partial class MainForm : Form
    {
        List<HexViewForm> HexViewForms;

        public MainForm()
        {
            HexViewForms = new List<HexViewForm>();

            InitControls();
        }

        private void InitControls()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            Application.Exit();
        }

        private void openToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            if(dialog.ShowDialog() == DialogResult.OK)
            {
                HexViewForm hexView = NewHexView();
                hexView.OpenFile(dialog.FileName);
            }
        }

        private HexViewForm NewHexView()
        {
            this.IsMdiContainer = true;

            HexViewForm winform = new HexViewForm();
            winform.MdiParent = this;
            winform.Show();

            HexViewForms.Add(winform);

            return winform;
        }
    }
}
