private void tsmiClose_Click(object sender, EventArgs e)
 {
     if (!isSaveed)
     {
         DialogResult result = MessageBox.Show("是否需要保存该图形系统文件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             this.lnkSave_LinkClicked(this, new LinkLabelLinkClickedEventArgs(lnkSave.Links[0]));
         }
     }
     isSaveed = true;
     MapGis.ReSet();
     MapGis.Refresh();
     InitConfigXml();
     LastSelectNode    = null;
     MapConfiged       = false;
     this.picMap.Image = null;
     this.ntbMax.Text  = string.Empty;
     this.ntbMin.Text  = string.Empty;
     this.trvDiv.Nodes.Clear();
     if (IsOut)
     {
         this.picInOut_Click(this, new EventArgs());
     }
     this.pnlInOut.Visible = false;
 }
        private void LoadMapConfig(XmlDocument configXml)
        {
            this.ClearControls();
            MapGis.ReSet();
            MapGis.Refresh();
            XmlNode MapNode = configXml.SelectSingleNode("//Map");
            Image   img     = null;

            //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf);
            try
            {
                //CreateFile(Application.StartupPath + MapNode.InnerText, imgBytes);
                DataTable dt = dpicbll.GetBackPicByFileID(MapNode.InnerText);
                img = this.BytesToImage((byte[])dt.Rows[0][0]);
            }
            catch (Exception ex)
            {
                MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK);
            }
            if (MapNode != null)
            {
                try
                {
                    picMap.Image     = img;
                    this.FileID      = MapNode.InnerText;
                    this.MapConfiged = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK);
                }
                for (int i = 0; i < MapNode.Attributes.Count; i++)
                {
                    if (i == 0)
                    {
                        ntbMin.Text = MapNode.Attributes[i].InnerText;
                    }
                    if (i == 1)
                    {
                        ntbMax.Text = MapNode.Attributes[i].InnerText;
                    }
                }
            }
            XmlNode DivRoot = configXml.SelectSingleNode("//Divs");

            if (DivRoot != null)
            {
                if (DivRoot.ChildNodes.Count > 0)
                {
                    foreach (XmlNode node in DivRoot.ChildNodes)
                    {
                        trvDiv.Nodes.Add(node.InnerText, node.InnerText);
                    }
                }
            }
        }
