예제 #1
0
            protected void EventHandler(EventInfo e)
            {
                if (_IsCompleted)
                {
                    return;
                }

                // Events that don't match are silently rejected.
                // FIXME: Is this actually horrible
                if (!TryExtractResult(e, out Result))
                {
                    return;
                }

                e.Consume();
                _IsCompleted = true;
                Dispose();

                if (Continuation != null)
                {
                    Continuation();
                }

                if (_Future != null)
                {
                    _Future.SetResult(Result, null);
                }
            }
예제 #2
0
        protected override IEnumerator <object> OnPreferencesChanged(Squared.Util.Event.EventInfo evt, string[] prefNames)
        {
            var oldPort = GetPref("ServerPort", 80);

            yield return(Preferences.GetAll().Bind(() => CurrentPrefs));

            if (GetPref("ServerPort", 80) != oldPort)
            {
                yield return(ResetListener());
            }
        }
예제 #3
0
 protected abstract bool TryExtractResult(EventInfo e, out T result);