예제 #1
0
 private void PreferenceDlg_Load(object sender, System.EventArgs e)
 {
     if (ap != null)
     {
         textBox_pinyin_pinyinDbPath.Text = ap.GetString("pinyin",
                                                         "pinyin_db_path",
                                                         "");
     }
     else
     {
         button_OK.Enabled = false;
     }
 }
예제 #2
0
파일: HostArray.cs 프로젝트: zszqwe/dp2
        // 从ini文件或者registry装载已经配置的所有主机事项
        public static ArrayList LoadHosts(ApplicationInfo appInfo)
        {
            ArrayList saResult = new ArrayList();

            for (int i = 0; ; i++)
            {
                string strEntry = "entry" + Convert.ToString(i + 1);

                string strValue = appInfo.GetString("ServerAddress",
                                                    strEntry,
                                                    "");
                if (strValue == "")
                {
                    break;
                }
                saResult.Add(strValue);
            }

            return(saResult);
        }
예제 #3
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);
                }
            }
        }
예제 #4
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);
             */
        }