예제 #1
0
 private void btnExportPkg_Click(object sender, EventArgs e)
 {
     if (bindingSource != null)
     {
         SaveFileDialog dlgFile = new SaveFileDialog();
         dlgFile.Filter   = "PKG files (*.pkg)|*.pkg|All files (*.*)|*.*";
         dlgFile.FileName = "ADDRESS.PKG";
         if (dlgFile.ShowDialog() == DialogResult.OK)
         {
             string xmlFilePath = Program.GetAddressBookTempFolderPath() + @"\addressbook.xml";
             if (ExportXml(xmlFilePath))
             {
                 try
                 {
                     PkgTool.ToPkgFile(System.IO.Path.GetDirectoryName(xmlFilePath), dlgFile.FileName);
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message, "操作錯誤",
                                     MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
     SetButtons();
 }
예제 #2
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (m_InputXmlFilePath != null)
     {
         SaveFileDialog dlgFile = new SaveFileDialog();
         dlgFile.Filter   = "PKG files (*.pkg)|*.pkg|All files (*.*)|*.*";
         dlgFile.FileName = "CARD.PKG";
         if (dlgFile.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 File.Copy(m_InputXmlFilePath, Program.GetCardListTempFolderPath() + @"\cardlist.xml", true);
                 PkgTool.ToPkgFile(Program.GetCardListTempFolderPath(), dlgFile.FileName);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "操作錯誤",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     SetButtons();
 }