예제 #1
0
        private void BreakConnectionAsync(Guid contactGuid, Guid abID, bool block, bool delete,
                                          BreakConnectionCompletedEventHandler callback)
        {
            BreakConnectionRequestType breakconnRequest = new BreakConnectionRequestType();

            breakconnRequest.contactId     = contactGuid.ToString("D");
            breakconnRequest.blockContact  = block;
            breakconnRequest.deleteContact = delete;

            if (abID != Guid.Empty)
            {
                abHandleType handler = new abHandleType();
                handler.ABId = abID.ToString("D");
                handler.Cid  = 0;
                handler.Puid = 0;

                breakconnRequest.abHandle = handler;
            }

            MsnServiceState  breakConnectionObject = new MsnServiceState(PartnerScenario.BlockUnblock, "BreakConnection", true);
            ABServiceBinding abService             = (ABServiceBinding)CreateService(MsnServiceType.AB, breakConnectionObject);

            abService.BreakConnectionCompleted += delegate(object sender, BreakConnectionCompletedEventArgs e)
            {
                OnAfterCompleted(new ServiceOperationEventArgs(abService, MsnServiceType.AB, e));

                if (e.Cancelled || NSMessageHandler.MSNTicket == MSNTicket.Empty)
                {
                    return;
                }

                if (callback != null)
                {
                    callback(sender, e);
                }
            };

            RunAsyncMethod(new BeforeRunAsyncMethodEventArgs(abService, MsnServiceType.AB, breakConnectionObject, breakconnRequest));
        }
예제 #2
0
        private void BreakConnectionAsync(Guid contactGuid, Guid abID, bool block, bool delete,
            BreakConnectionCompletedEventHandler callback)
        {
            BreakConnectionRequestType breakconnRequest = new BreakConnectionRequestType();
            breakconnRequest.contactId = contactGuid.ToString("D");
            breakconnRequest.blockContact = block;
            breakconnRequest.deleteContact = delete;

            if (abID != Guid.Empty)
            {
                abHandleType handler = new abHandleType();
                handler.ABId = abID.ToString("D");
                handler.Cid = 0;
                handler.Puid = 0;

                breakconnRequest.abHandle = handler;
            }

            MsnServiceState breakConnectionObject = new MsnServiceState(PartnerScenario.BlockUnblock, "BreakConnection", true);
            ABServiceBinding abService = (ABServiceBinding)CreateService(MsnServiceType.AB, breakConnectionObject);
            abService.BreakConnectionCompleted += delegate(object sender, BreakConnectionCompletedEventArgs e)
            {
                OnAfterCompleted(new ServiceOperationEventArgs(abService, MsnServiceType.AB, e));

                if (e.Cancelled || NSMessageHandler.MSNTicket == MSNTicket.Empty)
                    return;

                if (callback != null)
                {
                    callback(sender, e);
                }
            };

            RunAsyncMethod(new BeforeRunAsyncMethodEventArgs(abService, MsnServiceType.AB, breakConnectionObject, breakconnRequest));
        }