コード例 #1
0
        bool InitConnection()
        {
            if (m_Session != null)
            {
                return(true);
            }

            HPMUInt64 CurrentTime = GetTimeSince1970();

            if (CurrentTime > m_NextConnectionAttempt)
            {
                m_NextConnectionAttempt = 0;

                EHPMSdkDebugMode DebugMode = EHPMSdkDebugMode.Off;
#if (DEBUG)
                DebugMode = EHPMSdkDebugMode.Debug;             // Set debug flag so we will get memory leak info.
#endif

                try
                {
                    // You should change these parameters to match your development server and the SDK account you have created. For more information see SDK documentation.
                    m_Session = HPMSdkSession.SessionOpen("localhost", 50256, "Company Projects", "SDK", "SDK", m_Callback, null, true, DebugMode, (IntPtr)0, 0, "", "", null);
                }
                catch (HPMSdkException _Error)
                {
                    Console.WriteLine("SessionOpen failed with error:" + _Error.ErrorAsStr());
                    return(false);
                }
                catch (HPMSdkManagedException _Error)
                {
                    Console.WriteLine("SessionOpen failed with error:" + _Error.ErrorAsStr());
                    return(false);
                }

                Console.WriteLine("Successfully opened session.\r\n");
                m_Session.GlobalRegisterCustomSettings(m_IntegrationIdentifier, m_CustomSettings);
                m_bBrokenConnection = false;

                return(true);
            }

            return(false);
        }
コード例 #2
0
        bool InitConnection()
        {
            if (m_Session != null)
                return true;

            HPMUInt64 CurrentTime = GetTimeSince1970();
            if (CurrentTime > m_NextConnectionAttempt)
            {
                m_NextConnectionAttempt = 0;

                EHPMSdkDebugMode DebugMode = EHPMSdkDebugMode.Off;
#if (DEBUG)
			    DebugMode = EHPMSdkDebugMode.Debug; // Set debug flag so we will get memory leak info.
#endif

                try
                {
                    // You should change these parameters to match your development server and the SDK account you have created. For more information see SDK documentation.
                    m_Session = HPMSdkSession.SessionOpen("localhost", 50256, "Company Projects", "SDK", "SDK", m_Callback, null, true, DebugMode, (IntPtr)0, 0, "", "", null);
                }
                catch (HPMSdkException _Error)
                {
                    Console.WriteLine("SessionOpen failed with error:" + _Error.ErrorAsStr());
                    return false;
                }
                catch (HPMSdkManagedException _Error)
                {
                    Console.WriteLine("SessionOpen failed with error:" + _Error.ErrorAsStr());
                    return false;
                }

                Console.WriteLine("Successfully opened session.\r\n");
                m_Session.GlobalRegisterCustomSettings(m_IntegrationIdentifier, m_CustomSettings);
                m_bBrokenConnection = false;

                return true;
            }

            return false;
        }