using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.BGResultManager.ViewModel; using Kingo.PluginServiceInterface; using System; using System.Windows; namespace Kingo.Plugin.BGResultManager.View { /// /// FrmResultsExportForBG.xaml 的交互逻辑 /// public partial class FrmResultsExportForBG : BaseWindow { public FrmResultsExportForBG() { try { InitializeComponent(); if ((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjSuffix == ".KBG") { DataContext = new ExportBGViewModel(); } } catch (Exception ex) { LogAPI.Debug("一键成果导出 异常: " + ex + " ; "); } } private void btnSelectDir_Click(object sender, RoutedEventArgs e) { try { System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.Description = "请选择文件夹路径"; folderBrowserDialog.ShowNewFolderButton = true; if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.LastSelectedFolder) && System.IO.Directory.Exists(Properties.Settings.Default.LastSelectedFolder)) { folderBrowserDialog.SelectedPath = Properties.Settings.Default.LastSelectedFolder; } else { folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop; } if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } Properties.Settings.Default.LastSelectedFolder = folderBrowserDialog.SelectedPath.ToString(); Properties.Settings.Default.Save(); if (string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath)) { return; } txtOutDir.Text = folderBrowserDialog.SelectedPath; } catch (Exception ex) { LogAPI.Debug("一键变更成果导出 期间 选择保存目录 时失败,异常原因: " + ex + " ; "); } } private void btnSelectNCData_Click(object sender, RoutedEventArgs e) { try { MessageHelper.ShowTips("请选择基础数据汇总表格,如:.../基础数据包"); System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog.Description = "请选择文件夹路径"; folderBrowserDialog.ShowNewFolderButton = true; if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.LastSelectedFolder) && System.IO.Directory.Exists(Properties.Settings.Default.LastSelectedFolder)) { folderBrowserDialog.SelectedPath = Properties.Settings.Default.LastSelectedFolder; } else { folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop; } if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } Properties.Settings.Default.LastSelectedFolder = folderBrowserDialog.SelectedPath.ToString(); Properties.Settings.Default.Save(); if (string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath)) { return; } txtNCData.Text = folderBrowserDialog.SelectedPath; } catch (Exception ex) { LogAPI.Debug("一键变更成果导出 期间 选择基础数据 时失败,异常原因: " + ex + " ; "); } } private void btnCancel_Click(object sender, RoutedEventArgs e) { Close(); } } }