예제 #1
0
 private void OnServiceRemoved(object o, AV.ServiceInfoArgs args)
 {
     ServiceBrowseEventHandler handler = ServiceRemoved;
     if(handler != null) {
         handler(this, new ServiceBrowseEventArgs(new ResolvableService(client, args.Service)));
     }
 }
예제 #2
0
 public Service(AV.ServiceInfo service)
 {
     this.service = service;
 }
예제 #3
0
 private void OnEntryGroupStateChanged(object o, AV.EntryGroupStateArgs args)
 {
     switch(args.State) {
         case AV.EntryGroupState.Collision:
             if(!OnResponse(AV.ErrorCode.Collision)) {
                 throw new ApplicationException();
             }
             break;
         case AV.EntryGroupState.Failure:
             if(!OnResponse(AV.ErrorCode.Failure)) {
                 throw new ApplicationException();
             }
             break;
         case AV.EntryGroupState.Established:
             OnResponse(AV.ErrorCode.Ok);
             break;
     }
 }
예제 #4
0
        protected virtual bool OnResponse(AV.ErrorCode errorCode)
        {
            RegisterServiceEventArgs args = new RegisterServiceEventArgs();

            args.Service = this;
            args.IsRegistered = false;
            args.ServiceError = AvahiUtils.ErrorCodeToServiceError(errorCode);

            if(errorCode == AV.ErrorCode.Ok) {
                args.IsRegistered = true;
            }

            RegisterServiceEventHandler handler = Response;
            if(handler != null) {
                handler(this, args);
                return true;
            } else {
                return false;
            }
        }
예제 #5
0
 public ResolvableService(AV.Client client, AV.ServiceInfo service)
     : base(service)
 {
     this.client = client;
 }
예제 #6
0
        private void OnServiceResolved(object o, AV.ServiceInfoArgs args)
        {
            service = args.Service;
            ((AV.ServiceResolver)o).Dispose();

            ServiceResolvedEventHandler handler = Resolved;
            if(handler != null) {
                handler(this, new ServiceResolvedEventArgs(this));
            }
        }