/// <summary> /// 提取出主程序中含有Rolling方法的对象 /// </summary> /// <returns>其中的每一个元素都是一个字典,以对象名称来索引对象 /// 其中有三个元素,依次代表:剖面图、平面图和监测曲线图, /// 它不是指从mainform中提取出来的三个App的属性值,而是从这三个App属性中挑选出来的,正确地带有Rolling方法的相关类的实例对象。 /// </returns> /// <remarks></remarks> public RollingEnabledDrawings ExposeRollingDrawings() { // ClsDrawing_ExcavationElevation Elevation = default(ClsDrawing_ExcavationElevation); ClsDrawing_PlanView Visio_PlanView = default(ClsDrawing_PlanView); Dictionary_AutoKey <Cls_ExcelForMonitorDrawing> Excel_Monitor = default(Dictionary_AutoKey <Cls_ExcelForMonitorDrawing>); Elevation = GlobalApplication.Application.ElevationDrawing; Visio_PlanView = GlobalApplication.Application.PlanView_VisioWindow; Excel_Monitor = GlobalApplication.Application.MntDrawing_ExcelApps; // //对象名称与对象 try { //剖面图 if (Elevation != null) { //RollingDrawings.SectionalView.Add(Elevation) } } catch (Exception) { } try { //平面图 if (Visio_PlanView != null) { //RollingDrawings.PlanView.Add(Visio_PlanView) } } catch (Exception) { } List <clsDrawing_Mnt_RollingBase> RollingMntDrawings = new List <clsDrawing_Mnt_RollingBase>(); try { //监测曲线图 foreach (Cls_ExcelForMonitorDrawing MonitorSheets in Excel_Monitor.Values) { foreach (ClsDrawing_Mnt_Base sht in MonitorSheets.Mnt_Drawings.Values) { if (sht.CanRoll) { RollingMntDrawings.Add(sht); } } } //'数组中的每一个元素都是一个字典,以对象名称来索引对象 } catch (Exception) { } // RollingEnabledDrawings RollingDrawings = new RollingEnabledDrawings(Elevation, Visio_PlanView, RollingMntDrawings); return(RollingDrawings); }
/// <summary> /// 在整个程序中的可以滚动的图表发生增加或者减少时触发的事件: /// 刷新窗口中的列表框的数据与其UI显示 /// </summary> /// <remarks></remarks> private Drawings_For_Rolling RefreshUI_RollingDrawings() { Drawings_For_Rolling SelectedDrawings = new Drawings_For_Rolling(this); // 主程序中所有可以滚动的图形的汇总() RollingEnabledDrawings RollingMethods = GlobalApplication.Application.ExposeRollingDrawings(); // ClsDrawing_PlanView plan = RollingMethods.PlanView; SelectedDrawings.PlanView = plan; CheckBox_PlanView.Tag = plan; if (plan != null) { CheckBox_PlanView.Checked = true; CheckBox_PlanView.Enabled = true; } else { CheckBox_PlanView.Checked = false; CheckBox_PlanView.Enabled = false; } // ClsDrawing_ExcavationElevation Sectional = RollingMethods.SectionalView; SelectedDrawings.SectionalView = Sectional; CheckBox_SectionalView.Tag = Sectional; if (Sectional != null) { CheckBox_SectionalView.Checked = true; CheckBox_SectionalView.Enabled = true; } else { CheckBox_SectionalView.Checked = false; CheckBox_SectionalView.Enabled = false; } // -------------- 为窗口中的控件赋值 ------------------------ // List <LstbxDisplayAndItem> listMnt = new List <LstbxDisplayAndItem>(); foreach (clsDrawing_Mnt_RollingBase M in RollingMethods.MonitorData) { listMnt.Add(new LstbxDisplayAndItem(DisplayedText: M.Chart_App_Title, Value: M)); } this.ListBoxMonitorData.DisplayMember = LstbxDisplayAndItem.DisplayMember; this.ListBoxMonitorData.DataSource = listMnt; SelectedDrawings.RollingMnt.Clear(); foreach (LstbxDisplayAndItem item in this.ListBoxMonitorData.SelectedItems) { SelectedDrawings.RollingMnt.Add((clsDrawing_Mnt_RollingBase)item.Value); } return(SelectedDrawings); }