| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | using InABox.Core;using Org.BouncyCastle.Bcpg;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;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 event DynamicFormDesignGrid.CreateVariableHandler OnCreateVariable        {            add => Grid.OnCreateVariable += value;            remove => Grid.OnCreateVariable -= value;        }        public event DynamicFormDesignGrid.EditVariableHandler OnEditVariable        {            add => Grid.OnEditVariable += value;            remove => Grid.OnEditVariable -= value;        }        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;        }        private void DynamicFormWindow_KeyDown(object sender, KeyEventArgs e)        {            Grid.HandleKeyDown(e);        }    }}
 |