public bool Reset()
        {
            var request  = new DistributionCommon.Comm.Requests.Reset();
            var response = this.SendRequest <DistributionCommon.Comm.Responses.Reset>(request);

            if (response != default(DistributionCommon.Comm.Responses.Reset))
            {
                return(response.Success);
            }

            return(false);
        }
Пример #2
0
        private Tuple <bool?, DistributionCommon.Comm.Responses.Base> HandleRequest(DistributionCommon.Comm.Requests.Reset request)
        {
            bool success = false;

            if (this.constructed)
            {
                this.schematic   = default(DistributionCommon.Schematic.Node);
                this.constructed = false;
                foreach (var worker in this.workers.Values.ToList().FindAll(w => w.Awake))
                {
                    worker.Sleep();
                }

                this.workers = new Dictionary <int, DistributedWorker.Worker>();
                success      = true;
            }

            return(new Tuple <bool?, DistributionCommon.Comm.Responses.Base>(success, new DistributionCommon.Comm.Responses.Reset(success)));
        }