//private void btnLoadRoute_Click(object sender, EventArgs e)
        //{
        //    if (MapGis.RouteList.Count == 0)
        //    {
        //        DataTable stationposition = dpicbll.GetStationPositionByFileID(this.FileID);
        //        DataTable routedt = dpicbll.GetRouteInfoPositionByFileID(this.FileID);
        //        if (routedt.Rows.Count > 0)
        //        {
        //            this.MapGis.ClareRouteModelList();
        //            this.MapGis.ClearAllStation();
        //            for (int i = 0; i < stationposition.Rows.Count; i++)
        //            {
        //                string stationname = stationposition.Rows[i][0].ToString();
        //                PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString()));
        //                MapGis.AddConfigStation(stationname, p);
        //            }
        //            for (int i = 0; i < routedt.Rows.Count; i++)
        //            {
        //                if (i % 2 != 0)
        //                {
        //                    ZzhaControlLibrary.RouteModel rm = new RouteModel();
        //                    string from = routedt.Rows[i][0].ToString();
        //                    string[] fromxy = from.Split(',');
        //                    rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1]));
        //                    string to = routedt.Rows[i][1].ToString();
        //                    string[] toxy = to.Split(',');
        //                    rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1]));
        //                    rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString());
        //                    MapGis.AddConfigRouteModel(rm);
        //                }
        //            }
        //            MapGis.FlashAll();
        //            this.btnCreate.Enabled = true;
        //            this.btnLoadRoute.Enabled = false;
        //        }
        //        else
        //        {
        //            MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK);
        //        }
        //    }
        //}

        private void btnComplete_Click(object sender, EventArgs e)
        {
            btnSave_Click(sender, e);
            if (IsSuccessful)
            {
                btnCreate_Click(sender, e);
                A_DPic_DivConfig DivConfig = new A_DPic_DivConfig(treeNode, Convert.ToDouble(500), Convert.ToDouble(20000), frmMain.ConfigXml, treeView, frmMain);

                DivConfig.btnSelectAll_Click(sender, e);
                DivConfig.btnSave_Click(sender, e);
                if (!DivConfig.IsSuccessful)
                {
                    return;
                }

                DivConfig.btnClose_Click(sender, e);
                frmMain.FileID      = FileID;
                frmMain.NowBtn      = new Button();
                frmMain.NowBtn.Text = "新建图形";
                frmMain.btnSaveConfig_Click(sender, e);
                //frmMain.FrmCreateConfig_Load(sender, e);
                dockp = frmMain.Dockpanel;
                frmMain.Close();

                //A_FrmDCreateConfig frmCreateConfig = new A_FrmDCreateConfig();

                //frmCreateConfig.Show(dockp, DockState.Document);

                this.Close();
            }
            else
            {
                MessageBox.Show("保存失败!");
            }
        }
        //private void btnLoadRoute_Click(object sender, EventArgs e)
        //{
        //    if (MapGis.RouteList.Count == 0)
        //    {
        //        DataTable stationposition = dpicbll.GetStationPositionByFileID(this.FileID);
        //        DataTable routedt = dpicbll.GetRouteInfoPositionByFileID(this.FileID);
        //        if (routedt.Rows.Count > 0)
        //        {
        //            this.MapGis.ClareRouteModelList();
        //            this.MapGis.ClearAllStation();
        //            for (int i = 0; i < stationposition.Rows.Count; i++)
        //            {
        //                string stationname = stationposition.Rows[i][0].ToString();
        //                PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString()));
        //                MapGis.AddConfigStation(stationname, p);
        //            }
        //            for (int i = 0; i < routedt.Rows.Count; i++)
        //            {
        //                if (i % 2 != 0)
        //                {
        //                    ZzhaControlLibrary.RouteModel rm = new RouteModel();
        //                    string from = routedt.Rows[i][0].ToString();
        //                    string[] fromxy = from.Split(',');
        //                    rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1]));
        //                    string to = routedt.Rows[i][1].ToString();
        //                    string[] toxy = to.Split(',');
        //                    rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1]));
        //                    rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString());
        //                    MapGis.AddConfigRouteModel(rm);
        //                }
        //            }
        //            MapGis.FlashAll();
        //            this.btnCreate.Enabled = true;
        //            this.btnLoadRoute.Enabled = false;
        //        }
        //        else
        //        {
        //            MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK);
        //        }
        //    }
        //}

        private void btnComplete_Click(object sender, EventArgs e)
        {

            btnSave_Click(sender, e);
            if (IsSuccessful)
            {
                btnCreate_Click(sender, e);
                A_DPic_DivConfig DivConfig = new A_DPic_DivConfig(treeNode, Convert.ToDouble(500), Convert.ToDouble(20000), frmMain.ConfigXml, treeView, frmMain);

                DivConfig.btnSelectAll_Click(sender, e);
                DivConfig.btnSave_Click(sender, e);
                if (!DivConfig.IsSuccessful)
                {
                    return;
                }

                DivConfig.btnClose_Click(sender, e);
                frmMain.FileID = FileID;
                frmMain.NowBtn = new Button();
                frmMain.NowBtn.Text = "新建图形";
                frmMain.btnSaveConfig_Click(sender, e);
                //frmMain.FrmCreateConfig_Load(sender, e);
                dockp = frmMain.Dockpanel;
                frmMain.Close();

                //A_FrmDCreateConfig frmCreateConfig = new A_FrmDCreateConfig();

                //frmCreateConfig.Show(dockp, DockState.Document);

                this.Close();
            }
            else
            {
                MessageBox.Show("保存失败!");
            }

            
        }