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 static ServiceErrorCode ErrorCodeToServiceError(AV.ErrorCode error) { switch (error) { case AV.ErrorCode.Ok: return(ServiceErrorCode.None); case AV.ErrorCode.Collision: return(ServiceErrorCode.NameConflict); default: return(ServiceErrorCode.Unknown); } }