Represents a connection to the SDK. Supports both desktop and online connections. In order to create a connection, use the ConnectionMgr class
Inheritance: IDisposable
Beispiel #1
0
 internal static void ConnectionClosed(SDKConnection cn)
 {
     lock (_connections)
     {
         if (false == _connections.Remove(cn))
         {
             StatusMgr.LogError("Connection closed: connection not found");
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates and SDK connection using the specified connection configuration
        /// </summary>
        /// <param name="config">The connection configuration to use</param>
        /// <returns>a usable connection or null if an error occurred</returns>
        public static SDKConnection GetConnection(ConnectionConfig config)
        {
            if (_thisApplication == null)
            {
                throw new Exception("Application ID is not set");
            }

            try
            {
                var cn = new SDKConnection(_thisApplication, config);

                if (config.ConnectionType != FCConnectionType.Online)
                {
                    cn.QueryDesktopVersion();
                }

                lock (_connections)
                {
                    _connections.Add(cn);
                }

                return(cn);
            }
            catch (SDKException sdkex)
            {
                var entry = new StatusEntry()
                {
                    TypeOfEntry = StatusEntry.EntryType.Error,
                    Summary     = sdkex.Message,
                    Details     = sdkex.ProblemDetail
                };

                StatusMgr.LogEntry(entry);

                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Creates and SDK connection using the specified connection configuration
        /// </summary>
        /// <param name="config">The connection configuration to use</param>
        /// <returns>a usable connection or null if an error occurred</returns>
        public static SDKConnection GetConnection(ConnectionConfig config)
        {
            if (_thisApplication == null)
            {
                throw new Exception("Application ID is not set");
            }

            try
            {
                var cn = new SDKConnection(_thisApplication, config);

                if (config.ConnectionType != FCConnectionType.Online)
                {
                    cn.QueryDesktopVersion();
                }

                lock (_connections)
                {
                    _connections.Add(cn);
                }

                return cn;
            }
            catch (SDKException sdkex)
            {
                var entry = new StatusEntry()
                {
                    TypeOfEntry = StatusEntry.EntryType.Error,
                    Summary = sdkex.Message,
                    Details = sdkex.ProblemDetail
                };

                StatusMgr.LogEntry(entry);

                return null;
            }
        }
Beispiel #4
0
 internal static void ConnectionClosed(SDKConnection cn)
 {
     lock (_connections)
     {
         if (false == _connections.Remove(cn))
         {
             StatusMgr.LogError("Connection closed: connection not found");
         }
     }
 }