示例#1
0
        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;
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
        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);
        }
示例#4
0
 private EnovaService()
 {
     EnovaService.instance = this;
 }