Represents a connection to the SDK. Supports both desktop and online connections. In order to create a connection, use the ConnectionMgr class
Inheritance: IDisposable
示例#1
0
 internal static void ConnectionClosed(SDKConnection cn)
 {
     lock (_connections)
     {
         if (false == _connections.Remove(cn))
         {
             StatusMgr.LogError("Connection closed: connection not found");
         }
     }
 }
示例#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);
            }
        }
示例#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;
            }
        }
示例#4
0
 internal static void ConnectionClosed(SDKConnection cn)
 {
     lock (_connections)
     {
         if (false == _connections.Remove(cn))
         {
             StatusMgr.LogError("Connection closed: connection not found");
         }
     }
 }