12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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 : Window, IDynamicFormWindow
- {
- public DynamicFormDesignWindow() : base()
- {
- InitializeComponent();
- Preview.Mode = FormMode.Designing;
- }
- public DynamicFormDesignGrid Grid => Preview;
- private DFLayoutType _type;
- public DFLayoutType Type
- {
- get => _type;
- set
- {
- _type = value;
- Width = _type == DFLayoutType.Mobile ? 600 : 1000;
- Height = 800;
- }
- }
- 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 Grid.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);
- }
- }
|