コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ep"></param>
        /// <param name="s">Takes control over to ease disposal</param>
        /// <param name="a">Takes control over to ease disposal</param>
        public ServerInfoRulesFetcher(IPEndPoint ep, LockedWrapper <ServerRulesServiceWrap> s,
                                      LockedWrapper <MatchmakingServiceWrap> a) : base(a)
        {
            _ep  = ep;
            _srs = s;
            RulesRefreshComplete =
                Observable
                .FromEvent <EventHandler <ServerRulesRefreshCompletedEventArgs>, ServerRulesRefreshCompletedEventArgs>
                    (handler => {
                EventHandler <ServerRulesRefreshCompletedEventArgs> evtHandler =
                    (sender, e) => handler(e);
                return(evtHandler);
            },
                    evtHandler => _srs.DoWithoutLock(srs => srs.RefreshComplete += evtHandler),
                    evtHandler => _srs.DoWithoutLock(srs => srs.RefreshComplete -= evtHandler),
                    _srs.Scheduler);

            RulesFailedToRespond =
                Observable
                .FromEvent
                <EventHandler <ServerRulesFailedToRespondEventArgs>, ServerRulesFailedToRespondEventArgs>
                    (handler => {
                EventHandler <ServerRulesFailedToRespondEventArgs> evtHandler = (sender, e) => handler(e);
                return(evtHandler);
            },
                    evtHandler => _srs.DoWithoutLock(srs => srs.ServerRulesFailedToRespond += evtHandler),
                    evtHandler => _srs.DoWithoutLock(srs => srs.ServerRulesFailedToRespond -= evtHandler),
                    _srs.Scheduler);
        }
コード例 #2
0
        public ServerInfoFetcher(LockedWrapper <MatchmakingServiceWrap> a)
        {
            _api            = a;
            ServerResponses =
                Observable.FromEvent <EventHandler <ServerRespondedEventArgs>, ServerRespondedEventArgs>(handler => {
                EventHandler <ServerRespondedEventArgs> evtHandler = (sender, e) => handler(e);
                return(evtHandler);
            },
                                                                                                         evtHandler => _api.DoWithoutLock(api => api.ServerResponded += evtHandler),
                                                                                                         evtHandler => _api.DoWithoutLock(api => api.ServerResponded -= evtHandler),
                                                                                                         _api.Scheduler);

            RefreshComplete =
                Observable.FromEvent <EventHandler <RefreshCompletedEventArgs>, RefreshCompletedEventArgs>(handler => {
                EventHandler <RefreshCompletedEventArgs> evtHandler = (sender, e) => handler(e);
                return(evtHandler);
            },
                                                                                                           evtHandler => _api.DoWithoutLock(api => api.RefreshComplete += evtHandler),
                                                                                                           evtHandler => _api.DoWithoutLock(api => api.RefreshComplete -= evtHandler),
                                                                                                           _api.Scheduler);

            ServerFailedToRespond =
                Observable.FromEvent <EventHandler <ServerFailedToRespondEventArgs>, ServerFailedToRespondEventArgs>(
                    handler => {
                EventHandler <ServerFailedToRespondEventArgs> evtHandler = (sender, e) => handler(e);
                return(evtHandler);
            },
                    evtHandler => _api.DoWithoutLock(api => api.ServerFailedToRespond += evtHandler),
                    evtHandler => _api.DoWithoutLock(api => api.ServerFailedToRespond -= evtHandler),
                    _api.Scheduler);
        }