Ejemplo n.º 1
0
        /// <summary>
        /// !!! 在每一次更改选择项时刷新滚动条和日历的时间跨度,以及终结旧线程,创建新的线程
        /// </summary>
        /// <remarks></remarks>
        private DateSpan Refesh_FocusOn_DateSpan(Drawings_For_Rolling Selected_Drawings)
        {
            // -------------------------------------  包含所有要进行滚动的线程的数组
            //
            bool     blnDateSpanInitialized = false;
            DateSpan DateSpan = new DateSpan();
            //
            // ------------------------------------------ 标高剖面图
            ClsDrawing_ExcavationElevation ele = Selected_Drawings.SectionalView;

            if (ele != null)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, ele.DateSpan);
            }

            // ------------------------------------------ 开挖平面图
            ClsDrawing_PlanView Plan = Selected_Drawings.PlanView;

            if (Plan != null)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, Plan.DateSpan);
            }

            // ------------------------------------------ 监测曲线图
            foreach (clsDrawing_Mnt_RollingBase Moni in Selected_Drawings.RollingMnt)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, Moni.DateSpan);
            }
            return(DateSpan);
        }
Ejemplo n.º 2
0
            /// <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);
            }
Ejemplo n.º 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="SectionalView">剖面图</param>
 /// <param name="PlanView">平面图</param>
 /// <param name="MonitorData">监测曲线图</param>
 /// <remarks></remarks>
 public AmeDrawings(ClsDrawing_ExcavationElevation SectionalView,
                    ClsDrawing_PlanView PlanView,
                    List <ClsDrawing_Mnt_Base> MonitorData)
 {
     this.SectionalView = SectionalView;
     this.PlanView      = PlanView;
     this.MonitorData   = MonitorData;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="SectionalView">剖面图</param>
 /// <param name="PlanView">平面图</param>
 /// <param name="MonitorData">监测曲线图</param>
 /// <remarks></remarks>
 public RollingEnabledDrawings(ClsDrawing_ExcavationElevation SectionalView,
                               ClsDrawing_PlanView PlanView,
                               List <clsDrawing_Mnt_RollingBase> MonitorData)
 {
     this.SectionalView = SectionalView;
     this.PlanView      = PlanView;
     this.MonitorData   = MonitorData;
 }
Ejemplo n.º 5
0
        /// <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);
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="PaintingPage">监测点位所要绘制的Visio图形对象</param>
        /// <param name="wkshtPoints">存放监测点位信息的Excel表格</param>
        /// <remarks></remarks>
        public DiaFrm_PointsTreeView(Microsoft.Office.Interop.Excel.Worksheet wkshtPoints,
                                     ClsDrawing_PlanView PaintingPage)
        {
            // This call is required by the designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            this.F_PaintingPage      = PaintingPage;
            this.F_MonitorPointsInfo = PaintingPage.MonitorPointsInfo;
            this.F_wkshtPoints       = wkshtPoints;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 为每一个选择的要进行滚动的图形构造一个线程
        /// </summary>
        /// <param name="Selected_Drawings"></param>
        /// <remarks></remarks>
        private void ConstructRollingThreads(Drawings_For_Rolling Selected_Drawings)
        {
            AbortAllThread(F_arrThread);

            // -------------------------------------  包含所有要进行滚动的线程的数组
            short SelectedDrawingsCount = Selected_Drawings.Count();

            //
            F_arrThread         = new Thread[SelectedDrawingsCount - 1 + 1];
            F_arrThreadDelegete = new ParameterizedThreadStart[SelectedDrawingsCount - 1 + 1];
            //'
            short btThread = (short)0;
            //
            //
            // ------------------------------------------ 标高剖面图
            ClsDrawing_ExcavationElevation ele = Selected_Drawings.SectionalView;

            if (ele != null)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(ele.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动标高剖面图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }

            // ------------------------------------------ 开挖平面图
            ClsDrawing_PlanView Plan = Selected_Drawings.PlanView;

            if (Plan != null)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(Plan.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动开挖平面图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }

            // ------------------------------------------ 监测曲线图
            foreach (clsDrawing_Mnt_RollingBase Moni in Selected_Drawings.RollingMnt)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(Moni.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动监测曲线图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 从主程序中提取所有的图表,以进行输出之用。同时刷新窗口中的可供输出的图形
        /// </summary>
        /// <param name="AllDrawing">主程序对象中所有的图表</param>
        /// <remarks>在此方法中,将提取主程序中的所有图表对象,而且将其显示在输入窗口的列表框中</remarks>
        private void RefreshUI(AmeDrawings AllDrawing)
        {
            //-------------------------1、剖面图---------------------------------------------
            ClsDrawing_ExcavationElevation Sectional = AllDrawing.SectionalView;

            CheckBox_SectionalView.Tag = Sectional;
            if (Sectional != null)
            {
                CheckBox_SectionalView.Enabled = true;
            }
            else
            {
                CheckBox_SectionalView.Checked = false;
                CheckBox_SectionalView.Enabled = false;
            }
            //--------------------------2、开挖平面图----------------------------------------------
            ClsDrawing_PlanView Plan = AllDrawing.PlanView;

            CheckBox_PlanView.Tag = Plan;
            if (Plan != null)
            {
                CheckBox_PlanView.Enabled = true;
            }
            else
            {
                CheckBox_PlanView.Checked = false;
                CheckBox_PlanView.Enabled = false;
            }

            //---------------------------------3、监测曲线图---------------------------------------

            //清空两个列表框中的所有项目
            foreach (ListBox lstbox in F_arrListBoxes)
            {
                lstbox.Items.Clear();
                lstbox.DisplayMember = LstbxDisplayAndItem.DisplayMember;
            }
            foreach (ClsDrawing_Mnt_Base sht in AllDrawing.MonitorData)
            {
                switch (sht.Type)
                {
                case DrawingType.Monitor_Incline_Dynamic:
                case DrawingType.Monitor_Dynamic:
                    ListBoxMonitor_Dynamic.Items.Add(new LstbxDisplayAndItem(sht.Chart_App_Title, sht));
                    break;

                case DrawingType.Monitor_Static:
                case DrawingType.Monitor_Incline_MaxMinDepth:
                    ListBoxMonitor_Static.Items.Add(new LstbxDisplayAndItem(sht.Chart_App_Title, sht));
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 生成开挖平面图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks></remarks>
        public void ConstructVisioPlanView(object sender, EventArgs e)
        {
            //检查程序中是否已经有了打开的Visio绘图
            if (GlobalApplication.Application.PlanView_VisioWindow == null)
            {
                string VsoFilepath          = this.TextBoxFilePath.Text;
                bool   blnFilePathValidated = false;
                if (VsoFilepath.Length > 0)
                {
                    if (File.Exists(VsoFilepath))
                    {
                        if (Path.GetExtension(VsoFilepath) == ".vsd")
                        {
                            blnFilePathValidated = true;
                        }
                    }
                }
                if (blnFilePathValidated)
                {
                    try
                    {
                        this.Hide();
                        ClsDrawing_PlanView.MonitorPointsInformation PointsInfo = null;

                        //提取监测点位的信息
                        if (F_HasMonitorPointinfos)
                        {
                            PointsInfo = UIToPointsInfo();
                        }
                        //提取开挖平面图的信息
                        ClsDrawing_PlanView visioWindow = new ClsDrawing_PlanView(strFilePath: ref VsoFilepath, type: DrawingType.Vso_PlanView, PageName_PlanView: this.TextBoxPageName.Text, ShapeID_AllRegions: this.TextBoxAllRegions.Text, InfoBoxID: this.TextBoxInfoBoxID.Text, HasMonitorPointsInfo: ref this.F_HasMonitorPointinfos, MonitorPointsInfo: ref PointsInfo);
                        this.Close();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Visio平面图打开出错,请重新打开。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        this.Visible = true;
                        GlobalApplication.Application.PlanView_VisioWindow = null;
                    }
                }
                else
                {
                    MessageBox.Show("Visio文档不符合规范,请重新选择。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            else
            {
                //不能打开多个Visio平面图
                MessageBox.Show("Visio平面图已经打开。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
 /// <summary>
 /// 关闭绘图的Visio文档以及其所在的Application程序
 /// </summary>
 /// <param name="SaveChanges">在关闭文档时是否保存修改的内容</param>
 /// <remarks></remarks>
 public void Close(bool SaveChanges = false)
 {
     try
     {
         ClsDrawing_PlanView with_1 = this;
         Document            vsoDoc = with_1.Page.Document;
         object null_object         = null;
         object null_object2        = null;
         object null_object3        = null;
         vsoDoc.Close(ref null_object, ref null_object2, ref null_object3);
         //此时开挖平面图已经关闭
         with_1.Application.Quit();
     }
     catch (Exception ex)
     {
         MessageBox.Show("关闭Visio开挖平面图出错!" + "\r\n" + ex.Message,
                         "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 11
0
            /// <summary>
            /// 主程序中所有的绘图,包括不能进行滚动的图形。比如开挖平面图,监测曲线图,开挖剖面图。
            /// </summary>
            /// <returns></returns>
            /// <remarks></remarks>
            public AmeDrawings ExposeAllDrawings()
            {
                Dictionary_AutoKey <Cls_ExcelForMonitorDrawing> Excel_Monitor = default(Dictionary_AutoKey <Cls_ExcelForMonitorDrawing>);
                //
                ClsDrawing_PlanView            Visio_PlanView = null;
                ClsDrawing_ExcavationElevation Elevation      = default(ClsDrawing_ExcavationElevation);
                List <ClsDrawing_Mnt_Base>     MonitorData    = new List <ClsDrawing_Mnt_Base>();

                //
                Elevation     = GlobalApplication.Application.ElevationDrawing;
                Excel_Monitor = GlobalApplication.Application.MntDrawing_ExcelApps;
                //

                //Me.F_AllDrawingsCount = 0
                //
                //对象名称与对象
                try
                {
                    //剖面图
                    Elevation = GlobalApplication.Application.ElevationDrawing;
                    if (Elevation != null)
                    {
                        //Me.F_AllDrawingsCount += 1
                    }
                }
                catch (Exception)
                {
                }

                try
                {
                    //平面图
                    Visio_PlanView = GlobalApplication.Application.PlanView_VisioWindow;
                    if (Visio_PlanView != null)
                    {
                        //Me.F_AllDrawingsCount += 1
                    }
                }
                catch (Exception)
                {
                }

                try
                {
                    //监测曲线图
                    foreach (Cls_ExcelForMonitorDrawing MonitorSheets in Excel_Monitor.Values)
                    {
                        foreach (ClsDrawing_Mnt_Base sht in MonitorSheets.Mnt_Drawings.Values)
                        {
                            MonitorData.Add(sht);
                            //Me.F_AllDrawingsCount += 1
                        }
                    }
                }
                catch (Exception)
                {
                }
                AmeDrawings AllDrawings = new AmeDrawings(Elevation,
                                                          Visio_PlanView,
                                                          MonitorData);

                return(AllDrawings);
            }
Ejemplo n.º 12
0
 public Drawings_For_Output(Diafrm_Output_Word Sender)
 {
     MntDrawings   = new List <ClsDrawing_Mnt_Base>();
     PlanView      = null;
     SectionalView = null;
 }
Ejemplo n.º 13
0
        private void ExportToWord(Application WdApp, Drawings_For_Output selectedDrawings)
        {
            Word.Range rg = WdDoc.Range(Start: 0);
            //在写入标题部分内容时所占的进度
            int intProgressForStartPart = 10;
            //一共要导出的元素个数
            int intElementsCount = selectedDrawings.Count();
            //每一个导出的元素所占的进度
            float sngUnit = (float)((double)(100 - intProgressForStartPart) / intElementsCount);
            //实时的进度值
            int intProgress = intProgressForStartPart;

            try
            {
                //写入标题项
                Export_OverView(ref rg);
            }
            catch (Exception)
            {
                MessageBox.Show("写入概述部分出错,但可以继续工作。", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgressForStartPart);
            }

            // ------------- 取消绘图窗口的禁用 ------------------
            //一定要在将绘图窗口中的图形导出到Word之前取消窗口的禁用,
            //否则的话,当调用这些窗口的Application属性时,就会出现报错:应用程序正在使用中。
            foreach (IntPtr H in WindowHandles)
            {
                APIWindows.EnableWindow(H, true);
            }

            //输出每一个选定的图形
            // ------------- 开挖平面图 ------------------
            try
            {
                ClsDrawing_PlanView D = selectedDrawings.PlanView;
                if (D != null)
                {
                    Page page = D.Page;
                    //
                    NewLine(rg, ParagraphStyle.Title_2);
                    rg.InsertAfter("开挖平面图:");
                    //
                    Export_VisioPlanview(page, ref rg);
                    //
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "导出Visio开挖平面图出错,但可以继续工作。" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name, "Warning",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            // ------------- 剖面标高图 -------------------------
            try
            {
                ClsDrawing_ExcavationElevation D = selectedDrawings.SectionalView;
                if (D != null)
                {
                    //
                    NewLine(rg, ParagraphStyle.Title_2);
                    rg.InsertAfter("开挖剖面图:");
                    //
                    Export_ExcelChart(D.Chart, ref rg);
                    //
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "导出Excel开挖剖面图出错,但可以继续工作。" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name, "Warning",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            // ---------------------- 监测曲线图 --------------------
            Chart cht = default(Chart);

            foreach (ClsDrawing_Mnt_Base Drawing in selectedDrawings.MntDrawings)
            {
                try
                {
                    switch (Drawing.Type)
                    {
                    // ------------- 测斜曲线图 ---------------------------------------------------
                    case DrawingType.Monitor_Incline_Dynamic:
                        ClsDrawing_Mnt_Incline D_1 = (ClsDrawing_Mnt_Incline)Drawing;
                        cht = D_1.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_1.Chart_App_Title);
                        //
                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 动态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Dynamic:
                        ClsDrawing_Mnt_OtherDynamics D_2 = (ClsDrawing_Mnt_OtherDynamics)Drawing;
                        cht = D_2.Chart;

                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_2.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 静态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Static:
                        ClsDrawing_Mnt_Static D_3 = (ClsDrawing_Mnt_Static)Drawing;
                        cht = D_3.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_3.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 静态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Incline_MaxMinDepth:
                        ClsDrawing_Mnt_MaxMinDepth D = (ClsDrawing_Mnt_MaxMinDepth)Drawing;
                        cht = D.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("导出监测曲线图\"" + Drawing.Chart_App_Title.ToString() + "\"出错,但可以继续工作。" +
                                    "\r\n" + ex.Message + "\r\n" + "报错位置:" +
                                    ex.TargetSite.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                finally
                {
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
        }
        /// <summary>
        /// !进行监测点位的绘制
        /// </summary>
        /// <remarks></remarks>
        private void DrawPoints()
        {
            ClsDrawing_PlanView vso = GlobalApplication.Application.PlanView_VisioWindow;

            if (vso != null)
            {
                Microsoft.Office.Interop.Visio.Page pg = vso.Page;
                try
                {
                    Microsoft.Office.Interop.Visio.Window vsoWindow = pg.Application.ActiveWindow;
                    vsoWindow.Page = pg;
                    vsoWindow.Application.ShowChanges = false;
                    //
                    string[] arrListedPoints  = F_dicListedPoints.Keys.ToArray;
                    string[] arrExistedPoints = F_dicVisioPoints.Keys.ToArray;
                    //
                    object[] arrAddOrRemove = new object[2];
                    arrAddOrRemove = GetPointsToBeProcessed(arrExistedPoints, arrListedPoints);
                    string[] arrToBeAdded   = arrAddOrRemove[0];
                    string[] arrToBeRemoved = arrAddOrRemove[1];


                    // ----- arrPointsToBeAdded ------------- 处理要进行添加的图形
                    PointInVisio[] arrPointsToBeAdded = new PointInVisio[arrToBeAdded.Length - 1 + 1];
                    int            i            = 0;
                    string         strSeparator = TreeViewPoints.PathSeparator;
                    foreach (string tag_Add in arrToBeAdded)
                    {
                        TreeNode     nd           = F_dicListedPoints.Item(tag_Add);
                        PointInVisio struct_Point = new PointInVisio();
                        var          str          = tag_Add;
                        struct_Point.strItem     = str.Substring(0, str.IndexOf(strSeparator));
                        struct_Point.strPoint    = nd.Text;
                        struct_Point.Coordinates = nd.Tag;
                        arrPointsToBeAdded[i]    = struct_Point;
                        i++;
                    }

                    AddMonitorPoints(vsoWindow, arrToBeAdded, arrPointsToBeAdded);

                    // ----- arrToBeRemoved ------------- 处理要进行删除的图形
                    foreach (string strPointTag in arrToBeRemoved)
                    {
                        Microsoft.Office.Interop.Visio.Shape shp = default(Microsoft.Office.Interop.Visio.Shape);
                        shp = pg.Shapes.ItemFromID(System.Convert.ToInt32(F_dicVisioPoints.Item(strPointTag)));
                        shp.Delete();
                        //
                        F_dicVisioPoints.Remove(strPointTag);
                    }

                    // -----------------------
                    this.blnRefreshed = true;
                    vsoWindow.Application.ShowChanges = true;
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.Message);
                    MessageBox.Show("出错!" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name,
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Visio绘图已经关闭,请重新打开。", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 15
0
 public Drawings_For_Rolling(frmRolling Sender)
 {
     RollingMnt    = new List <clsDrawing_Mnt_RollingBase>();
     SectionalView = null;
     PlanView      = null;
 }