Task IEnvironment.Start() { if (this.People == null) { this.People = new List <IPerson>(); this.Thief = ActorProxy.Create <IThief>(new ActorId(1), "fabric:/FabricSmartHome"); for (int idx = 2; idx < 9; idx++) { this.People.Add(ActorProxy.Create <IPerson>(new ActorId(idx), "fabric:/FabricSmartHome")); } ActorProxy.Create <IHouse>(new ActorId(100), "fabric:/FabricSmartHome"); ActorEventSource.Current.ActorMessage(this, "[LOG] Environment started."); this.PersonTimer = this.RegisterTimer(HandlePersonTimeout, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); this.ThiefTimer = this.RegisterTimer(HandleThiefTimeout, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); } return(Task.FromResult(true)); }
public Task Start() { if (this.People == null) { this.People = new List <IPerson>(); this.Thief = ActorProxy.Create <IThief>(new ActorId(1), "fabric:/FabricSmartHome"); for (int idx = 2; idx < 9; idx++) { this.People.Add(ActorProxy.Create <IPerson>(new ActorId(idx), "fabric:/FabricSmartHome")); } ActorProxy.Create <IHouse>(new ActorId(100), "fabric:/FabricSmartHome"); ActorModel.Log("[LOG] Environment started."); this.PersonTimer = this.RegisterTimer(HandlePersonTimeout, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); this.ThiefTimer = this.RegisterTimer(HandleThiefTimeout, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); } return(new Task(() => { })); }