static void Main(String[] Args) { try { SAPbouiCOM.SboGuiApi oGUI = new SAPbouiCOM.SboGuiApi(); if (Args.Length == 0) { oGUI.Connect("0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"); } else { oGUI.Connect(Args[0]); } eCommon.SetApplication(oGUI.GetApplication(-1), gcAddOnName, true); // To add additional DB SBOAddon_DB addOnDb = new SBOAddon_DB(); SBOAddon oAddOn = new SBOAddon(); String str_directory = Environment.CurrentDirectory.ToString(); String parent = System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.IO.Directory.GetParent(str_directory).FullName).FullName).FullName + "\\"; if (oAddOn.Connected) { System.Windows.Forms.Application.Run(); } } catch (Exception Ex) { System.Windows.Forms.MessageBox.Show("ERROR - Connection failed: " + Ex.Message);; } }
void _btnSave_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { if (_txtPath.Value.Length < 1) { eCommon.SBO_Application.StatusBar.SetText("Invalid Path to save.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); return; } else { Dictionary <String, String> dictionary = new Dictionary <String, String>(); dictionary.Add("Export_XML_Path", _txtPath.Value); dictionary.Add("Save_PO_As_Draft", (_cbPO.Checked == true ? "1" : "0")); dictionary.Add("Save_SO_As_Draft", (_cbSO.Checked == true ? "1" : "0")); SBOAddon_DB.updateSettings(dictionary); } }