private void OnServiceRemoved(object o, AV.ServiceInfoArgs args) { ServiceBrowseEventHandler handler = ServiceRemoved; if(handler != null) { handler(this, new ServiceBrowseEventArgs(new ResolvableService(client, args.Service))); } }
public Service(AV.ServiceInfo service) { this.service = service; }
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; } }
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; } }
public ResolvableService(AV.Client client, AV.ServiceInfo service) : base(service) { this.client = client; }
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)); } }