예제 #1
0
        internal virtual void HandleInternal(object sender, object message)
        {
            var busyToken = message as IBusyToken;

            if (busyToken != null)
            {
                HandleMode messageMode = Settings.HandleBusyMessageMode;
                if (messageMode.HasFlagEx(HandleMode.Handle))
                {
                    var token = new BusyToken(this, busyToken);
                    if (token.Combine(this))
                    {
                        OnBeginBusy(token);
                    }
                }
                if (messageMode.HasFlagEx(HandleMode.NotifySubscribers))
                {
                    PublishInternal(sender, message);
                }
                return;
            }
            if (Settings.BroadcastAllMessages || message is IBroadcastMessage)
            {
                PublishInternal(sender, message);
            }
        }
예제 #2
0
        public virtual IBusyToken BeginBusy(object message = null)
        {
            var token = new BusyToken(this, message ?? Settings.DefaultBusyMessage);

            token.Combine(this);
            Publish(token);
            OnBeginBusy(token);
            return(token);
        }