using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Threading;
+using System.ServiceModel.MonoInternal;
namespace System.ServiceModel
{
[MonoTODO ("It somehow rejects classes, but dunno how we can do that besides our code wise.")]
public abstract class ClientBase<TChannel> :
-#if !NET_2_1
+#if !MOONLIGHT
IDisposable,
#endif
ICommunicationObject where TChannel : class
{
static InstanceContext initialContxt = new InstanceContext (null);
-#if NET_2_1
+#if MOONLIGHT
static readonly PropertyInfo dispatcher_main_property;
static readonly MethodInfo dispatcher_begin_invoke_method;
}
}
-#if !NET_2_1
public ClientCredentials ClientCredentials {
get { return ChannelFactory.Credentials; }
}
-#endif
public ServiceEndpoint Endpoint {
get { return factory.Endpoint; }
void RunCompletedCallback (SendOrPostCallback callback, InvokeAsyncCompletedEventArgs args)
{
-#if !NET_2_1
+#if !MOONLIGHT
callback (args);
#else
object dispatcher = dispatcher_main_property.GetValue (null, null);
EventHandler a = delegate {
try {
callback (args);
- Console.WriteLine ("ClientBase<TChannel>: operationCompletedCallback is successfully done (unless the callback has further async operations)");
+ //Console.WriteLine ("ClientBase<TChannel>: operationCompletedCallback is successfully done (unless the callback has further async operations)");
} catch (Exception ex) {
- Console.WriteLine ("ClientBase<TChannel> caught an error during operationCompletedCallback: " + ex);
+ //Console.WriteLine ("ClientBase<TChannel> caught an error during operationCompletedCallback: " + ex);
throw;
}
};
if (operationCompletedCallback != null)
RunCompletedCallback (operationCompletedCallback, new InvokeAsyncCompletedEventArgs (results, error, cancelled, userState));
} catch (Exception ex) {
- Console.WriteLine ("Exception during operationCompletedCallback" + ex);
+ //Console.WriteLine ("Exception during operationCompletedCallback" + ex);
throw;
}
- Console.WriteLine ("System.ServiceModel.ClientBase<TChannel>: web service invocation is successfully done (operationCompletedCallback may not be).");
+ //Console.WriteLine ("System.ServiceModel.ClientBase<TChannel>: web service invocation is successfully done (operationCompletedCallback may not be).");
};
begin_async_result = beginOperationDelegate (inValues, cb, userState);
}
IAsyncResult begin_async_result;
-#if !NET_2_1
+#if !MOONLIGHT
void IDisposable.Dispose ()
{
Close ();
internal ClientRuntimeChannel Inner {
get {
if (inner_channel == null)
- inner_channel = new ClientRuntimeChannel (endpoint, factory, null, null);
+ inner_channel = new ClientRuntimeChannel (endpoint, factory, endpoint.Address, null);
return inner_channel;
}
}
-#if !NET_2_1
- public object Invoke (string methodName, object [] args)
+#if !MOONLIGHT
+ protected object Invoke (string methodName, object [] args)
{
var cd = endpoint.Contract;
var od = cd.Operations.Find (methodName);