コード例 #1
0
        public ActionResult Stop()
        {
            Control control = new Control()
            {
                Stop = true
            };

            BusHost.Publish<Control>(control, BusTopic.Control);
            return RedirectToAction("Index", "Admin");
        }
コード例 #2
0
ファイル: Host.cs プロジェクト: Fryhard/DevConfZA2016
        public Task ProcessControl(Control control)
        {
            return Task.Factory.StartNew(() =>
            {
                if (control.Stop)
                {
                    SubscriptionHandler.Instance.Unsubscribe("GoodVote");
                    SubscriptionHandler.Instance.Unsubscribe("BadVote");
                    SubscriptionHandler.Instance.Unsubscribe("SaveVote");
                }

                if (control.Start)
                {
                    Subscribe();
                }

                if (control.Reset && _VoteProcessor != null)
                {
                    _VoteProcessor.Reset();
                }
            });
        }