Exemplo n.º 1
0
        public static IModule CreateModule(this PageSourceInfo info)
        {
            TkDebug.AssertArgumentNull(info, "info", null);

            IModuleCreator moduleCreator = PlugInFactoryManager.CreateInstance <IModuleCreator>(
                ModuleCreatorPlugInFactory.REG_NAME, info.ModuleCreator);

            return(moduleCreator.Create(info.Source));
        }
Exemplo n.º 2
0
        public MainCampfireViewModel(ILobbyModule lobbyModule, ILogModule logModule, IMessageBus bus,
                                     IModuleCreator creator, IGlobalCommands globalCommands)
        {
            _lobbyModule = lobbyModule;
            _logModule   = logModule;
            _bus         = bus;
            _creator     = creator;

            Modules = new ReactiveCollection <IModule> {
                _lobbyModule, _logModule
            };


            _bus.Listen <ActivateModuleMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
            .SubscribeUI(msg =>
            {
                CurrentModules = Modules.CreateDerivedCollection(module => new ModuleViewModel(module, bus));
            });

            bus.RegisterMessageSource(bus.Listen <ModuleLoaded>().Where(msg => msg.ModuleName == ModuleNames.MainCampfireView)
                                      .Select(_ => new ActivateModuleMessage(ModuleNames.MainCampfireView, _lobbyModule)));
            _activeModule = _lobbyModule;

            bus.Listen <RoomPresenceMessage>().SubscribeUI(SyncModuleList);

            _bus.Listen <ActivateModuleByIdMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
            .SubscribeUI(HandleActivateModuleById);

            _bus.Listen <ModuleActivatedMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
            .SubscribeUI(msg => ActiveModule = msg.Module);

            _bus.Listen <RequestLeaveRoomMessage>().SubscribeUI(OnRequestLeaveRoomMessage);

            ActivateModuleCommand = new ReactiveCommand();
            ActivateModuleCommand.OfType <ModuleViewModel>().Subscribe(HandleActivateModule);

            globalCommands.NextModuleCommand.Subscribe(OnNextModuleCommand);
            globalCommands.PreviousModuleCommand.Subscribe(OnPreviousModuleCommand);
        }
        public MainCampfireViewModel(ILobbyModule lobbyModule, ILogModule logModule, IMessageBus bus, 
			IModuleCreator creator, IGlobalCommands globalCommands)
        {
            _lobbyModule = lobbyModule;
            _logModule = logModule;
            _bus = bus;
            _creator = creator;

            Modules = new ReactiveCollection<IModule>{_lobbyModule, _logModule};

            _bus.Listen<ActivateModuleMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
                .SubscribeUI(msg =>
                    {
                        CurrentModules = Modules.CreateDerivedCollection(module => new ModuleViewModel(module, bus));
                    });

            bus.RegisterMessageSource(bus.Listen<ModuleLoaded>().Where(msg => msg.ModuleName == ModuleNames.MainCampfireView)
                .Select(_ => new ActivateModuleMessage(ModuleNames.MainCampfireView, _lobbyModule)));
            _activeModule = _lobbyModule;

            bus.Listen<RoomPresenceMessage>().SubscribeUI(SyncModuleList);

            _bus.Listen<ActivateModuleByIdMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
                .SubscribeUI(HandleActivateModuleById);

            _bus.Listen<ModuleActivatedMessage>().Where(msg => msg.ParentModule == ModuleNames.MainCampfireView)
                .SubscribeUI(msg => ActiveModule = msg.Module);

            _bus.Listen<RequestLeaveRoomMessage>().SubscribeUI(OnRequestLeaveRoomMessage);

            ActivateModuleCommand = new ReactiveCommand();
            ActivateModuleCommand.OfType<ModuleViewModel>().Subscribe(HandleActivateModule);

            globalCommands.NextModuleCommand.Subscribe(OnNextModuleCommand);
            globalCommands.PreviousModuleCommand.Subscribe(OnPreviousModuleCommand);
        }