public RoomWindowContent(RoomWindowViewModel vm)
 {
     InitializeComponent();
     roomWindowVM = vm;
     DataContext = roomWindowVM;
     Loaded += RoomWindowContent_Loaded;
 }
Пример #2
0
        private bool CanSecureCommandExecute(SecureCommandArgs args)
        {
            if (canExecute == null || canExecute.Invoke(args))
            {
                RoomWindowViewModel roomWindowVM = args.CommandOwner as RoomWindowViewModel;

                if (Me != null && roomWindowVM != null)
                {
                    int targetRoleId = roomWindowVM.SelectedUserVM == null ? BuiltIns.AllRole.Id : roomWindowVM.SelectedUserVM.RoleVM.Id;

                    switch (CommandType)
                    {
                    case BuiltIns.FrontendCommandType:
                    case BuiltIns.UserCommandType:
                        if (roomWindowVM.SelectedUserVM != null)
                        {
                            return(Me.HasCommand(roomWindowVM.RoomVM.Id, Id, targetRoleId));
                        }
                        break;

                    case BuiltIns.BackendCommandType:
                        return(false);

                    case BuiltIns.NormalCommandType:
                        return(true);
                    }
                }
            }
            return(false);
        }
 public RoomWindow(RoomWindowViewModel roomWindowVM, HallWindow hwnd)
     :base(roomWindowVM)
 {
     roomWindowVM.Load(AllWebPages.RoomPage);
     roomWindowVM.Initialize();
     this.roomWindowVM = roomWindowVM;
     InitializeComponent();
     Loaded += RoomWindow_Loaded;
     hallWindow = hwnd;
     if(hallWindow != null)
         hallWindow.StateChanged += hallWindow_StateChanged;
 }
Пример #4
0
 public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action<SecureCommandArgs> execute, Func<SecureCommandArgs, bool> canExecute)
     : base(cmd)
 {
     if (cmd != null)
     {
         name.SetValue(cmd.Name);
         description.SetValue(cmd.Description);
         money.SetValue(cmd.Money.HasValue ? cmd.Money.Value : 0);
         commandType.SetValue(cmd.CommandType);
         SecureCommand = new SecureCommand(SecureCommandExecute, CanSecureCommandExecute) { Owner = owner };
     }
     this.execute = execute;
     this.canExecute = canExecute;
 }
Пример #5
0
 public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action <SecureCommandArgs> execute, Func <SecureCommandArgs, bool> canExecute)
     : base(cmd)
 {
     if (cmd != null)
     {
         name.SetValue(cmd.Name);
         description.SetValue(cmd.Description);
         money.SetValue(cmd.Money.HasValue ? cmd.Money.Value : 0);
         commandType.SetValue(cmd.CommandType);
         SecureCommand = new SecureCommand(SecureCommandExecute, CanSecureCommandExecute)
         {
             Owner = owner
         };
     }
     this.execute    = execute;
     this.canExecute = canExecute;
 }
Пример #6
0
 public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action <SecureCommandArgs> execute)
     : this(cmd, owner, execute, null)
 {
 }
Пример #7
0
 public RoomWindow(RoomWindowViewModel roomWindowVM):this(roomWindowVM,null)
 {
 }
Пример #8
0
 public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action<SecureCommandArgs> execute)
     : this(cmd, owner, execute, null)
 {
 }