Exemplo n.º 1
0
        private void GenDesignInterface(Control parCtrl, Dictionary <string, EmrAppConfig> configs)
        {
            parCtrl.Controls.Clear();
            int lastTop    = cstInitTop;
            int lastHeight = 0;

            foreach (string key in configs.Keys)
            {
                EmrAppConfig eac  = configs[key];
                Control      ctrl = CreateDesignControl(eac);
                if (ctrl == null)
                {
                    continue;
                }
                ctrl.Tag   = eac;
                ctrl.Left  = cstInitLeft;
                ctrl.Top   = lastTop + lastHeight + cstInitInterval;
                lastTop    = ctrl.Top;
                lastHeight = ctrl.Height;
                if (ctrl.Dock == DockStyle.None)
                {
                    ctrl.Dock = DockStyle.Top;
                }
                //ctrl.Anchor = (AnchorStyles)((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right);

                parCtrl.Controls.Add(ctrl);
            }
        }
Exemplo n.º 2
0
        CaptionEditBox GenCaptionTextBox(EmrAppConfig eac)
        {
            CaptionEditBox ctb = null;

            switch (eac.Ptype)
            {
            case ConfigParamType.Double:
                ctb = new CaptionDoubleBox();
                break;

            case ConfigParamType.Integer:
                ctb = new CaptionIntBox();
                break;

            case ConfigParamType.Color:
                ctb = new CaptionColorBox();
                break;

            default:
                ctb = new CaptionTextBox();
                break;
            }
            ctb.Caption        = eac.Descript;
            ctb.Config         = eac.Config;
            ctb.ConfigChanged += new EventHandler(ctb_ConfigChanged);
            return(ctb);
        }
Exemplo n.º 3
0
        GroupControl GenGroupControl(EmrAppConfig eac)
        {
            GroupControl gctrl = new GroupControl();

            GenDesignInterface(gctrl, eac.SubConfigs);
            return(gctrl);
        }
Exemplo n.º 4
0
 void ValidateUpdateConfigs(EmrAppConfig eac)
 {
     if (_updconfigs.ContainsKey(eac.Key))
     {
         _updconfigs.Remove(eac.Key);
     }
     _updconfigs.Add(eac.Key, eac);
 }
Exemplo n.º 5
0
        RichTextBox GenRichTextBox(EmrAppConfig eac)
        {
            RichTextBox rtb = new RichTextBox();

            rtb.SelectedText = eac.Config;
            rtb.TextChanged += new EventHandler(rtb_TextChanged);
            rtb.Dock         = DockStyle.Fill;
            return(rtb);
        }
