예제 #1
0
        public ServerActor()
        {
            Context.ActorOf(ClientServer.Props(), "ClientServer");
            Context.ActorOf(LocalServer.Props(), "LocalServer");
            Context.ActorOf(DataBaseServer.Props(), "DataBaseServer");

            Receive <MessageOfListViewUpdateLocalList>(updatedLocal =>
                                                       LocalToClient_Send_CreatedLocalID(updatedLocal));

            Receive <MessageOfRequestLocalIDs>(requestedLocalID =>
                                               RequestAllLocalID(requestedLocalID));

            Receive <MessageOfReturnLocalID>(returnLocal =>
                                             ReturnAllLocalID(returnLocal));

            Receive <UpdateMonitor>(receivedLocalData =>
                                    SendToClient_DataOfLocal(receivedLocalData));

            Receive <UnsubscribeMonitorLocal>(deletedLocal =>
                                              DeleteLocal(deletedLocal));

            Schedule = Context
                       .System
                       .Scheduler
                       .ScheduleTellRepeatedlyCancelable(
                TimeSpan.Zero,                  // The time period that has to pass before the first message is sent.
                TimeSpan.FromSeconds(1),        // The interval, i.e. the time period that has to pass between messages are being sent.
                Self,                           // The receiver.
                new Start(),                    // The message.
                Self);                          // The sender.

            Receive <Start>(_ => Handle(_));
        }