private void ReceiveScriptBrickCollectionMessageAction(GenericMessage<List<Object>> message) { _actionsCollection = message.Content[0] as ActionsCollection; _firstVisibleScriptBrickIndex = ((PortableListBoxViewPort)message.Content[1]).FirstVisibleIndex; _lastVisibleScriptBrickIndex = ((PortableListBoxViewPort)message.Content[1]).LastVisibleIndex; }
public SpriteEditorViewModel() { SelectedActions = new ObservableCollection<ModelBase>(); SelectedActions.CollectionChanged += SelectedActionsOnCollectionChanged; SelectedLooks = new ObservableCollection<Look>(); SelectedLooks.CollectionChanged += SelectedLooksOnCollectionChanged; SelectedSounds = new ObservableCollection<Sound>(); SelectedSounds.CollectionChanged += SelectedSoundsOnCollectionChanged; RenameSpriteCommand = new RelayCommand(RenameSpriteAction); AddBroadcastMessageCommand = new RelayCommand<ModelBase>(AddBroadcastMessageAction); AddNewScriptBrickCommand = new RelayCommand(AddNewScriptBrickAction); CopyScriptBrickCommand = new RelayCommand(CopyScriptBrickAction, CanExecuteCopyActionCommand); DeleteScriptBrickCommand = new RelayCommand(DeleteScriptBrickAction, CanExecuteDeleteActionCommand); AddNewLookCommand = new RelayCommand(AddNewLookAction); EditLookCommand = new RelayCommand<Look>(EditLookAction); CopyLookCommand = new RelayCommand(CopyLookAction, CanExecuteCopyLookCommand); DeleteLookCommand = new RelayCommand(DeleteLookAction, CanExecuteDeleteLookCommand); AddNewSoundCommand = new RelayCommand(AddNewSoundAction); EditSoundCommand = new RelayCommand<Sound>(EditSoundAction); DeleteSoundCommand = new RelayCommand(DeleteSoundAction, CanExecuteDeleteSoundCommand); CopySoundCommand = new RelayCommand(CopySoundAction, () => false); StartPlayerCommand = new RelayCommand(StartPlayerAction); GoToMainViewCommand = new RelayCommand(GoToMainViewAction); ProgramSettingsCommand = new RelayCommand(ProgramSettingsAction); UndoCommand = new RelayCommand(UndoAction); RedoCommand = new RelayCommand(RedoAction); ClearObjectsSelectionCommand = new RelayCommand(ClearObjectSelectionAction); ClearScriptsSelectionCommand = new RelayCommand(ClearScriptsSelectionAction); ClearLooksSelectionCommand = new RelayCommand(ClearLooksSelectionAction); ClearSoundsSelectionCommand = new RelayCommand(ClearSoundsSelectionAction); NothingItemHackCommand = new RelayCommand<object>(NothingItemHackAction); _bricks = new ActionsCollection(); Messenger.Default.Register<GenericMessage<Program>>(this, ViewModelMessagingToken.CurrentProgramChangedListener, CurrentProgramChangedMessageAction); Messenger.Default.Register<GenericMessage<Sprite>>(this, ViewModelMessagingToken.CurrentSpriteChangedListener, CurrentSpriteChangedMessageAction); Messenger.Default.Register<GenericMessage<BroadcastMessage>>(this, ViewModelMessagingToken.BroadcastMessageListener, ReceiveNewBroadcastMessageAction); Messenger.Default.Register<GenericMessage<ModelBase>>(this, ViewModelMessagingToken.SelectedBrickListener, ReceiveSelectedBrickMessageAction); }