using KGIS.Framework.OpenData.Control; using KGIS.Framework.OpenData.Filter; using KGIS.Framework.OpenData.InterFace; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.BGResultManager.ViewModel; using System; using System.Windows; using System.Windows.Forms; namespace Kingo.Plugin.BGResultManager.View { /// /// FrmResultsExportForTheBGNMK.xaml 的交互逻辑 /// public partial class FrmResultsExportForTheBGNMK : BaseWindow { public string sTheNMKPath; public FrmResultsExportForTheBGNMK() { InitializeComponent(); //txtNMKDir.IsReadOnly = true; DataContext = new ExportBGNMKViewModel(); } private void btnSelectDir_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); //dialog.IsFolderPicker = true; System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { txtOutDir.Text = dialog.SelectedPath; } } private void btnCancel_Click(object sender, RoutedEventArgs e) { this.Close(); } private void BtnSelectNMKDir_Click(object sender, RoutedEventArgs e) { try { //txtNMKDir.Text = ""; sTheNMKPath = ""; OpenDataDialog pDialog = new OpenDataDialog(); ISpatialDataObjectFilter pOFilter; pOFilter = new FilterGeoDatabaseFile(); pDialog.AddFilter(pOFilter, true); pDialog.AllowMultiSelect = false; pDialog.Title = "选择年末库数据"; pDialog.RestoreLocation = true; pDialog.StartLocation = pDialog.FinalLocation; System.Windows.Forms.DialogResult dialogResult = pDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count != 0) { if (pDialog.Selection.Count > 1) { sTheNMKPath = ""; MessageHelper.ShowTips("请选择一个年末库数据"); return; } else { //sTheNMKPath = System.IO.Path.GetDirectoryName(pDialog.Selection[0].FullName); sTheNMKPath = pDialog.Selection[0].FullName; //txtNMKDir.Text = sTheNMKPath; } } } catch (Exception ex) { sTheNMKPath = ""; LogAPI.Debug("年末库一键成果导出时 选择年末库失败,异常原因: " + ex + " ; "); return; } } } }