Files
RookieStation/RookieStation/ProjectConfig/Views/WpfProjectSettings.xaml.cs
2021-08-23 11:18:13 +08:00

61 lines
2.2 KiB
C#

using Autodesk.Revit.DB;
using HandyControl.Properties.Langs;
using HandyControl.Tools;
using RookieStation.Utils;
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.Navigation;
using System.Windows.Shapes;
namespace RookieStation.ProjectConfig.Views
{
/// <summary>
/// WpfProjectSettings.xaml 的交互逻辑
/// </summary>
public partial class WpfProjectSettings
{
public Document Document { get; set; }
public WpfProjectSettings()
{
InitializeComponent();
tbHeight.Text = Properties.Settings.Default.Height.ToString();
tbOrders.Text = Properties.Settings.Default.Orders.ToString();
tbProjectName.Text = Properties.Settings.Default.ProjectName;
tbSchoolName.Text = Properties.Settings.Default.SchoolName;
tbScale.Text = Properties.Settings.Default.Scale;
}
private void btnConfirm_Click(object sender, RoutedEventArgs e)
{
//ProjectConfigUtil.SetCfgPairs("Height", tbHeight.Text);
//ProjectConfigUtil.SetCfgPairs("Orders", tbOrders.Text);
Properties.Settings.Default.Height = Convert.ToDouble(tbHeight.Text.Trim());
Properties.Settings.Default.Orders = Convert.ToInt32(tbOrders.Text.Trim());
Properties.Settings.Default.SchoolName = tbSchoolName.Text.Trim();
Properties.Settings.Default.ProjectName = tbProjectName.Text.Trim();
Properties.Settings.Default.Scale = tbScale.Text.Trim();
Properties.Settings.Default.Date = tpDate.SelectedDate.Value.ToString("d").Trim();
Properties.Settings.Default.Save();
Close();
}
private void tb_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex("[^0-9]+");
e.Handled = re.IsMatch(e.Text);
}
}
}