public void ManageInterface() { HL7InterfaceConfig config = GetSelectedInterface(); if (null == config) { MessageBoxHelper.ShowInformation("Please select the interface you want to manage."); return; } string path = Path.Combine(Application.StartupPath, config.InterfaceFolder); string exeFile = Path.Combine(path, "Config\\HYS.IM.Config.exe"); bool isRunning = false; Process[] ps = Process.GetProcessesByName("HYS.IM.Config"); foreach (Process p in ps) { if (p.MainModule.FileName.Equals(exeFile, StringComparison.InvariantCultureIgnoreCase)) { Program.HandleRunningInstance(p); isRunning = true; } } if (!isRunning) { Process.Start(exeFile); } }
internal static bool UninstallInterface(HL7InterfaceConfig config) { string interfacePath = Path.Combine(Application.StartupPath, config.InterfaceFolder); string strSvcRelativePath = "Bin\\Services\\" + (config.InterfaceType == InterfaceType.Receiver ? "HL7GW_RCV" : "HL7GW_SND"); string interfaceServicePath = Path.Combine(interfacePath, strSvcRelativePath); try { Program.ConfigMgt.Config.InterfaceList.Remove(config); if (Program.SaveConfig()) { string uninstallSvcBat = Path.Combine(interfaceServicePath, "UninstallService.bat"); ScriptMgt.ExecuteAssembly(uninstallSvcBat, "", true, Program.Log); UpdateUnistallBat(Program.ConfigMgt.Config); DeleteDirectory(interfacePath, true); return(true); } } catch (Exception err) { Program.Log.Write(LogType.Error, "Unistall interface failed : " + config.InterfaceName); Program.Log.Write(err); } return(false); }
private static HL7InterfaceConfig CreateHL7InterfaceConfig(string strServiceName, InterfaceType iType) { HL7InterfaceConfig config = new HL7InterfaceConfig(); config.InterfaceName = strServiceName; config.InterfaceType = iType; config.InterfaceFolder = (iType == InterfaceType.Receiver ? "Receiver\\" : "Sender\\") + strServiceName; config.InstallDate = DateTime.Now; return(config); }
public void BrowseFolder() { HL7InterfaceConfig hlInterface = GetSelectedInterface(); if (null == hlInterface) { MessageBoxHelper.ShowInformation("Please select the interface you want to browse."); return; } string path = Path.Combine(Application.StartupPath, hlInterface.InterfaceFolder); Process.Start("explorer.exe", path); }
internal void RefreshServiceStatus(string strServiceName, int status) { foreach (ListViewItem item in listViewInterface.Items) { HL7InterfaceConfig config = item.Tag as HL7InterfaceConfig; if (config.InterfaceName.Equals(strServiceName)) { config.InterfaceStatus = (InterfaceStatus)status; } item.SubItems[0].Text = config.InterfaceStatus.ToString(); } listCtrl.Refresh(); }
public static bool InstallInterface(string strServiceName, InterfaceType iType, UpdateProgress updateProgress) { HL7InterfaceConfig config = CreateHL7InterfaceConfig(strServiceName, iType); Program.ConfigMgt.Config.InterfaceList.Add(config); try { string strPrototypePath = Path.Combine(Application.StartupPath, iType == InterfaceType.Receiver ? "..\\Prototype\\Receiver" : "..\\Prototype\\Sender"); string targetPath = Path.Combine(Application.StartupPath, config.InterfaceFolder); CopyDirectory(strPrototypePath, targetPath, updateProgress); string strSvcRelativePath = "Bin\\Services\\" + (iType == InterfaceType.Receiver ? "HL7GW_RCV" : "HL7GW_SND"); string targetServicePath = Path.Combine(targetPath, strSvcRelativePath); string svcCfgExe = Path.Combine(targetServicePath, "HYS.IM.Messaging.ServiceConfig.exe"); ScriptMgt.ExecuteAssembly(svcCfgExe, "-s -u", true, Program.Log); HL7ConfigHelper.UpdateInterfaceName(config); string installSvcBat = Path.Combine(targetServicePath, "InstallService.bat"); string uninstallSvcBat = Path.Combine(targetServicePath, "UninstallService.bat"); ScriptMgt.ExecuteAssembly(installSvcBat, "", true, Program.Log); ScriptMgt.ExecuteAssembly(svcCfgExe, "-s -r", true, Program.Log); GenerateBat(targetServicePath, strServiceName); UpdateUnistallBat(Program.ConfigMgt.Config); if (!Program.SaveConfig()) { return(false); } } catch (Exception err) { Program.Log.Write(LogType.Error, "Install interface failed."); Program.Log.Write(err); Program.ConfigMgt.Config.InterfaceList.Remove(config); return(false); } return(true); }
public void UninstallInterface() { HL7InterfaceConfig config = GetSelectedInterface(); if (config == null) { MessageBoxHelper.ShowInformation("Select the interface you want to uninstall."); return; } if (!MessageBoxHelper.ShowConfirmBox("Are you sure to uninstall the selected interface?")) { return; } if (HL7GatewayInterfaceHelper.UninstallInterface(config)) { this.RefreshView(); } }