12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using MV485.helper;
- using Ookii.Dialogs.Wpf;
- using System;
- using System.Collections.Generic;
- using System.IO;
- 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;
- namespace MV485.Dlg
- {
- /// <summary>
- /// DlgSaveImagePath.xaml 的交互逻辑
- /// </summary>
- public partial class DlgSaveImagePath : Window
- {
- //默认的图像保存路径
- public static string DefaultImagePath =
- Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wm_image");
- //private string _selectedSavePath = "";
- public DlgSaveImagePath()
- {
- InitializeComponent();
- //获取图像保存路径
- string savePath = ConfigManager.Instance.GetConfigValue(ConfigKey.SaveImagePath, DefaultImagePath);
- txtImagePath.Text = savePath;
- }
- private void BtnBrowser_Click(object sender, RoutedEventArgs e)
- {
- var dialog = new VistaFolderBrowserDialog();
- //dialog.Description = "请选择目标图像输出文件夹";
- dialog.Description = "请选择数据监听时图像数据的保存文件夹";
- dialog.UseDescriptionForTitle = true; // 使用 Description 作为窗口标题
- // 显示对话框并检查用户是否点击了“确定”
- if (dialog.ShowDialog() == true)
- {
- // 获取用户选择的文件夹路径
- string selectedFolderPath = dialog.SelectedPath;
- //mConfigItem.Output = selectedFolderPath;
- //_selectedSavePath = selectedFolderPath;
- txtImagePath.Text = selectedFolderPath;
- }
- }
- private void BtnOK_Click(object sender, RoutedEventArgs e)
- {
- if(string.IsNullOrEmpty(txtImagePath.Text))
- {
- MessageBox.Show("文件夹不能为空", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
- return;
- }
- ConfigManager.Instance.UpdateConfig(ConfigKey.SaveImagePath, txtImagePath.Text.Trim());
- DialogResult = true;
- this.Close();
- }
- private void BtnClose_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
- //-------------------------------------------------------
- }
- }
|