Exemple #3
0
 private void LoadMapConfig(XmlDocument configXml,byte[] imgBytes)
 {
     this.ClearControls();
     MapGis.ReSet();
     MapGis.Refresh();
     XmlNode MapNode = configXml.SelectSingleNode("//Map");
     //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf);
     try
     {
         string filename = MapNode.InnerText.Substring(MapNode.InnerText.LastIndexOf("\\")+1);
         byte[] buffer = bll.GetBackMapByFileName(filename);
         if (buffer != null)
         {
             CreateFile(Application.StartupPath + MapNode.InnerText, buffer);
         }
         else
         {
             MessageBox.Show(",该配置文件已经过时...", "提示", MessageBoxButtons.OK);
             return;
         }
     }
     catch(Exception ex)
     {
         MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK);
     }
     if (MapNode != null)
     {
         this.MapFilePath = MapNode.InnerText;
         try
         {
             picMap.Image = CreateBitMap(Application.StartupPath + MapNode.InnerText);
         }
         catch (Exception ex)
         {
             MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK);
         }
         for (int i = 0; i < MapNode.Attributes.Count; i++)
         {
             if (i == 0)
                 ntbMin.Text = MapNode.Attributes[i].InnerText;
             if (i == 1)
                 ntbMax.Text = MapNode.Attributes[i].InnerText;
         }
     }
     XmlNode DivRoot = configXml.SelectSingleNode("//Divs");
     if (DivRoot != null)
     {
         if (DivRoot.ChildNodes.Count > 0)
         {
             foreach (XmlNode node in DivRoot.ChildNodes)
             {
                 trvDiv.Nodes.Add(node.InnerText, node.InnerText);
             }
         }
     }
 }
        private void LoadMapConfig(XmlDocument configXml, byte[] imgBytes)
        {
            this.ClearControls();
            MapGis.ReSet();
            MapGis.Refresh();
            XmlNode MapNode = configXml.SelectSingleNode("//Map");

            //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf);
            try
            {
                CreateFile(Application.StartupPath + MapNode.InnerText, imgBytes);
            }
            catch (Exception ex)
            {
                MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK);
            }
            if (MapNode != null)
            {
                this.MapFilePath = MapNode.InnerText;
                try
                {
                    picMap.Image = new Bitmap(Application.StartupPath + MapNode.InnerText);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK);
                }
                for (int i = 0; i < MapNode.Attributes.Count; i++)
                {
                    if (i == 0)
                    {
                        ntbMin.Text = MapNode.Attributes[i].InnerText;
                    }
                    if (i == 1)
                    {
                        ntbMax.Text = MapNode.Attributes[i].InnerText;
                    }
                }
            }
            XmlNode DivRoot = configXml.SelectSingleNode("//Divs");

            if (DivRoot != null)
            {
                if (DivRoot.ChildNodes.Count > 0)
                {
                    foreach (XmlNode node in DivRoot.ChildNodes)
                    {
                        trvDiv.Nodes.Add(node.InnerText, node.InnerText);
                    }
                }
            }
        }
 private void tsmiNew_Click(object sender, EventArgs e)
 {
     this.isSaveed = false;
     MapGis.ReSet();
     MapGis.Refresh();
     InitConfigXml();
     LastSelectNode    = null;
     MapConfiged       = false;
     this.picMap.Image = null;
     this.ntbMax.Text  = string.Empty;
     this.ntbMin.Text  = string.Empty;
     this.trvDiv.Nodes.Clear();
     pnlInOut.Visible = true;
     if (!IsOut)
     {
         this.picInOut_Click(this, new EventArgs());
     }
 }
 private void ClearControls()
 {
     this.isSaveed = false;
     MapGis.ReSet();
     MapGis.Refresh();
     //InitConfigXml();
     LastSelectNode    = null;
     MapFilePath       = string.Empty;
     this.picMap.Image = null;
     this.ntbMax.Text  = string.Empty;
     this.ntbMin.Text  = string.Empty;
     this.trvDiv.Nodes.Clear();
     pnlInOut.Visible = true;
     if (!IsOut)
     {
         this.picInOut_Click(this, new EventArgs());
     }
 }
Exemple #7
0
 private void tsmiClose_Click(object sender, EventArgs e)
 {
     if (!isSaveed)
     {
         DialogResult result = MessageBox.Show("是否需要保存该图形系统文件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             this.lnkSave_LinkClicked(this, new LinkLabelLinkClickedEventArgs(lnkSave.Links[0]));
         }
     }
     isSaveed = true;
     MapGis.ReSet();
     MapGis.Refresh();
     InitConfigXml();
     LastSelectNode = null;
     MapFilePath = string.Empty;
     this.picMap.Image = null;
     this.ntbMax.Text = string.Empty;
     this.ntbMin.Text = string.Empty;
     this.trvDiv.Nodes.Clear();
     if(IsOut)
     {
         this.picInOut_Click(this, new EventArgs());
     }
     //this.pnlInOut.Visible = false;
     DataTable dt = bll.GetBackMap();
     string SafeFileName = dt.Rows[0][0].ToString();
     byte[] buffer = (byte[])dt.Rows[0][1];
     SaveBackMap(SafeFileName, buffer);
     this.picMap.Image = CreateBitMap(Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName);
     this.MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName;
     XmlNode node = ConfigXml.SelectSingleNode("//Map");
     if (node != null)
     {
         node.InnerText = "\\MapGis\\Map\\" + SafeFileName;
     }
     else
     {
         XmlNode newnode = ConfigXml.CreateElement("Map");
         newnode.InnerText = "\\MapGis\\Map\\" + SafeFileName;
         RootNode.AppendChild(newnode);
     }
 }