Пример #1
0
 private void tsmiRename_Click(object sender, EventArgs e)
 {
     setupDir();
     if (lvFileGeo.SelectedItems.Count > 0)
     {
         ListViewItem selectItem = lvFileGeo.SelectedItems[0];
         string       fileName   = selectItem.SubItems[0].Text;
         FormInputBox inputBox   = new FormInputBox("新文件名:", "请输入:", fileName);
         var          result     = inputBox.ShowDialog();
         if (result == DialogResult.OK)
         {
             string filePath         = Path.Combine(dirCurrent, fileName);
             string newInputFileName = inputBox.ReturnValueStr;
             string newfilepath      = Path.Combine(dirCurrent, newInputFileName);
             bool   bDelete          = checkRenameSameFile(newfilepath);
             if (bDelete == true)
             {
                 File.Copy(filePath, newfilepath, bDelete); //用新文件名保存,
                 File.Delete(filePath);                     //删除原文件
                 lvFileGeo.Items.Remove(selectItem);
             }
             addItem2LV(newfilepath);
         }
     }
 }
Пример #2
0
        private void tsmiAdd2Project_Click(object sender, EventArgs e)
        {
            //把表格数据保存到temp文件夹中,测井数据格式
            FormInputBox inputBox = new FormInputBox("请输入系列名称:", "新系列名称:");
            var          result   = inputBox.ShowDialog();

            if (result == DialogResult.OK)
            {
                foreach (string _sJH in cProjectData.ltStrProjectJH)
                {
                    cIOinputLayerDepth.deleteFile(_sJH);
                }
                string        sLogName       = inputBox.ReturnValueStr; //分层方案名 作为id 存values preserved after close
                string        logFilePath    = Path.Combine(cProjectManager.dirPathWellDir, sJH, sLogName + cProjectManager.fileExtensionWellLog);
                string        filePathTemp   = Path.Combine(cProjectManager.dirPathTemp, sJH + sLogName + cProjectManager.fileExtensionWellLog);
                string        _firstLine     = sJH + " " + sLogName + " source:" + " " + DateTime.Now.ToString();
                List <string> _ltLogFileHead = new List <string>();
                _ltLogFileHead.Add("Depth");
                _ltLogFileHead.Add(sLogName);
                cIOGeoEarthText.creatFileGeoHeadText(filePathTemp, _firstLine, _ltLogFileHead);
                List <string> ltLineWrited = cPublicMethodForm.readDataGridView2ListLine(dgvDataTable);
                cIOGeoEarthText.addDataLines2GeoEarTxt(filePathTemp, ltLineWrited);
                // 检查是否有同名的测井数据文件,如果有让用户确认是否覆盖,不存在的话直接
                bool bDelete = cIOinputLog.checkRenameSameFile(logFilePath);
                if (bDelete == true)
                {
                    File.Copy(filePathTemp, logFilePath, bDelete);
                    MessageBox.Show("导出完成。");
                }
            }
        }
Пример #3
0
        private void tsmiSave_Click(object sender, EventArgs e)
        {
            //保存到项目用户目录下文件
            FormInputBox inputBox = new FormInputBox("保存入项目用户目录:", "请输入保存文件名");
            var          result   = inputBox.ShowDialog();

            if (result == DialogResult.OK)
            {
                string strFileName = inputBox.ReturnValueStr;          //分层方案名 作为id 存values preserved after close
                if (strFileName != "")
                {
                    string newSaveFile = Path.Combine(cProjectManager.dirPathUsedProjectData, strFileName + cProjectManager.fileExtensionSectionWell);
                    if (File.Exists(newSaveFile))
                    {
                        DialogResult dialogResult = MessageBox.Show("文件已存在,是否覆盖保存", "警告", MessageBoxButtons.YesNo);

                        if (dialogResult == DialogResult.Yes)
                        {
                            File.Copy(this.filePathOper, newSaveFile, true);
                            MessageBox.Show("保存至用户库:" + strFileName);
                        }
                        else if (dialogResult == DialogResult.No)
                        {
                            MessageBox.Show("未覆盖保存。");
                            //do something else
                        }
                    }
                    else
                    {
                        File.Copy(this.filePathOper, newSaveFile, true);
                        MessageBox.Show("保存至用户库:" + strFileName);
                    }
                }
            }
        }
Пример #4
0
        public static void save2ProjectResultMap(string inputFilePathSVG)
        {
            FormInputBox inputBox = new FormInputBox("请输入图名", "图名:");

            if (inputBox.ShowDialog() == DialogResult.OK)
            {
                string sMapName = inputBox.ReturnValueStr.Trim();
                save2ProjectResultMap(inputFilePathSVG, sMapName);
            }
        }
Пример #5
0
        private void tsmiSave2Project_Click(object sender, EventArgs e)
        {
            FormInputBox newEx = new FormInputBox("成果图输出", "请输入文件名");

            if (newEx.ShowDialog() == DialogResult.OK)
            {
                string sMapName = newEx.ReturnValueStr;
                cProjectManager.save2ProjectResultMap(filePathSVG, sMapName);
            }
        }
Пример #6
0
        private void tsmiLayerRename_Click(object sender, EventArgs e)
        {
            TreeNode tnSelected = this.tvEdit.SelectedNode;

            getLayerInforBySelectTNnode(tnSelected);
            string       originalTitle = tnSelected.Text;
            FormInputBox inputBox      = new FormInputBox("新层名:", "请输入:", originalTitle);
            var          result        = inputBox.ShowDialog();

            if (result == DialogResult.OK)
            {
                string newTitle = inputBox.ReturnValueStr;
                cXmlDocLayer.reNameLayer(this.filePathLayerCss, this.sSelectLayerID, newTitle);
            }
        }
Пример #7
0
        private void tsmiRename_Click(object sender, EventArgs e)
        {
            string       originalFileName = this.tbgEditView.Text;
            string       originalFilePath = Path.Combine(cProjectManager.dirPathUsedProjectData, originalFileName + cProjectManager.fileExtensionSectionFence);
            string       originalDir      = Path.Combine(cProjectManager.dirPathUsedProjectData, originalFileName);
            FormInputBox inputBox         = new FormInputBox("新文件名:", "请输入:", originalFileName);
            var          result           = inputBox.ShowDialog();

            if (result == DialogResult.OK)
            {
                string newInputFileName = inputBox.ReturnValueStr;
                string newfilepath      = originalFilePath.Replace(originalFileName, newInputFileName);
                File.Copy(originalFilePath, newfilepath);
                cPublicMethodBase.DirectoryCopy(originalDir, Path.Combine(cProjectManager.dirPathUsedProjectData, newInputFileName), true);
                File.Delete(originalFilePath);
                if (Directory.Exists(originalDir))
                {
                    Directory.Delete(originalDir, true);
                }
                dirSectionData        = Path.Combine(cProjectManager.dirPathUsedProjectData, newInputFileName);
                filePathSectionCss    = Path.Combine(cProjectManager.dirPathUsedProjectData, newInputFileName + cProjectManager.fileExtensionSectionFence);
                this.tbgEditView.Text = newInputFileName;
            }
        }