Пример #1
0
        private Boolean CreateNewApi()
        {
            Boolean bRetVal = true;

            try
            {
                // Remove any existing one
                DeleteApi();

                // create a new one and hook up the events...
                _objCPCC  = new CallParrotCtiConnect();
                _objCPCC2 = (CallParrotCtiACTIVELib.ICallParrotCtiConnect2)_objCPCC;
                //_objCPCC.OnServerTimeChange += new _ICallParrotCtiConnectEvents_OnServerTimeChangeEventHandler(_objCPCC_OnServerTimeChange);
                _objCPCC.OnServerDown += new _ICallParrotCtiConnectEvents_OnServerDownEventHandler(_objCPCC_OnServerDown);

                //_objCPCC.OnCallRecorded += new _ICallParrotCtiConnectEvents_OnCallRecordedEventHandler(_objCPCC_OnCallRecorded);
                _objCPCC.OnCallStart += new _ICallParrotCtiConnectEvents_OnCallStartEventHandler(_objCPCC_OnCallStart);
                //_objCPCC.OnCallEnd += new _ICallParrotCtiConnectEvents_OnCallEndEventHandler(_objCPCC_OnCallEnd);
                //_objCPCC.OnCallResume += new _ICallParrotCtiConnectEvents_OnCallResumeEventHandler(_objCPCC_OnCallResume);
                //_objCPCC.OnCallHold += new _ICallParrotCtiConnectEvents_OnCallHoldEventHandler(_objCPCC_OnCallHold);
                //_objCPCC.OnCallBlocked += new _ICallParrotCtiConnectEvents_OnCallBlockedEventHandler(_objCPCC_OnCallBlocked);
            }
            catch (Exception ex)
            {
                DeleteApi();
                Trace.WriteLine("CreateNewApi Failed with exception: " + ex.Message);
                bRetVal = false;
            }

            return(bRetVal);
        }
Пример #2
0
        private void DeleteApi()
        {
            if (_objCPCC != null)
            {
                //_objCPCC.OnServerTimeChange -= new _ICallParrotCtiConnectEvents_OnServerTimeChangeEventHandler(_objCPCC_OnServerTimeChange);
                _objCPCC.OnServerDown -= new _ICallParrotCtiConnectEvents_OnServerDownEventHandler(_objCPCC_OnServerDown);

                //_objCPCC.OnCallRecorded -= new _ICallParrotCtiConnectEvents_OnCallRecordedEventHandler(_objCPCC_OnCallRecorded);
                _objCPCC.OnCallStart -= new _ICallParrotCtiConnectEvents_OnCallStartEventHandler(_objCPCC_OnCallStart);
                //_objCPCC.OnCallEnd -= new _ICallParrotCtiConnectEvents_OnCallEndEventHandler(_objCPCC_OnCallEnd);
                //_objCPCC.OnCallResume -= new _ICallParrotCtiConnectEvents_OnCallResumeEventHandler(_objCPCC_OnCallResume);
                //_objCPCC.OnCallHold -= new _ICallParrotCtiConnectEvents_OnCallHoldEventHandler(_objCPCC_OnCallHold);
                //_objCPCC.OnCallBlocked -= new _ICallParrotCtiConnectEvents_OnCallBlockedEventHandler(_objCPCC_OnCallBlocked);
                _objCPCC  = null;
                _objCPCC2 = null;
            }
        }