public RoomWindowContent(RoomWindowViewModel vm) { InitializeComponent(); roomWindowVM = vm; DataContext = roomWindowVM; Loaded += RoomWindowContent_Loaded; }
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; }
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; }
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; }
public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action <SecureCommandArgs> execute) : this(cmd, owner, execute, null) { }
public RoomWindow(RoomWindowViewModel roomWindowVM):this(roomWindowVM,null) { }
public CommandViewModel(Command cmd, RoomWindowViewModel owner, Action<SecureCommandArgs> execute) : this(cmd, owner, execute, null) { }