Example #1
0
        public static void initialCodeList()
        {
            dicColor.Clear();
            string filePathColor = Path.Combine(cProjectManager.dirPathUserData, "colorCode.txt");

            if (!File.Exists(filePathColor))
            {
                File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "code", "colorCode.txt"), filePathColor);
            }
            if (File.Exists(filePathColor))
            {
                using (StreamReader sr = new StreamReader(filePathColor, System.Text.Encoding.UTF8))
                {
                    String line;
                    int    _indexLine = 0;
                    while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                    {
                        _indexLine++;
                        string[] split = line.Trim().Split(new char[] { ' ', '\t', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                        if (split.Length >= 2)
                        {
                            dicColor.Add(split[0], split[1]);
                        }
                    }
                } //end using
            }     //end if

            string filePath = Path.Combine(cProjectManager.dirPathUserData, "ItemCode.txt");

            if (!File.Exists(filePath))
            {
                File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "code", "ItemCode.txt"), filePath);
            }
            else
            {
                ltCodeItem.Clear();
                using (StreamReader sr = new StreamReader(filePath, System.Text.Encoding.UTF8))
                {
                    String line;
                    int    _indexLine = 0;
                    while ((line = sr.ReadLine()) != null)     //delete the line whose legth is 0
                    {
                        _indexLine++;
                        string[] split = line.Trim().Split(new char[] { ' ', '\t', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                        if (split.Length > 5)
                        {
                            ItemCode item = new ItemCode();
                            item.codeType    = split[0];
                            item.chineseName = split[1];
                            item.sCode       = split[2];
                            item.fileName    = split[3];
                            item.scale       = float.Parse(split[4]) * 0.01;
                            item.englishName = split[5];
                            ltCodeItem.Add(item);
                        }
                    }
                } //end using
            }     //end if
        }
Example #2
0
        public FormSectionAddItemLitho(string _filePathTemple, string _sIDTrack, string _sIDdataItem)
        {
            InitializeComponent();
            this.filePathTemple = _filePathTemple;
            this.sJH            = cXmlDocSectionWell.getJH(filePathTemple);
            sIDTrack            = _sIDTrack;
            item.sID            = _sIDdataItem;
            itemDrawDataIntervalValue curItem = cXmlDocSectionWell.getDataItemValueByID(filePathTemple, item.sID);

            this.nTBXTopDepth.Text = curItem.top.ToString();
            this.nTBXBotDepth.Text = curItem.bot.ToString();
            List <string> ltColor = cProjectManager.dicColor.Keys.ToList();

            cPublicMethodForm.inialComboBox(this.cbbColor, ltColor);
            string sHexColor = curItem.sProperty;

            cbbColor.Items.Insert(0, sHexColor);
            cbbColor.SelectedIndex = 0;
            string        sLithoName    = curItem.sText;
            ItemCode      inputCode     = cProjectManager.ltCodeItem.FirstOrDefault(p => p.chineseName == sLithoName);
            List <string> ltStrRockType = cProjectManager.ltCodeItem.Select(p => p.codeType).Distinct().ToList();

            cPublicMethodForm.inialComboBox(this.cbbType, ltStrRockType);
            if (inputCode != null)
            {
                cbbType.SelectedItem = inputCode.codeType;
                initialCbbRock(inputCode.codeType);
                cbbItemLitho.SelectedItem = inputCode.chineseName;
            }

            this.filePathTemple = _filePathTemple;

            nUDGrainSize.Value          = (decimal)curItem.fValue;
            this.btnOK.DialogResult     = DialogResult.OK;
            this.btnCancel.DialogResult = DialogResult.Cancel;
        }
Example #3
0
        private void cbbItemLitho_SelectedIndexChanged(object sender, EventArgs e)
        {
            ItemCode inputCode = cProjectManager.ltCodeItem.FirstOrDefault(p => p.chineseName == cbbItemLitho.SelectedItem.ToString());

            this.nUDGrainSize.Value = (decimal)inputCode.scale;
        }