mahonglin123456 发表于 2015-9-21 13:25:32

[原创]SAP Business One ADDON 仿SBO程序开启,调用OpenFileDialog,SaveFileDialog(DLL封装)

调用文件保存对话框

1ShowSaveDialog oShowSaveDialog = new ShowSaveDialog();
2                oShowSaveDialog.Filter = "XML Files (*.xml)|*.xml";
3                oShowSaveDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
4                Thread threadSaveXmlFile = new Thread(new ThreadStart(oShowSaveDialog.GetSaveFileName));
5                threadSaveXmlFile.SetApartmentState(ApartmentState.STA);
6                try
7                {
8                  threadSaveXmlFile.Start();
9                  while (!threadSaveXmlFile.IsAlive) //Wait For Thread to get started
10                        Thread.Sleep(1);//Wait a sec more
11                  threadSaveXmlFile.Join();//Wait for thread to end
12
13                  //Use file name as you will here
14                  sPath = oShowSaveDialog.FileName;
15                  if (sPath != string.Empty)
16                  {
17                        SBO_Application.SetStatusBarMessage("保存路徑為" + sPath, SAPbouiCOM.BoMessageTime.bmt_Short, false);
18                        oXmlDoc.Save(sPath);
19                  }
20                  else
21                  {
22                        SBO_Application.SetStatusBarMessage("無效保存路徑", SAPbouiCOM.BoMessageTime.bmt_Short, true);
23                  }
24                }
25                catch (Exception ex)
26                {
27                  SBO_Application.MessageBox(ex.ToString(), 1, "OK", "", "");
28                }
仿SBO程序开启
SBOShowForm.showForm(oForm,true)

源码Code下载
页: [1]
查看完整版本: [原创]SAP Business One ADDON 仿SBO程序开启,调用OpenFileDialog,SaveFileDialog(DLL封装)