Ejemplo n.º 1
0
        private void SearchPropertyDlg_Load(object sender, System.EventArgs e)
        {
            if (ap == null || CfgTitle == "")
            {
                return;
            }

            textBox_maxCount.Text                = Convert.ToString(ap.GetInt(CfgTitle, "maxcount", -1));
            checkBox_autoDetectRange.Checked     = Convert.ToBoolean(ap.GetInt(CfgTitle, "auto_detect_range", 0));
            checkBox_autoDetectRelation.Checked  = Convert.ToBoolean(ap.GetInt(CfgTitle, "auto_detect_relation", 0));
            this.checkBox_autoSplitWords.Checked = Convert.ToBoolean(ap.GetInt(CfgTitle, "auto_split_words", 1));
        }
Ejemplo n.º 2
0
        public List <TemplatePageParam> TemplatePages = new List <TemplatePageParam>(); // 定制的页面

        // 从Application对象中装载数据
        public virtual void LoadData(ApplicationInfo ai,
                                     string strPath)
        {
            this.PageHeader = ai.GetString(strPath,
                                           "PageHeader", this.PageHeaderDefault);

            // "%date% 册移交清单 - %barcodefilename% - (共 %pagecount% 页)");
            this.PageFooter = ai.GetString(strPath,
                                           "PageFooter", this.PageFooterDefault);
            // "%pageno%/%pagecount%");

            this.TableTitle = ai.GetString(strPath,
                                           "TableTitle", this.TableTitleDefault);

            // "%date% 册移交清单");

            this.LinesPerPage = ai.GetInt(strPath,
                                          "LinesPerPage", this.LinesPerPageDefault);

            // 20);

            int nCount = ai.GetInt(strPath, "ColumnsCount", 0);

            if (nCount != 0) // 只有当外部存储中有配置信息时,才清除构造函数创建的缺省信息
            {
                Columns.Clear();
                for (int i = 0; i < nCount; i++)
                {
                    string strColumnName = ai.GetString(strPath,
                                                        "ColumnName_" + i.ToString(),
                                                        "");
                    if (String.IsNullOrEmpty(strColumnName) == true)
                    {
                        break;
                    }

                    string strColumnCaption = ai.GetString(strPath,
                                                           "ColumnCaption_" + i.ToString(),
                                                           "");

                    int nMaxChars = ai.GetInt(strPath,
                                              "ColumnMaxChars_" + i.ToString(),
                                              -1);
                    int nWidthChars = ai.GetInt(strPath,
                                                "ColumnWidthChars_" + i.ToString(),
                                                -1);

                    string strEvalue = ai.GetString(strPath,
                                                    "ColumnEvalue_" + i.ToString(),
                                                    "");

                    Column column = new Column();
                    column.Name       = strColumnName;
                    column.Caption    = strColumnCaption;
                    column.WidthChars = nWidthChars;
                    column.MaxChars   = nMaxChars;
                    column.Evalue     = strEvalue;

                    this.Columns.Add(column);
                }
            }

            nCount = ai.GetInt(strPath, "TemplatePagesCount", 0);
            if (nCount != 0) // 只有当外部存储中有配置信息时,才清除构造函数创建的缺省信息
            {
                this.TemplatePages.Clear();
                for (int i = 0; i < nCount; i++)
                {
                    TemplatePageParam param = new TemplatePageParam();
                    param.Caption = ai.GetString(strPath,
                                                 "TemplateCaption_" + i.ToString(),
                                                 "");
                    param.FilePath = ai.GetString(strPath,
                                                  "TemplateFilePath_" + i.ToString(),
                                                  "");

                    Debug.Assert(String.IsNullOrEmpty(this.DataDir) == false, "");

                    // 把带有宏的路径兑现为实际路径。这里要用到 this.DataDir
                    param.FilePath = UnMacroPath(param.FilePath);

                    Debug.Assert(param.FilePath.IndexOf("%") == -1, "去除宏以后的路径字符串里面不能有%符号");

                    this.TemplatePages.Add(param);
                }
            }
        }
Ejemplo n.º 3
0
        private void CompileErrorDlg_Load(object sender, System.EventArgs e)
        {
            // 恢复窗口尺寸
            int nWindowWidth = applicationInfo.GetInt("code_editor",
                                                      "window_width",
                                                      -1);
            int nWindowHeight = applicationInfo.GetInt("code_editor",
                                                       "window_height",
                                                       -1);

            if (nWindowHeight != -1)
            {
                this.Size = new Size(nWindowWidth, nWindowHeight);

                int x = applicationInfo.GetInt("code_editor",
                                               "window_x",
                                               0);
                int y = applicationInfo.GetInt("code_editor",
                                               "window_y",
                                               0);
                this.Location = new Point(x, y);
            }

            this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState),
                                                           applicationInfo.GetString(
                                                               "code_editor", "window_state", "Normal"));


            string strFontFace1 = applicationInfo.GetString("code_editor",
                                                            "code_font_face",
                                                            "Lucida Console");
            int nFontSize1 =
                applicationInfo.GetInt("code_editor",
                                       "code_font_size",
                                       9);

            textBox_code.Font = new Font(strFontFace1, nFontSize1);

            string strFontFace2 = applicationInfo.GetString("code_editor",
                                                            "error_font_face",
                                                            "Lucida Console");
            int nFontSize2 =
                applicationInfo.GetInt("code_editor",
                                       "error_font_size",
                                       9);

            textBox_errorInfo.Font = new Font(strFontFace2, nFontSize2);


            if (label_codeFileName.Text != "")
            {
                bFirst = true;

#if NO
                // 源代码本身
                try
                {
                    using (StreamReader sr = new StreamReader(label_codeFileName.Text, true))
                    {
                        textBox_code.Text = sr.ReadToEnd();
                    }
                }
                catch
                {
                    textBox_code.Text = "";
                }
#endif
                {
                    string strError = "";
                    string strCode  = "";
                    int    nRet     = ScriptManager.LoadCode(label_codeFileName.Text,
                                                             out strCode,
                                                             out strError);
                    if (nRet == -1)
                    {
                        this.textBox_code.Text = "";
                    }
                    else
                    {
                        this.textBox_code.Text = strCode;
                    }
                }

                bFirst = false;

                /*
                 * // tabstop 为什么不起作用?
                 *
                 * int [] tabstops = {8};
                 * API.SetEditTabStops(textBox_code, tabstops);
                 * textBox_code.Invalidate();
                 */
            }

            /*
             * textBox_errorInfo.Focus();
             * API.SetEditCurrentCaretPos(
             *  textBox_errorInfo,
             *  0,
             *  0,
             *  true);
             */
        }