/// <summary>
            /// 窗口加载
            /// </summary>
            public void frmProjectContents_Load(object sender, EventArgs e)
            {
                //这一步的New非常重要,因为在每一次编辑完成后都会将其传址给主程序。
                F_NewFileContents = new clsData_FileContents();
                //
                APPLICATION_MAINFORM.MainForm.AllowDrop = false;
                clsProjectFile GlobalProjectfile = GlbApp.ProjectFile;

                if (GlobalProjectfile != null)
                {
                    this.F_OldFileContents = GlobalProjectfile.Contents;
                    FileContentsToUI(this.F_OldFileContents);
                    //在Label中更新此项目文件的绝对路径
                    this.LabelProjectFilePath.Text = GlobalProjectfile.FilePath;
                }

                //
                this.BindProperty();

                //根据不同的窗口状态设置窗口的样式
                switch (this.P_ProjectState)
                {
                case Miscellaneous.ProjectState.NewProject:
                    frmProjectFile with_1 = this;
                    with_1.Text = "New Project";
                    break;

                case Miscellaneous.ProjectState.EditProject:
                    //将项目文件中的内容更新的窗口中
                    frmProjectFile with_2 = this;
                    with_2.Text = "Edit Project";
                    break;
                }
            }
Example #2
0
 /// <summary>
 /// 新建项目文件
 /// </summary>
 /// <remarks></remarks>
 private void NewProjectFile()
 {
     frmProjectFile             = new frmProjectFile();
     frmProjectFile.FormClosed += frmProjectFile.frmProjectFile_FormClosed;
     frmProjectFile.WorkBookInProjectChanged += frmProjectFile._WorkBookInProjectChanged;
     frmProjectFile.ProjectState              = ProjectState.NewProject;
     frmProjectFile.ShowDialog();
 }
Example #3
0
 /// <summary>
 /// 编辑项目文件
 /// </summary>
 /// <remarks></remarks>
 private void EditProjectFile()
 {
     if (frmProjectFile == null)
     {
         frmProjectFile             = new frmProjectFile();
         frmProjectFile.FormClosed += frmProjectFile.frmProjectFile_FormClosed;
         frmProjectFile.WorkBookInProjectChanged += frmProjectFile._WorkBookInProjectChanged;
     }
     frmProjectFile.ProjectState = ProjectState.EditProject;
     frmProjectFile.ShowDialog();
 }
            /// <summary>
            /// 项目中的数据库工作簿发生变化时,更新窗口中的相关列表框中的数据对象
            /// </summary>
            /// <param name="lstAllsheet"></param>
            /// <param name="FileContents"></param>
            /// <remarks></remarks>
            private void ListControlRefresh(List <LstbxDisplayAndItem> lstAllsheet,
                                            clsData_FileContents FileContents)
            {
                short intSheetsCount = System.Convert.ToInt16(lstAllsheet.Count);

                LstbxDisplayAndItem[] arrAllSheets1 = new LstbxDisplayAndItem[intSheetsCount - 1 + 1];
                LstbxDisplayAndItem[] arrAllSheets2 = new LstbxDisplayAndItem[intSheetsCount - 1 + 1];
                LstbxDisplayAndItem[] arrAllSheets3 = new LstbxDisplayAndItem[intSheetsCount - 1 + 1];
                LstbxDisplayAndItem[] arrAllSheets4 = new LstbxDisplayAndItem[intSheetsCount - 1 + 1];
                //这里一定要生成副本,因为如果是同一个引用变量,那么设置到三个控件的DataSource属性中后,
                //如果一个列表组合框的选择项发生变化,那个另外两个控件的选择项也会同步变化。
                arrAllSheets1 = lstAllsheet.ToArray() as LstbxDisplayAndItem[];
                arrAllSheets2 = arrAllSheets1.Clone() as LstbxDisplayAndItem[];
                arrAllSheets3 = arrAllSheets1.Clone() as LstbxDisplayAndItem[];
                arrAllSheets4 = arrAllSheets1.Clone() as LstbxDisplayAndItem[];

                //设置各种列表框中的数据以及选择的项lstbxWorksheetsInProjectFileChanged
                frmProjectFile with_1 = this;

                //开挖平面工作表
                CmbbxPlan.DataSource  = arrAllSheets1;
                CmbbxPlan.ValueMember = cstValueMember;
                if (FileContents.Sheet_PlanView != null)
                {
                    this.SheetToComboBox(CmbbxPlan, FileContents.Sheet_PlanView);
                }
                else
                {
                    CmbbxPlan.SelectedValue = LstbxDisplayAndItem.NothingInListBox.None;
                }

                //测点坐标工作表
                CmbbxPointCoordinates.DataSource  = arrAllSheets2;
                CmbbxPointCoordinates.ValueMember = cstValueMember;
                if (FileContents.Sheet_PointCoordinates != null)
                {
                    this.SheetToComboBox(CmbbxPointCoordinates, FileContents.Sheet_PointCoordinates);
                }
                else
                {
                    CmbbxPointCoordinates.SelectedValue = LstbxDisplayAndItem.NothingInListBox.None;
                }

                //开挖剖面工作表
                CmbbxSectional.DataSource  = arrAllSheets3;
                CmbbxSectional.ValueMember = cstValueMember;
                if (FileContents.Sheet_Elevation != null)
                {
                    this.SheetToComboBox(CmbbxSectional, FileContents.Sheet_Elevation);
                }
                else
                {
                    CmbbxSectional.SelectedValue = LstbxDisplayAndItem.NothingInListBox.None;
                }

                //开挖工况工作表
                CmbbxWorkingStage.DataSource  = arrAllSheets4;
                CmbbxWorkingStage.ValueMember = cstValueMember;
                if (FileContents.Sheet_WorkingStage != null)
                {
                    this.SheetToComboBox(CmbbxWorkingStage, FileContents.Sheet_WorkingStage);
                }
                else
                {
                    CmbbxWorkingStage.SelectedValue = LstbxDisplayAndItem.NothingInListBox.None;
                }


                //为施工进度列表服务的组合列表框
                if (CmbbxProgressWkbk.Items.Count == 0)
                {
                    //工作簿中的工作表列表框
                    this.LstbxSheetsProgressInWkbk.DataSource = null;
                    //上面将DataSource设置为Nothing会清空DisplayMember属性的值,那么下次再向列表框中添加成员时,
                    //其DisplayMember就为Nothing了,所以必须在下面设置好其DisplayMember的值。
                    this.LstbxSheetsProgressInWkbk.DisplayMember = LstbxDisplayAndItem.DisplayMember;
                }
                else
                {
                    CmbbxProgressWkbk.SelectedIndex = 0;
                }
            }