Ejemplo n.º 1
0
        /// <summary>
        /// 初始化窗体
        /// </summary>
        private void InitForm()
        {
            //获取设置
            this.lbErrMessage.Visible = false;
            EditServiceSetting        = ConfigService.GetServiceSetting(EditServerConfig);
            this.txtServerName.Text   = EditServiceSetting.ServiceName;
            this.txtDisplayName.Text  = EditServiceSetting.DisplayName;
            this.txtDescription.Text  = EditServiceSetting.Description;

            //设置参数
            IsSaved           = false;
            EditServiceConfig = ConfigService.GetServiceConfig(EditServerConfig);
            if (EditServiceConfig == null)
            {
                return;
            }
            this.txtServerIP.Text              = EditServiceConfig.serverIP;
            this.txtServerPort.Text            = EditServiceConfig.serverPort;
            this.txtServerAET.Text             = EditServiceConfig.serverAET;
            this.txtClientAET.Text             = EditServiceConfig.clientAET;
            this.txtClientPort.Text            = EditServiceConfig.clientPort;
            this.txtCacheDays.Text             = EditServiceConfig.cacheDays;
            this.txtDeviceType.Text            = EditServiceConfig.deviceType;
            this.txtLoopSeconds.Text           = EditServiceConfig.loopSeconds;
            this.chkIsRealTime.Checked         = EditServiceConfig.isRealTime;
            this.chkIsOnlyArrived.Checked      = EditServiceConfig.isOnlyArrived;
            this.txtSetAETitle.Text            = EditServiceConfig.setAETitle;
            this.chkIsConvertPatientId.Checked = !EditServiceConfig.isNotConvertPatientId;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取服务
        /// </summary>
        /// <returns></returns>
        public static Model.ServiceSetting GetServiceSetting(Model.ServerConfig serverConfig)
        {
            Model.ServiceSetting serviceConfig = new Model.ServiceSetting();
            string path = StartupPath + "\\" + serverConfig.FileFloderName + serviceSettingPath;

            if (File.Exists(path))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(path);
                XmlNode xn = doc.SelectSingleNode("Settings/ServiceName");
                serviceConfig.ServiceName = xn.InnerText;
                xn = doc.SelectSingleNode("Settings/DisplayName");
                serviceConfig.DisplayName = xn.InnerText;
                xn = doc.SelectSingleNode("Settings/Description");
                serviceConfig.Description = xn.InnerText;
                doc = null;
            }
            return(serviceConfig);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存设置
        /// </summary>
        private bool SaveConfig()
        {
            if (string.IsNullOrEmpty(EditServerConfig.ServerID))
            {
                EditServerConfig.ServerID = Guid.NewGuid().ToString();
            }
            EditServerConfig.ServerName = this.txtServerName.Text;
            if (string.IsNullOrEmpty(EditServerConfig.FileFloderName))
            {
                EditServerConfig.FileFloderName = EditServerConfig.ServerID;
            }

            EditServiceSetting             = new Model.ServiceSetting();
            EditServiceSetting.ServiceName = this.txtServerName.Text;
            EditServiceSetting.DisplayName = this.txtDisplayName.Text;
            EditServiceSetting.Description = this.txtDescription.Text;

            EditServiceConfig                       = new Model.ServiceConfig();
            EditServiceConfig.serverIP              = this.txtServerIP.Text;
            EditServiceConfig.serverPort            = this.txtServerPort.Text;
            EditServiceConfig.serverAET             = this.txtServerAET.Text;
            EditServiceConfig.clientAET             = this.txtClientAET.Text;
            EditServiceConfig.clientPort            = this.txtClientPort.Text;
            EditServiceConfig.cacheDays             = this.txtCacheDays.Text;
            EditServiceConfig.deviceType            = this.txtDeviceType.Text;
            EditServiceConfig.loopSeconds           = this.txtLoopSeconds.Text;
            EditServiceConfig.isRealTime            = this.chkIsRealTime.Checked;
            EditServiceConfig.isOnlyArrived         = this.chkIsOnlyArrived.Checked;
            EditServiceConfig.setAETitle            = this.txtSetAETitle.Text;
            EditServiceConfig.isNotConvertPatientId = !this.chkIsConvertPatientId.Checked;

            bool isSaved = ConfigService.SaveNewService(EditServerConfig, EditServiceConfig, EditServiceSetting);

            if (!isSaved)
            {
                Err = ConfigService.Err;
            }

            return(isSaved);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存设置
        /// </summary>
        /// <param name="serverConfig"></param>
        /// <param name="serviceSetting"></param>
        public static void SaveSetting(Model.ServerConfig serverConfig, Model.ServiceSetting serviceSetting)
        {
            string xmlFileName = StartupPath + "\\" + serverConfig.FileFloderName + serviceSettingPath;

            XmlSerialize(xmlFileName, serviceSetting);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存新服务
        /// </summary>
        /// <param name="serverConfig"></param>
        /// <param name="serviceConfig"></param>
        /// <param name="serviceSetting"></param>
        public static bool SaveNewService(Model.ServerConfig serverConfig, Model.ServiceConfig serviceConfig, Model.ServiceSetting serviceSetting)
        {
            Err = string.Empty;
            try
            {
                CopyService(serverConfig);
                SaveSetting(serverConfig, serviceSetting);
                SaveConfig(serverConfig, serviceConfig);

                SaveConfigList(serverConfig);
            }
            catch (Exception ex)
            {
                Err = ex.Message;
                return(false);
            }
            return(true);
        }