예제 #1
0
            /// <summary>
            /// 图形滚动的Rolling方法
            /// </summary>
            /// <param name="dateThisday">施工当天的日期</param>
            /// <remarks></remarks>
            public override void Rolling(DateTime dateThisday)
            {
                F_RollingDate = dateThisday;
                object lockobject = new object();

                lock (lockobject)
                {
                    Excel.Application app = Chart.Application;
                    app.ScreenUpdating = false;
                    // ------------------- 绘制监测曲线图
                    var Allday = F_dicDateAndColumnNumber.Keys;
                    //考察选定的日期是否有数据
                    TodayState State     = default(TodayState);
                    DateTime   closedDay = default(DateTime);
                    //
                    if (DateTime.Compare(dateThisday, DateSpan.StartedDate) < 0)
                    {
                        State = TodayState.BeforeStartDay;
                    }
                    else if (DateTime.Compare(dateThisday, DateSpan.FinishedDate) > 0)
                    {
                        State = TodayState.AfterFinishedDay;
                    }
                    else if (Allday.Contains(dateThisday)) //如果搜索的那一天有数据
                    {
                        State     = TodayState.DateMatched;
                        closedDay = dateThisday;
                    }
                    else //搜索的那一天没有数据,则查找选定的日期附近最近的一天,并绘制其监测曲线
                    {
                        State = TodayState.DateNotFound;
                        SortedSet <DateTime> sortedlist_AllDays = new SortedSet <DateTime>(Allday);
                        closedDay = GetClosestDay(sortedlist_AllDays, dateThisday);
                    }
                    //
                    CurveRolling(dateThisday, State, closedDay);

                    // -------------------- 移动开挖深度的直线与文本框
                    if (P_ProcessRegionData != null)
                    {
                        float excavationElevation = 0;
                        try
                        {
                            excavationElevation = Convert.ToSingle(P_ProcessRegionData.Date_Elevation[dateThisday]);
                            //ClsData_DataBase.GetElevation(P_rgExcavationProcess, dateThisday)
                        }
                        catch (Exception)
                        {
                            Debug.Print("上面的Exception已经被Try...Catch语句块捕获,不用担心。出错代码位于ClsDrawing_Mnt_Incline.vb中。");
                            DateTime ClosestDate =
                                ClsData_DataBase.FindTheClosestDateInSortedList(
                                    P_ProcessRegionData.Date_Elevation.Keys, dateThisday);
                            excavationElevation = Convert.ToSingle(P_ProcessRegionData.Date_Elevation[ClosestDate]);
                        }
                        MoveExcavation(_ExcavationDepth_lineAndTextbox, excavationElevation, dateThisday, State);
                    }
                    app.ScreenUpdating = true;
                }
            }
        public void Rolling(DateTime dateThisDay)
        {
            object lockobject = new object();

            lock (lockobject)
            {
                UInt16 RegionsCount = this.F_Regions.Count;
                if (RegionsCount > 0)
                {
                    this.Application.ScreenUpdating = false;                     //禁用excel界面
                    Series series_Depth = this.F_Series_Depth;
                    clsData_ProcessRegionData            Region = default(clsData_ProcessRegionData);
                    Microsoft.Office.Interop.Excel.Point Pt     = default(Microsoft.Office.Interop.Excel.Point);
                    float[] Depths = new float[RegionsCount - 1 + 1];
                    for (UInt16 i = 0; i <= RegionsCount - 1; i++)
                    {
                        Region = this.F_Regions.Item(i);
                        Pt     = series_Depth.Points().item(i + 1);
                        if (Region.HasBottomDate)
                        {
                            if (dateThisDay.CompareTo(Region.BottomDate) > 0)                             //说明已经开挖到基坑底,并在向上进行结构物的施工
                            {
                                Pt.Format.Fill.ForeColor.RGB = Information.RGB(255, 0, 0);
                            }
                            else                             //说明还未开挖到基坑底,并在向下开挖
                            {
                                Pt.Format.Fill.ForeColor.RGB = Information.RGB(0, 0, 255);
                            }
                        }
                        try
                        {
                            Depths[i] = System.Convert.ToSingle(Region.Date_Elevation[dateThisDay]);
                        }
                        catch (KeyNotFoundException)
                        {
                            DateTime ClosestDate = ClsData_DataBase.FindTheClosestDateInSortedList(Region.Date_Elevation.Keys, dateThisDay);
                            Depths[i] = System.Convert.ToSingle(Region.Date_Elevation[ClosestDate]);
                        }
                    }
                    series_Depth.Values = Depths;
                    //刷新日期放置在最后,以免由于耗时过长而出现误判
                    this.F_textbox_Info.TextRange.Text = dateThisDay.ToString(AMEApplication.DateFormat);
                }
                this.Application.ScreenUpdating = true;                 //刷新excel界面
            }
        }