Пример #1
0
        protected virtual IAsyncResult OnBeginOnlineAnnouncement(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
        {
            // FIXME: this is a workaround for (similar to) bug #633945.
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
            case PlatformID.MacOSX:
                if (online == null)
                {
                    online = new Action <object, AnnouncementEventArgs> (OnlineAnnouncementReceived ?? delegate {});
                }
                return(online.BeginInvoke(this, new AnnouncementEventArgs(endpointDiscoveryMetadata, messageSequence), callback, state));

            default:
                if (OnlineAnnouncementReceived != null)
                {
                    OnlineAnnouncementReceived(this, new AnnouncementEventArgs(endpointDiscoveryMetadata, messageSequence));
                }
                var result = new TempAsyncResult(null, state);
                if (callback != null)
                {
                    callback(result);
                }
                return(result);
            }
        }
Пример #2
0
		protected virtual IAsyncResult OnBeginOfflineAnnouncement (DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
		{
			// FIXME: this is a workaround for (similar to) bug #633945.
			switch (Environment.OSVersion.Platform) {
			case PlatformID.Unix:
			case PlatformID.MacOSX:
				if (offline == null)
					offline = new Action<object,AnnouncementEventArgs> (OfflineAnnouncementReceived ?? delegate {});
				return offline.BeginInvoke (this, new AnnouncementEventArgs (endpointDiscoveryMetadata, messageSequence), callback, state);
			default:
				if (OfflineAnnouncementReceived != null)
					OfflineAnnouncementReceived (this, new AnnouncementEventArgs (endpointDiscoveryMetadata, messageSequence));
				var result = new TempAsyncResult (null, state);
				if (callback != null)
					callback (result);
				return result;
			}
		}
Пример #3
0
        protected override IAsyncResult OnBeginResolve(ResolveCriteria resolveCriteria, AsyncCallback callback, object state)
        {
            // FIXME: this is a workaround for (similar to) bug #633945.
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
            case PlatformID.MacOSX:
                if (resolve_delegate == null)
                {
                    resolve_delegate = new Func <ResolveCriteria, EndpointDiscoveryMetadata> (Resolve);
                }
                return(resolve_delegate.BeginInvoke(resolveCriteria, callback, state));

            default:
                var ret    = Resolve(resolveCriteria);
                var result = new TempAsyncResult(ret, state);
                if (callback != null)
                {
                    callback(result);
                }
                return(result);
            }
        }
Пример #4
0
        protected override IAsyncResult OnBeginFind(FindRequestContext findRequestContext, AsyncCallback callback, object state)
        {
            // FIXME: this is a workaround for (similar to) bug #633945.
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
            case PlatformID.MacOSX:
                if (find_delegate == null)
                {
                    find_delegate = new Action <FindRequestContext> (Find);
                }
                return(find_delegate.BeginInvoke(findRequestContext, callback, state));

            default:
                Find(findRequestContext);
                var result = new TempAsyncResult(null, state);
                if (callback != null)
                {
                    callback(result);
                }
                return(result);
            }
        }
Пример #5
0
		protected override IAsyncResult OnBeginResolve (ResolveCriteria resolveCriteria, AsyncCallback callback, object state)
		{
			// FIXME: this is a workaround for (similar to) bug #633945.
			switch (Environment.OSVersion.Platform) {
			case PlatformID.Unix:
			case PlatformID.MacOSX:
				if (resolve_delegate == null)
					resolve_delegate = new Func<ResolveCriteria,EndpointDiscoveryMetadata> (Resolve);
				return resolve_delegate.BeginInvoke (resolveCriteria, callback, state);
			default:
				var ret = Resolve (resolveCriteria);
				var result = new TempAsyncResult (ret, state);
				if (callback != null)
					callback (result);
				return result;
			}
		}
Пример #6
0
		protected override IAsyncResult OnBeginFind (FindRequestContext findRequestContext, AsyncCallback callback, object state)
		{
			// FIXME: this is a workaround for (similar to) bug #633945.
			switch (Environment.OSVersion.Platform) {
			case PlatformID.Unix:
			case PlatformID.MacOSX:
				if (find_delegate == null)
					find_delegate = new Action<FindRequestContext> (Find);
				return find_delegate.BeginInvoke (findRequestContext, callback, state);
			default:
				Find (findRequestContext);
				var result = new TempAsyncResult (null, state);
				if (callback != null)
					callback (result);
				return result;
			}
		}