Exemplo n.º 6
0
        CheckBox GenCheckBox(EmrAppConfig eac)
        {
            CheckBox cb = new CheckBox();

            cb.Text               = eac.Descript;
            cb.AutoSize           = true;
            cb.Checked            = eac.Config == bool.TrueString;
            cb.CheckStateChanged += new EventHandler(cb_CheckStateChanged);
            return(cb);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 设置编辑器默认值
        /// </summary>
        public static EmrDefaultSetting InitEmrDefaultSet()
        {
            EmrAppConfig eac = m_cfgreader.GetConfig(BasicSettings.EmrDefaultSetting);

            if (eac != null)
            {
                return(new EmrDefaultSetting(eac.Config));
            }
            return(null);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 设置皮肤
        /// </summary>
        public static void InitSkin()
        {
            //string skinName = ConfigurationManager.AppSettings["DevSkin"];
            EmrAppConfig eac = m_cfgreader.GetConfig(BasicSettings.DevSkinConfigKey);

            if (eac != null)
            {
                SetSkin(eac.Config);
                return;
            }
            SetSkin(string.Empty);
        }
Exemplo n.º 9
0
 private Dictionary <string, EmrAppConfig> GetGroupConfigs(EmrAppConfig eac)
 {
     try
     {
         Dictionary <string, EmrAppConfig> configs = new Dictionary <string, EmrAppConfig>();
         configs.Add(eac.Key, eac);
         return(configs);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 10
0
        public static void InitSkin()
        {
            EmrAppConfig config = Util.m_cfgreader.GetConfig("DevSkin");

            if (config != null)
            {
                Util.SetSkin(config.Config);
            }
            else
            {
                Util.SetSkin(string.Empty);
            }
        }
Exemplo n.º 11
0
        public static EmrDefaultSetting InitEmrDefaultSet()
        {
            EmrAppConfig      config = Util.m_cfgreader.GetConfig("EmrDefaultSet");
            EmrDefaultSetting result;

            if (config != null)
            {
                result = new EmrDefaultSetting(config.Config);
            }
            else
            {
                result = null;
            }
            return(result);
        }
Exemplo n.º 12
0
        public static void InitSkin(string userId)
        {
            EmrUserConfig config = Util.m_cfgreader.GetConfig(userId, "DevSkin");

            if (config != null)
            {
                EmrAppConfig defaultConfig = config.GetDefaultConfig();
                if (defaultConfig != null)
                {
                    Util.SetSkin(defaultConfig.Config);
                    return;
                }
            }
            Util.SetSkin(string.Empty);
        }
Exemplo n.º 13
0
        public static void InitSkin(string userId)
        {
            EmrUserConfig euc = m_cfgreader.GetConfig(userId, BasicSettings.DevSkinConfigKey);

            if (euc != null)
            {
                EmrAppConfig eac = euc.GetDefaultConfig();
                if (eac != null)
                {
                    SetSkin(eac.Config);
                    return;
                }
            }
            SetSkin(string.Empty);
        }
Exemplo n.º 14
0
 private void SetApp(DataRow dataRow)
 {
     try
     {
         if (dataRow == null)
         {
             return;
         }
         EmrAppConfig appcfg = appdal.DataRow2EmrAppConfig(dataRow);
         ShowDesignIntface(appcfg);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 15
0
        void rtb_TextChanged(object sender, EventArgs e)
        {
            RichTextBox rtb = sender as RichTextBox;

            if (rtb == null)
            {
                return;
            }
            EmrAppConfig eac = rtb.Tag as EmrAppConfig;

            if (eac == null)
            {
                return;
            }
            eac.Config = rtb.Text;
            ValidateUpdateConfigs(eac);
        }
Exemplo n.º 16
0
        void ctb_ConfigChanged(object sender, EventArgs e)
        {
            CaptionEditBox ctb = sender as CaptionEditBox;

            if (ctb == null)
            {
                return;
            }
            EmrAppConfig eac = ctb.Tag as EmrAppConfig;

            if (eac == null)
            {
                return;
            }
            eac.Config = ctb.Config;
            ValidateUpdateConfigs(eac);
        }
Exemplo n.º 17
0
        void cb_CheckStateChanged(object sender, EventArgs e)
        {
            CheckBox cb = sender as CheckBox;

            if (cb == null)
            {
                return;
            }
            EmrAppConfig eac = (sender as Control).Tag as EmrAppConfig;

            if (eac == null)
            {
                return;
            }
            eac.Config = cb.Checked.ToString();
            ValidateUpdateConfigs(eac);
        }
Exemplo n.º 18
0
        private void ShowDesignIntface(EmrAppConfig eac)
        {
            try
            {
                this.SuspendLayout();
                Dictionary <string, EmrAppConfig> configs = GetGroupConfigs(eac);
                string           assInfo = eac.DesignClass;
                IAppConfigDesign iacd    = null;
                if (string.IsNullOrEmpty(assInfo))
                {
                    //用通用的设置类
                    StandardAppConfigDesign sacd = new StandardAppConfigDesign();
                    iacd = sacd as IAppConfigDesign;
                }
                else
                {
                    _currentConfigDesign = null;
                    Type t = Type.GetType(assInfo);
                    if (t != null)
                    {
                        iacd = (IAppConfigDesign)Activator.CreateInstance(t);
                    }
                }

                _currentConfigDesign = iacd;
                if (iacd == null)
                {
                    throw new ArgumentException("指定的配置类未实现接口(IAppConfigDesign).");
                }
                if (!_cacheUI.ContainsKey(eac.Key))
                {
                    _cacheUI.Add(eac.Key, iacd.DesignUI);
                }
                AddDesignIntface(eac.Name, iacd.DesignUI);
                iacd.Load(m_app, configs);
            }
            catch (Exception e)
            {
                m_app.CustomMessageBox.MessageShow(e.Message, CustomMessageBoxKind.ErrorOk);
            }
            finally
            { this.ResumeLayout(); }
        }
Exemplo n.º 19
0
        private void GetDefaultSeting()
        {
            AppConfigDalc _AppConfigDalc = new AppConfigDalc();

            m_EmrAppConfig = _AppConfigDalc.SelectAppConfig("EmrDefaultSet");
            //XMLCommon;
            if (m_EmrAppConfig == null)
            {
                button3_Click(null, null);
            }
            m_XmlDocument.LoadXml(m_EmrAppConfig.Config);


            //XMLCommon _XMLCommon = new XMLCommon();
            this.comboBox1.SelectedItem  = m_XmlDocument.GetElementsByTagName("fontname").Item(0).InnerText;
            this.comboBox2.Text          = m_XmlDocument.GetElementsByTagName("fontsize").Item(0).InnerText;
            this.comboBox3.SelectedIndex = Convert.ToInt32(Convert.ToDouble(m_XmlDocument.GetElementsByTagName("linespace").Item(0).InnerText) * 2);
            this.comboBox4.SelectedItem  = m_XmlDocument.GetElementsByTagName("elestyle").Item(0).InnerText;
            this.labelColor.BackColor    = ColorTranslator.FromHtml(m_XmlDocument.GetElementsByTagName("elecolor").Item(0).InnerText);
            this.checkBox1.Checked       = false;
        }
Exemplo n.º 20
0
        private Control CreateDesignControl(EmrAppConfig eac)
        {
            switch (eac.Ptype)
            {
            case ConfigParamType.Boolean:
                return(GenCheckBox(eac));

            case ConfigParamType.Set:
                return(GenGroupControl(eac));

            case ConfigParamType.Color:
            case ConfigParamType.Double:
            case ConfigParamType.Integer:
            case ConfigParamType.String:
                return(GenCaptionTextBox(eac));

            case ConfigParamType.Var:
            case ConfigParamType.Xml:
                return(GenRichTextBox(eac));

            default:
                return(null);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 保存操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtcanshu.Text) || string.IsNullOrEmpty(txtcanshudesp.Text) || string.IsNullOrEmpty(txtcanshuname.Text) || string.IsNullOrEmpty(txtcanshutype.Text))
                {
                    m_app.CustomMessageBox.MessageShow("请确认所有项已经填写完毕");
                    return;
                }
                DataRow dataRow = gridView1.GetDataRow(gridView1.FocusedRowHandle);
                if (dataRow == null)
                {
                    return;
                }

                if (_currentConfigDesign != null)
                {
                    _currentConfigDesign.Save();
                    if (_currentConfigDesign.ChangedConfigs != null)
                    {
                        EmrAppConfig eac = new EmrAppConfig();
                        foreach (string key in _currentConfigDesign.ChangedConfigs.Keys)
                        {
                            eac = _currentConfigDesign.ChangedConfigs[key];//key
                            dataRow["value"] = eac.Config;
                        }
                        //以前的是ConfigKey改变了,才进行更新,此处改为更新一处就更新操作
                        eac.Config   = dataRow["value"].ToString();
                        eac.Key      = txtcanshu.Text;     //参数
                        eac.Name     = txtcanshuname.Text; //参数名称
                        eac.Descript = txtcanshudesp.Text; //参数描述
                        // bool isvalid = false;//定义是否有效
                        //if (txtvalid.Text == "1")
                        //if (cmdValid.SelectedText == "1")
                        //{
                        //    isvalid = true;
                        //}
                        eac.Valid = true;//是否有效
                        //if (cmdValid.SelectedIndex == 1)
                        //{
                        eac.Valid1 = "1";//是否有效
                        //}
                        //else
                        //{
                        //    eac.Valid1 = "0";
                        //}

                        if (cmdHide.SelectedIndex == 1)
                        {
                            eac.IsHide = "1";//隐藏标志
                        }
                        else
                        {
                            eac.IsHide = "0";
                        }
                        //eac.Valid1 = cmdValid.SelectedText;//是否有效
                        //eac.IsHide = cmdHide.SelectedText;//隐藏标志
                        appdal.UpdateEmrAppConfig(eac);
                        m_app.CustomMessageBox.MessageShow("保存成功");
                        txtQuery.Text = string.Empty;
                        BindData(sql_Query, "");//王冀//edit by xlb 2012-12-28
                    }
                }
            }
            catch (Exception ex)
            {
                m_app.CustomMessageBox.MessageShow(ex.Message);
            }
        }