コード例 #1
0
 public void ExecuteCommand(CommandViewModel commandVM, SecureCommandArgs args)
 {
     var act = GetCommandDelegate(commandVM);
     if (act != null)
     {
         act(args);
     }
 }
コード例 #2
0
        public void ExecuteCommand(CommandViewModel commandVM, SecureCommandArgs args)
        {
            var act = GetCommandDelegate(commandVM);

            if (act != null)
            {
                act(args);
            }
        }
コード例 #3
0
 protected override void InitializeCommand()
 {
     base.InitializeCommand();
     OnMicCommandVM     = new CommandViewModel(BuiltIns.OnMicCommand, this, OnMicCommandExecute);
     ConfigCommand      = new SecureCommand(ConfigCommandExecute);
     PlayMusicCommand   = new SecureCommand(PlayMusicCommandExecute, CanPlayMusicCommandExecute);
     ManageMusicCommand = new SecureCommand(ManageMusicCommandExecute, CanManageMusicCommandExecute);
     //RecordCommand = new SecureCommand(RecordCommandExecute);
     //PlayCommand = new SecureCommand(PlayCommandExecute);
     //StopCommand = new SecureCommand(StopCommandExecute);
 }
コード例 #4
0
 protected override void InitializeCommand()
 {
     base.InitializeCommand();
     OnMicCommandVM = new CommandViewModel(BuiltIns.OnMicCommand, this,OnMicCommandExecute);
     ConfigCommand = new SecureCommand(ConfigCommandExecute);
     PlayMusicCommand = new SecureCommand(PlayMusicCommandExecute, CanPlayMusicCommandExecute);
     ManageMusicCommand = new SecureCommand(ManageMusicCommandExecute, CanManageMusicCommandExecute);
     //RecordCommand = new SecureCommand(RecordCommandExecute);
     //PlayCommand = new SecureCommand(PlayCommandExecute);
     //StopCommand = new SecureCommand(StopCommandExecute);
 }
