using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace VectorRace_LevelDesigner
{
    public partial class FormLD : Form
    {
        public FormLD()
        {
            InitializeComponent();
        }

        private void buttonLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.ShowDialog();

            if (ofd.FileName == string.Empty)
                return;

            Level level = Level.Load(ofd.FileName);

            fieldlayout.LoadLevel(level);
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.ShowDialog();

            if (sfd.FileName == string.Empty)
                return;

            Level.Save(sfd.FileName, fieldlayout.GetLevel());            
        }

        private void buttonReset_Click(object sender, EventArgs e)
        {
            fieldlayout.Reset();
        }
    }
}