You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							113 lines
						
					
					
						
							3.7 KiB
						
					
					
				
			
		
		
	
	
							113 lines
						
					
					
						
							3.7 KiB
						
					
					
				using KGIS.Framework.Utils; | 
						|
using KGIS.Framework.Utils.Helper; | 
						|
using Kingo.PluginServiceInterface; | 
						|
using System; | 
						|
using System.Collections.Generic; | 
						|
using System.Windows; | 
						|
using System.Windows.Controls; | 
						|
 | 
						|
namespace Kingo.Plugin.SystemSetting.View.ViewSystemSetting | 
						|
{ | 
						|
    /// <summary> | 
						|
    /// 系统设置-外业信息设置 的交互逻辑 | 
						|
    /// </summary> | 
						|
    public partial class ViewWYInfoSetting : UserControl | 
						|
    { | 
						|
        private WYZPCfg _selectedLayerInfo = null; | 
						|
        private List<WYZPCfg> wYZPCfgs = null; | 
						|
        public WYZPCfg SelectedLayerInfo | 
						|
        { | 
						|
            get { return _selectedLayerInfo; } | 
						|
            set | 
						|
            { | 
						|
                _selectedLayerInfo = value; | 
						|
            } | 
						|
        } | 
						|
        public ViewWYInfoSetting() | 
						|
        { | 
						|
            InitializeComponent(); | 
						|
            this.Loaded += (s, e) => | 
						|
            { | 
						|
                wYZPCfgs = this.DataContext as List<WYZPCfg>; | 
						|
                LoadJZCGLayerInfo(); | 
						|
            }; | 
						|
        } | 
						|
 | 
						|
        private void LoadJZCGLayerInfo() | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                dgCtrl.ItemsSource = null; | 
						|
                dgCtrl.ItemsSource = wYZPCfgs; | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug("获取外业信息配置文件失败:" + ex); | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        //添加 | 
						|
        private void btnAdd_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            FrmWYInfoSetting frmWYInfoSetting = new FrmWYInfoSetting(true, null, wYZPCfgs) | 
						|
            { | 
						|
                Refresh = LoadJZCGLayerInfo, | 
						|
                Title = "添加外业信息图层", | 
						|
                WindowStartupLocation = WindowStartupLocation.CenterScreen | 
						|
            }; | 
						|
            frmWYInfoSetting.ShowInMainWindow(true); | 
						|
        } | 
						|
 | 
						|
        //修改 | 
						|
        private void btnUpdate_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            if (this.SelectedLayerInfo == null) | 
						|
            { | 
						|
                MessageHelper.Show("未选中需要修改的图层,请选择需要修改的图层,在进行修改!"); | 
						|
                return; | 
						|
            } | 
						|
            FrmWYInfoSetting frmWYInfoSetting = new FrmWYInfoSetting(false, SelectedLayerInfo, wYZPCfgs) | 
						|
            { | 
						|
                Refresh = LoadJZCGLayerInfo, | 
						|
                Title = "修改外业信息图层", | 
						|
                WindowStartupLocation = WindowStartupLocation.CenterScreen | 
						|
            }; | 
						|
            frmWYInfoSetting.ShowInMainWindow(true); | 
						|
        } | 
						|
        /// <summary> | 
						|
        /// 全选/反选 | 
						|
        /// </summary> | 
						|
        /// <param name="sender"></param> | 
						|
        /// <param name="e"></param> | 
						|
        private void CheckAll_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (this.dgCtrl.ItemsSource == null) | 
						|
                    return; | 
						|
                List<WYZPCfg> baseDataSettingList = this.dgCtrl.ItemsSource as List<WYZPCfg>; | 
						|
                if (baseDataSettingList == null || baseDataSettingList.Count <= 0) return; | 
						|
                for (int i = 0; i < baseDataSettingList.Count; i++) | 
						|
                { | 
						|
                    if (this.checkAll.IsChecked == true) | 
						|
                        baseDataSettingList[i].IsCheck = true; | 
						|
                    else | 
						|
                        baseDataSettingList[i].IsCheck = false; | 
						|
                } | 
						|
                this.dgCtrl.RefreshData(); | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug("全选/反选失败:" + ex); | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        private void dgCtrl_SelectedItemChanged(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e) | 
						|
        { | 
						|
            if (this.dgCtrl.SelectedItem != null) | 
						|
            { | 
						|
                SelectedLayerInfo = this.dgCtrl.SelectedItem as WYZPCfg; | 
						|
            } | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |