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.
		
		
		
		
		
			
		
			
				
					
					
						
							89 lines
						
					
					
						
							2.8 KiB
						
					
					
				
			
		
		
	
	
							89 lines
						
					
					
						
							2.8 KiB
						
					
					
				using KGIS.Framework.Utils; | 
						|
using KGIS.Framework.Utils.Helper; | 
						|
using Kingo.PluginServiceInterface; | 
						|
using System; | 
						|
using System.Windows; | 
						|
 | 
						|
namespace Kingo.Plugin.MapView.Views.AppMenuView | 
						|
{ | 
						|
    /// <summary> | 
						|
    /// 单图斑设置工程用户信息 的交互逻辑 | 
						|
    /// </summary> | 
						|
    public partial class UCProjectInfoSetting : BaseWindow | 
						|
    { | 
						|
        private ProjectInfo projectInfo { get; set; } | 
						|
        private bool IsFirstLoad = false; | 
						|
        public UCProjectInfoSetting() | 
						|
        { | 
						|
            InitializeComponent(); | 
						|
            projectInfo = KGIS.Framework.Maps.MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; | 
						|
            if (projectInfo == null) | 
						|
            { | 
						|
                MessageHelper.Show("未检查到加载工程信息!"); | 
						|
                return; | 
						|
            } | 
						|
            if (!string.IsNullOrWhiteSpace(projectInfo.UserName)) | 
						|
            { | 
						|
                this.txtUserName.Text = projectInfo.UserName; | 
						|
            } | 
						|
            else | 
						|
            { | 
						|
                IsFirstLoad = true; | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        private void BtnSave_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (string.IsNullOrWhiteSpace(txtUserName.Text)) | 
						|
                { | 
						|
                    MessageHelper.Show("请输入用户名!"); | 
						|
                    return; | 
						|
                } | 
						|
                if (projectInfo == null) | 
						|
                { | 
						|
                    MessageHelper.Show("未检查到加载工程信息!"); | 
						|
                    return; | 
						|
                } | 
						|
                projectInfo.UserName = txtUserName.Text; | 
						|
                projectInfo.Save(); | 
						|
                if (IsFirstLoad) | 
						|
                    MessageHelper.ShowTips("设置用户名成功,请进行基础数据加载!"); | 
						|
                else | 
						|
                    MessageHelper.ShowTips("设置用户名成功!"); | 
						|
                this.Close(); | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug(ex); | 
						|
                MessageHelper.Show("用户信息设置失败:" + ex.Message); | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        private void BtnCancel_Click(object sender, RoutedEventArgs e) | 
						|
        { | 
						|
            if (string.IsNullOrWhiteSpace(txtUserName.Text)) | 
						|
            { | 
						|
                MessageHelper.Show("请输入用户名!"); | 
						|
                return; | 
						|
            } | 
						|
            this.Close(); | 
						|
        } | 
						|
 | 
						|
        private void BtnClose_Click(object sender, EventArgs e) | 
						|
        { | 
						|
            if (!string.IsNullOrWhiteSpace(txtUserName.Text)) | 
						|
            { | 
						|
                Close(); | 
						|
            } | 
						|
            else | 
						|
            { | 
						|
                MessageHelper.Show("请输入用户名!"); | 
						|
                UCProjectInfoSetting uC = new UCProjectInfoSetting(); | 
						|
                uC.WindowStartupLocation = WindowStartupLocation.CenterScreen; | 
						|
                uC.Show(); | 
						|
            } | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |