public static EnovaService Initialize(string enovaPath, ILogger logger) { Logger = logger; try { Logger.Info("Initializing EnovaApi"); if (string.IsNullOrEmpty(enovaPath) || !Directory.Exists(enovaPath) || !File.Exists(Path.Combine(enovaPath, "Soneta.Business.dll"))) { throw new Exception("Nieprawidłowa ścieżka do programu enova."); } var service = new EnovaService(); service.enovaPath = enovaPath; service.init(); Logger.Info("EnovaApi initialized"); return(service); } catch (Exception ex) { logger.Error(ex.ToString()); throw; } }
private void Dispose(bool userCall) { if (!is_disposed) { is_disposed = true; if (userCall) { //user call } /* * if (appDomain != null) * { * if (pingPong != null) * pingPong.Dispose(); * pingPong = null; * if (connector != null) * connector.Finish(); * connector = null; * AppDomain.Unload(appDomain); * appDomain = null; * * } */ if (connector != null) { connector.Finish(); connector = null; } instance = null; } }
public static EnovaService Initialize(string enovaPath) { if (string.IsNullOrEmpty(enovaPath) || !Directory.Exists(enovaPath) || !File.Exists(Path.Combine(enovaPath, "Soneta.Business.dll"))) { throw new Exception("Nieprawidłowa ścieżka do programu enova."); } var service = new EnovaService(); service.enovaPath = enovaPath; service.init(); return(service); }
private EnovaService() { EnovaService.instance = this; }