using AR;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AGVControl.Dialog
{
    public partial class fMapDesign : Form
    {
        AGVControl.MapControl mapctl;
        public fMapDesign(string fn)
        {
            InitializeComponent();

            mapctl = new AGVControl.MapControl();
            mapctl.Dock = DockStyle.Fill;
            mapctl.Visible = true;
            mapctl.Font = this.panel1.Font;
            mapctl.BackColor = Color.FromArgb(32, 32, 32);
            this.panel1.Controls.Add(mapctl);

            if (System.IO.File.Exists(fn))
            {
                //auto load 
                var rlt = mapctl.LoadFromFile(fn, out string errmsg);
                if (rlt == false) AR.UTIL.MsgE(errmsg);
            }
        }

        private void fMapDesign_Load(object sender, EventArgs e)
        {

        }

        private void btOK_Click(object sender, EventArgs e)
        {
            this.mapctl.SaveToFile(this.mapctl.Filename);
            DialogResult = DialogResult.OK;
        }
    }
}