コード例 #5
0
ファイル: UserViewModel.cs プロジェクト: wangws556/duoduogit
 public bool HasCommand(UserViewModel target, CommandViewModel cmd, RoomViewModel room)
 {
     if (RoleVM != null && target.RoleVM != null)
     {
         var rcv = RoleVM.RoleCommandVMs.FirstOrDefault(rc => rc.TargetRoleVM == target.RoleVM && rc.CommandVM == cmd);
         if (rcv != null)
         {
             if (rcv.IsManagerCommand)
             {
                 return(IsRoleInRoom(room, BuiltIns.RoomAdministratorRole));
             }
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
        public bool HasCommand(UserViewModel target, CommandViewModel cmd, RoomViewModel room)
        {
            if (RoleVM != null && target.RoleVM != null)
            {
                var rcv =  RoleVM.RoleCommandVMs.FirstOrDefault(rc => rc.TargetRoleVM == target.RoleVM && rc.CommandVM == cmd);
                if (rcv != null)
                {
                    if (rcv.IsManagerCommand)
                    {
						return IsRoleInRoom(room, BuiltIns.RoomAdministratorRole);
                    }
                    return true;
                }
            }
            return false;
        }
コード例 #7
0
 private void BuildCache()
 {
     Cache.Images.ForEach(img =>
     {
         AddImage(img);
     });
     Cache.GiftGroups.ForEach(g =>
     {
         GiftGroupViewModel giftGroupVM = new GiftGroupViewModel(g);
         LocalCache.AllGiftGroupVMs.Add(giftGroupVM);
     });
     Cache.Gifts.ForEach(g =>
     {
         GiftViewModel giftVM = new GiftViewModel(g);
         giftVM.Initialize();
         LocalCache.AllGiftVMs.Add(giftVM);
     });
     LocalCache.AllGiftGroupVMs.ForEach(g =>
     {
         g.Initialize();
     });
     Cache.RoomGroups.ForEach(rg =>
     {
         RoomGroupViewModel roomGroupVM = new RoomGroupViewModel(rg);
         LocalCache.AllRoomGroupVMs.Add(roomGroupVM);
     });
     //Create all the RoomViewModels so that we can initialize the RoomVMs of RoomGroupVM
     Cache.Rooms.ForEach(r =>
     {
         RoomViewModel roomVM = new RoomViewModel(r);
         roomVM.Initialize();
         LocalCache.AllRoomVMs.Add(roomVM);
     });
     LocalCache.AllRoomGroupVMs.ForEach(rgv =>
     {
         rgv.Initialize();
     });
     Cache.Commands.ForEach(c =>
     {
         if (c.Application_Id == ApplicationId || c.Application_Id == BuiltIns.AllApplication.Id)
         {
             CommandViewModel vm = new CommandViewModel(c);
             vm.Initialize();
             LocalCache.AllCommandVMs.Add(vm);
         }
     });
     Cache.Roles.ForEach(r =>
     {
         if (r.Application_Id == ApplicationId || r.Application_Id == BuiltIns.AllApplication.Id)
         {
             RoleViewModel vm = new RoleViewModel(r);
             LocalCache.AllRoleVMs.Add(vm);
         }
     });
     Cache.RoleCommands.ForEach(rc =>
     {
         if (rc.Application_Id == ApplicationId || rc.Application_Id == BuiltIns.AllApplication.Id)
         {
             RoleCommandViewModel vm = new RoleCommandViewModel(rc);
             vm.Initialize();
             LocalCache.AllRoleCommandVMs.Add(vm);
         }
     });
     LocalCache.AllRoleVMs.ForEach(r =>
     {
         r.Initialize();
     });
     Cache.RoomRoles.ForEach(rr =>
     {
         RoomRoleViewModel vm = new RoomRoleViewModel(rr);
         vm.Initialize();
         LocalCache.AllRoomRoleVMs.Add(vm);
     });
     Cache.ExchangeRates.ForEach(er =>
     {
         ExchangeRateViewModel vm = new ExchangeRateViewModel(er);
         LocalCache.AllExchangeRateVMs.Add(vm);
     });
 }
コード例 #8
0
 public Action <SecureCommandArgs> GetCommandDelegate(CommandViewModel cmd)
 {
     return(null);
 }
コード例 #9
0
 public Action<SecureCommandArgs> GetCommandDelegate(CommandViewModel cmd)
 {
     return null;
 }
コード例 #10
0
		private void BuildCache()
		{
			Cache.Images.ForEach(img =>
			{
                AddImage(img);
			});
			Cache.GiftGroups.ForEach(g =>
			{
				GiftGroupViewModel giftGroupVM = new GiftGroupViewModel(g);
				LocalCache.AllGiftGroupVMs.Add(giftGroupVM);
			});
			Cache.Gifts.ForEach(g =>
			{
				GiftViewModel giftVM = new GiftViewModel(g);
				giftVM.Initialize();
				LocalCache.AllGiftVMs.Add(giftVM);
			});
			LocalCache.AllGiftGroupVMs.ForEach(g =>
			{
				g.Initialize();
			});
			Cache.RoomGroups.ForEach(rg =>
			{
				RoomGroupViewModel roomGroupVM = new RoomGroupViewModel(rg);
				LocalCache.AllRoomGroupVMs.Add(roomGroupVM);
			});
			//Create all the RoomViewModels so that we can initialize the RoomVMs of RoomGroupVM
			Cache.Rooms.ForEach(r =>
			{
				RoomViewModel roomVM = new RoomViewModel(r);
				roomVM.Initialize();
				LocalCache.AllRoomVMs.Add(roomVM);
			});
			LocalCache.AllRoomGroupVMs.ForEach(rgv =>
			{
				rgv.Initialize();
			});
			Cache.Commands.ForEach(c =>
			{
				if (c.Application_Id == ApplicationId || c.Application_Id == BuiltIns.AllApplication.Id)
				{
					CommandViewModel vm = new CommandViewModel(c);
					vm.Initialize();
					LocalCache.AllCommandVMs.Add(vm);
				}
			});
			Cache.Roles.ForEach(r =>
			{
				if (r.Application_Id == ApplicationId || r.Application_Id == BuiltIns.AllApplication.Id)
				{
					RoleViewModel vm = new RoleViewModel(r);
					LocalCache.AllRoleVMs.Add(vm);
				}
			});
			Cache.RoleCommands.ForEach(rc =>
			{
				if (rc.Application_Id == ApplicationId || rc.Application_Id == BuiltIns.AllApplication.Id)
				{
					RoleCommandViewModel vm = new RoleCommandViewModel(rc);
					vm.Initialize();
					LocalCache.AllRoleCommandVMs.Add(vm);
				}
			});
			LocalCache.AllRoleVMs.ForEach(r =>
			{
				r.Initialize();
			});
			Cache.RoomRoles.ForEach(rr =>
			{
				RoomRoleViewModel vm = new RoomRoleViewModel(rr);
                vm.Initialize();
				LocalCache.AllRoomRoleVMs.Add(vm);
			});
            Cache.ExchangeRates.ForEach(er =>
                {
                    ExchangeRateViewModel vm = new ExchangeRateViewModel(er);
                    LocalCache.AllExchangeRateVMs.Add(vm);
                });

		}