private void tsmiOpen_Click(object sender, EventArgs e)
        {
            frmDFileDialog openfileDlg = new frmDFileDialog(false);

            //openfileDlg.Multiselect = false;
            //openfileDlg.InitialDirectory = Application.StartupPath + "\\MapGis\\MapConfigFiles";
            //openfileDlg.Filter = "三恒科技图形系统文件|*.shz";
            if (openfileDlg.ShowDialog() == DialogResult.OK)
            {
                pnlInOut.Visible = true;
                if (!IsOut)
                {
                    this.picInOut_Click(this, new EventArgs());
                }
                if (dpicbll.ExitsFileName(openfileDlg.SafeFileName))
                {
                    DataTable   bufferdt    = dpicbll.GetXmlByFileName(openfileDlg.SafeFileName);
                    byte[]      xmlbytes    = (byte[])bufferdt.Rows[0][0];
                    FileChanger filechanger = new FileChanger();
                    ConfigXml = filechanger.BytesToXml(xmlbytes);
                    LoadMapConfig(filechanger.BytesToXml(xmlbytes));
                    this.isSaveed = false;
                }
                else
                {
                    MessageBox.Show("您所选择的文件不存在!", "提示", MessageBoxButtons.OK);
                }
            }
        }
 private void lnkSave_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (isSaveed == false)
     {
         if (MapConfiged)
         {
             frmDFileDialog f = new frmDFileDialog();
             //f.InitialDirectory = Application.StartupPath + "\\MapGis\\MapConfigFiles";
             //f.DefaultExt = "shz";
             //f.Filter = "三恒科技图形系统配置文件|*.shz";
             if (f.ShowDialog() == DialogResult.OK)
             {
                 //ConfigXml.Save(f.FileName);
                 string filename = f.SafeFileName;
                 byte[] xmlbytes = new FileChanger().XmlToBytes(ConfigXml);
                 if (dpicbll.ExitsFileName(filename))
                 {
                     dpicbll.UpdateFile(filename, xmlbytes, FileID);
                 }
                 else
                 {
                     dpicbll.AddFile(filename, xmlbytes, FileID);
                 }
                 this.isSaveed = true;
             }
         }
         else
         {
             MessageBox.Show("底图尚未配置!", "提示", MessageBoxButtons.OK);
         }
     }
 }
 private void tsmiOpen_Click(object sender, EventArgs e)
 {
     frmDFileDialog openfileDlg = new frmDFileDialog(false);
     //openfileDlg.Multiselect = false;
     //openfileDlg.InitialDirectory = Application.StartupPath + "\\MapGis\\MapConfigFiles";
     //openfileDlg.Filter = "三恒科技图形系统文件|*.shz";
     if (openfileDlg.ShowDialog() == DialogResult.OK)
     {
         //pnlInOut.Visible = false;
         if (!IsOut)
         {
             this.picInOut_Click(this, new EventArgs());
         }
         if (dpicbll.ExitsFileName(openfileDlg.SafeFileName))
         {
             DataTable bufferdt = dpicbll.GetXmlByFileName(openfileDlg.SafeFileName);
             byte[] xmlbytes = (byte[])bufferdt.Rows[0][0];
             FileChanger filechanger = new FileChanger();
             ConfigXml = filechanger.BytesToXml(xmlbytes);
             LoadMapConfig(filechanger.BytesToXml(xmlbytes));
             this.isSaveed = false;
         }
         else
         {
             MessageBox.Show("您所选择的文件不存在!", "提示", MessageBoxButtons.OK);
         }
     }
 }
Esempio n. 4
0
 private void tsmiFileOpen_Click(object sender, EventArgs e)
 {
     frmDFileDialog openfileDlg = new frmDFileDialog(false);
     if (openfileDlg.ShowDialog() == DialogResult.OK)
     {
         this.MapGis.UseDiv = true;
         this.MapGis.ReSet();
         XmlDocument xmldoc = new XmlDocument();
         DataTable bufferdt = dpicbll.GetXmlByFileName(openfileDlg.SafeFileName);
         byte[] xmlbytes = (byte[])bufferdt.Rows[0][0];
         FileChanger filechanger = new FileChanger();
         xmldoc = filechanger.BytesToXml(xmlbytes);
         XmlNode node = xmldoc.SelectSingleNode("//Map");
         this.FileID = node.InnerText;
         //if (node != null)
         //{
         //    try
         //    {
         //        CreateWmf(mapbytes, Application.StartupPath + node.InnerText);
         //    }
         //    catch (Exception ex)
         //    {
         //        MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK);
         //    }
         //}
         //else
         //{
         //    MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK);
         //}
         if (!new KJ128NMainRun.Graphics.DPic.MapXml().LoadAllMapConfig(xmldoc, MapGis))
         {
             pnlInOut.Visible = false;
             SetMenuEnabel(false);
             MapGis.Refresh();
             return;
         }
     }
     else
     {
         return;
     }
     //this.MapGis.StationClick += new ZzhaControlLibrary.ZzhaMapGis.ClickStation(MapGis_StationClick);
     StartTimer();
     IsOut = true;
     LoadRealTimeInfo();
     IsOut = false;
     pnlInOut.Visible = true;
     SetMenuEnabel(true);
 }
 private void lnkSave_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (isSaveed == false)
     {
         if (MapConfiged)
         {
             frmDFileDialog f = new frmDFileDialog();
             //f.InitialDirectory = Application.StartupPath + "\\MapGis\\MapConfigFiles";
             //f.DefaultExt = "shz";
             //f.Filter = "三恒科技图形系统配置文件|*.shz";
             if (f.ShowDialog() == DialogResult.OK)
             {
                 //ConfigXml.Save(f.FileName);
                 string filename = f.SafeFileName;
                 byte[] xmlbytes = new FileChanger().XmlToBytes(ConfigXml);
                 if (dpicbll.ExitsFileName(filename))
                     dpicbll.UpdateFile(filename, xmlbytes, FileID);
                 else
                     dpicbll.AddFile(filename, xmlbytes, FileID);
                 this.isSaveed = true;
             }
         }
         else
         {
             MessageBox.Show("底图尚未配置!", "提示", MessageBoxButtons.OK);
         }
     }
 }