且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

启用端点时,不会调用OnEnable方法

更新时间:2022-10-15 23:34:14

我没有看到一个名为this.endpoint.enable(功能)在你的code.wht任何地方不ü看看由UCC API提供的示例应用程序的SDK它会帮助你。块引用>

Hi All,

I have created the different contexts and initialized the endpoint with IUccOperationContext.  When I initialize the endpoint, it gets successfully executed but it doesn't call the OnEnable method which is associated with it. What is the actual error? Is the end point not initialized properly?

Following is the code:

UccContext endpointContext = new UccContext();


endpointContext.AddProperty( (int)UCC_SERVER_ENDPOINT_FLAGS.UCCSEF_DISABLE_STRICT_DNS, (object) Boolean.TrueString);

this.endpoint = this.platform.CreateEndpoint(UCC_ENDPOINT_TYPE.UCCET_PRINCIPAL_SERVER_BASED, meUri, null, endpointContext);

UccOperationContext obj = new UccOperationContext();

obj.Initialize(6, endpointContext);

----------------------------------

OnEnable:

 void _IUccEndpointEvents.OnEnable(
            IUccEndpoint pEventSource,
            IUccOperationProgressEvent pEventData
            )
        {
            try
            {
                if (pEventData.IsComplete)
                {
                    if (pEventData.StatusCode >= 0)
                    {

                        // Sign in succeeded. Get SubscriptionManager and PubicationManager
                        // from the endpoint
                        this.subMgr = (IUccSubscriptionManager)endpoint;
                        this.pubMgr = (IUccPublicationManager)endpoint;

                        // Subscribe for self contact card, availability and contacts
                        this.SelfSubscribe();
                        // After subscription for categories, containers and availability has
                        // succeeded, publish self avaiability as "Available".

                        this.PublishAvailability("Available", false);

                        // Publish an Access Control Entry allowing everyone to see your availability
                        this.PublishAcessControlEntryForEveryoneInSameCompany();

                    }
                    else
                    {
                        bool nextAvailable = false;
                        IUccServerSignalingSettings serverSignalingSettings = null;
                        if (servers != null)
                        {
                           
                            serverSignalingSettings = (IUccServerSignalingSettings) this.endpoint;
                            nextAvailable = servers.MoveNext();                           

                        }

                        if (nextAvailable)
                        {
                            serverSignalingSettings.Server = (IUccSignalingServer) servers.Current;

                            Console.WriteLine("OnEnable: Server available: " + serverSignalingSettings.Server.ServerAddress.ToString());

                            //Enable the endpoint to login
                            pEventSource.Enable(null);
                        }
                        else
                        {
                            Console.WriteLine("OnEnable: Server not available.");

                            // Sign in failed. Make the endpoint null.
                            this.endpoint = null;

                            // Raise an event to indicate sign in failed. The listener of the
                            // event is expected to shutdown the platform
                            SigninDone(false);
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                Utilities.ReportError(ex.ToString());
            }
        }

 


 

i dont see a function called this.endpoint.enable() anywhere in your code.wht dont u look at sample application provided by the ucc api sdk it will help you.