using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace Szmedi.RvKits.ExportFamilyInfo { /// /// Interaction logic for Setting.xaml /// public partial class ExportSettingsWin { public ExportSettingsWin() { InitializeComponent(); TbPathName.Text = Properties.Settings.Default.SavePath; foreach (ComboBoxItem cbbitem in CbbImg.Items) { if (cbbitem.Content.ToString() == Properties.Settings.Default.ImgFormat) { CbbImg.SelectedItem = cbbitem; } } TbImgSize.Text = Properties.Settings.Default.ImgSize; } private void cbb_img_DropDownClosed(object sender, EventArgs e) { //int selindex = cbb_img.SelectedIndex; string selstr = CbbImg.Text; Properties.Settings.Default.ImgFormat = selstr; Properties.Settings.Default.Save(); } //屏蔽所有Textbox中文输入和非法字符粘贴输入 //System.Windows.Controls.TextBox textBox = sender as System.Windows.Controls.TextBox; //TextChange[] change = new TextChange[e.Changes.Count]; //e.Changes.CopyTo(change, 0); //int offset = change[0].Offset; //if (change[0].AddedLength > 0) //{ // double num = 0; // if (!Double.TryParse(tb_ImgSize.Text, out num)) // { // tb_ImgSize.Text = tb_ImgSize.Text.Remove(offset, change[0].AddedLength); // tb_ImgSize.Select(offset, 0); // } //} private void tb_ImgSize_LostFocus(object sender, RoutedEventArgs e) { Properties.Settings.Default.ImgSize = TbImgSize.Text; Properties.Settings.Default.Save(); } private void tb_SavePathSelect_Click(object sender, MouseButtonEventArgs e) { FolderBrowserDialog dialog = new(); if (dialog.ShowDialog()) { TbPathName.Text = dialog.SelectedPath; Properties.Settings.Default.SavePath = dialog.SelectedPath; Properties.Settings.Default.Save(); } } private void Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TbPathName.Text) || string.IsNullOrEmpty(TbImgSize.Text)) { return; } DialogResult = true; } } }