Beispiel #1
0
        public ShellViewModel(HomeViewModel home, SettingsViewModel settings, ConversationsViewModel convos, IActorRefFactory system)
        {
            _screens.Add(Screens.Home, home);
            _screens.Add(Screens.Settings, settings);
            _screens.Add(Screens.Conversations, convos);

            system.ActorSelection(ClientActorPaths.ErrorDialogActor.Path)
                .Tell(new ErrorDialogActor.RegisterShell(this));

            _shellViewModelActor = system.ActorOf(Props.Create(() => new ShellViewModelActor(this)),
                ClientActorPaths.ShellViewModelActor.Name);
        }
        public HomeViewModelActor(HomeViewModel viewModel)
        {
            _viewModel = viewModel;

            Receive<ClientTracking.NewClientList>(msg => _viewModel.SetClients(msg.Clients));
            Receive<ClientTracking.ClientConnected>(msg => _viewModel.NewClient(msg.Client));
            Receive<ClientTracking.ClientDisconnected>(msg => _viewModel.ClientDisconnected(msg.Client));
            Receive<ClientTracking.ClientChanged>(msg => _viewModel.UpdatedClient(msg.Client));

            Receive<ShoutMessages.OutgoingShout>(msg => SendShout(msg));
            Receive<ShoutMessages.IncomingShout>(msg => _viewModel.ReceiveShout(msg));

            Receive<ConversationMessages.ConversationRequest>(msg => HandleConversationRequest(msg));

            Receive<ConnectionActor.ChangeStatus>(
                msg => Context.ActorSelection(ClientActorPaths.ConnectionActor.Path).Tell(msg));
        }