Skip to content

Commit

Permalink
Attempt #2 at Silverlight Compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindaub committed Aug 24, 2015
1 parent 003a51e commit 1dd7e7f
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 41 deletions.
39 changes: 39 additions & 0 deletions src/NLog/LogReceiverService/WcfILogReceiverClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,45 @@ public override void EndProcessLogMessages(IAsyncResult result)
{
this.Channel.EndProcessLogMessages(result);
}

#if SILVERLIGHT
/// <summary>
/// Returns a new channel from the client to the service.
/// </summary>
/// <returns>
/// A channel of type <see cref="ILogReceiverOneWayClient"/> that identifies the type
/// of service contract encapsulated by this client object (proxy).
/// </returns>
protected override ILogReceiverClient CreateChannel()
{
return new LogReceiverServerClientChannel(this);
}

private class LogReceiverServerClientChannel : ChannelBase<ILogReceiverClient>, ILogReceiverClient
{
public LogReceiverServerClientChannel(ClientBase<ILogReceiverClient> client) :
base(client)
{
}

public IAsyncResult BeginProcessLogMessages(NLogEvents events, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke(
"ProcessLogMessages",
new object[] { events },
callback,
asyncState);
}

public void EndProcessLogMessages(IAsyncResult result)
{
this.EndInvoke(
"ProcessLogMessages",
new object[] { },
result);
}
}
#endif
}
}

Expand Down
41 changes: 0 additions & 41 deletions src/NLog/LogReceiverService/WcfLogReceiverClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,6 @@ public void ProcessLogMessagesAsync(NLogEvents events, object userState)
/// <param name="result">The result.</param>
public abstract void EndProcessLogMessages(IAsyncResult result);

#if SILVERLIGHT
/// <summary>
/// Returns a new channel from the client to the service.
/// </summary>
/// <returns>
/// A channel of type <see cref="ILogReceiverOneWayClient"/> that identifies the type
/// of service contract encapsulated by this client object (proxy).
/// </returns>
protected override TService CreateChannel()
{
return new LogReceiverServerClientChannel(this);
}
#endif

private IAsyncResult OnBeginProcessLogMessages(object[] inValues, AsyncCallback callback, object asyncState)
{
var events = (NLogEvents)inValues[0];
Expand Down Expand Up @@ -293,33 +279,6 @@ private void OnCloseCompleted(object state)
this.CloseCompleted(this, new AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
}
}

#if SILVERLIGHT
private class LogReceiverServerClientChannel : ChannelBase<TService>, TService
{
public LogReceiverServerClientChannel(ClientBase<TService> client) :
base(client)
{
}

public IAsyncResult BeginProcessLogMessages(NLogEvents events, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke(
"ProcessLogMessages",
new object[] { events },
callback,
asyncState);
}

public void EndProcessLogMessages(IAsyncResult result)
{
this.EndInvoke(
"ProcessLogMessages",
new object[] { },
result);
}
}
#endif
}
}

Expand Down
39 changes: 39 additions & 0 deletions src/NLog/LogReceiverService/WcfLogReceiverOneWayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,45 @@ public override void EndProcessLogMessages(IAsyncResult result)
{
this.Channel.EndProcessLogMessages(result);
}

#if SILVERLIGHT
/// <summary>
/// Returns a new channel from the client to the service.
/// </summary>
/// <returns>
/// A channel of type <see cref="ILogReceiverOneWayClient"/> that identifies the type
/// of service contract encapsulated by this client object (proxy).
/// </returns>
protected override ILogReceiverOneWayClient CreateChannel()
{
return new LogReceiverServerClientChannel(this);
}

private class LogReceiverServerClientChannel : ChannelBase<ILogReceiverOneWayClient>, ILogReceiverOneWayClient
{
public LogReceiverServerClientChannel(ClientBase<ILogReceiverOneWayClient> client) :
base(client)
{
}

public IAsyncResult BeginProcessLogMessages(NLogEvents events, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke(
"ProcessLogMessages",
new object[] { events },
callback,
asyncState);
}

public void EndProcessLogMessages(IAsyncResult result)
{
this.EndInvoke(
"ProcessLogMessages",
new object[] { },
result);
}
}
#endif
}
}

Expand Down
39 changes: 39 additions & 0 deletions src/NLog/LogReceiverService/WcfLogReceiverTwoWayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,45 @@ public override void EndProcessLogMessages(IAsyncResult result)
{
this.Channel.EndProcessLogMessages(result);
}

#if SILVERLIGHT
/// <summary>
/// Returns a new channel from the client to the service.
/// </summary>
/// <returns>
/// A channel of type <see cref="ILogReceiverOneWayClient"/> that identifies the type
/// of service contract encapsulated by this client object (proxy).
/// </returns>
protected override ILogReceiverOneWayClient CreateChannel()
{
return new LogReceiverServerClientChannel(this);
}

private class LogReceiverServerClientChannel : ChannelBase<ILogReceiverTwoWayClient>, ILogReceiverTwoWayClient
{
public LogReceiverServerClientChannel(ClientBase<ILogReceiverTwoWayClient> client) :
base(client)
{
}

public IAsyncResult BeginProcessLogMessages(NLogEvents events, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke(
"ProcessLogMessages",
new object[] { events },
callback,
asyncState);
}

public void EndProcessLogMessages(IAsyncResult result)
{
this.EndInvoke(
"ProcessLogMessages",
new object[] { },
result);
}
}
#endif
}
}

Expand Down

0 comments on commit 1dd7e7f

Please sign in to comment.