using InABox.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;

namespace InABox.DynamicGrid
{
    /// <summary>
    /// Interaction logic for DynamicFormDesignWindow.xaml
    /// </summary>
    public partial class DynamicFormDesignWindow : DynamicFormWindow
    {

        public DynamicFormDesignWindow(): base()
        {
            InitializeComponent();

            Preview.Mode = FormMode.Designing;
        }

        protected override DynamicFormDesignGrid Grid { get => Preview; }

        public bool Designing
        {
            get => Grid.Mode == FormMode.Designing;
            set
            {
                Grid.Mode = value
                    ? FormMode.Designing
                    : FormMode.Preview;
                SwitchView.Content = value ? "Preview" : "Design";
            }
        }

        public string SaveLayout()
        {
            return Form.SaveLayout();
        }

        private void SwitchView_Click(object sender, RoutedEventArgs e)
        {
            Designing = !Designing;
        }

        private void OK_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }
    }
}
