public EntityTrayViewModel()
 {
     ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(ProjectOpened);
     ChangeToolCommand = new RelayCommand(UpdateTool);
     _horizSnapAmount = 8;
     _vertSnapAmount = 8;
 }
        public MainWindowViewModel(IProjectDocumentFactory projectFactory, IDialogService dialogService, IDataAccessService dataService)
        {
            _projectFactory = projectFactory;
            _dialogService = dialogService;
            _dataService = dataService;

            ProjectViewModel = new ProjectViewModel();

            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(this.ProjectOpened);
            ViewModelMediator.Current.GetEvent<TestLocationSelectedEventArgs>().Subscribe(this.TestLocationSelected);

            AppData = StoredAppData.Load();

            var attr = this.GetType().Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute)).Single() as AssemblyProductAttribute;
            ApplicationName = attr.Product;
            WindowTitle = attr.Product;

            OpenProjectCommand = new RelayCommand(OpenProjectDialog, null);
            OpenRecentCommand = new RelayCommand(OpenRecentProject, null);
            SaveProjectCommand = new RelayCommand(x => SaveProject(), o => _openProject != null);
            CloseProjectCommand = new RelayCommand(CloseProject, o => _openProject != null);
            TestCommand = new RelayCommand(TestProject, o => _openProject != null);
            TestStageCommand = new RelayCommand(TestStage, o => _openProject != null);
            TestLocationCommand = new RelayCommand(TestLocation, o => _openProject != null);
            UndoCommand = new RelayCommand(Undo, p => ProjectViewModel.CurrentStage != null);
            RedoCommand = new RelayCommand(Redo, p => ProjectViewModel.CurrentStage != null);
            EnginePathCommand = new RelayCommand(ChangeEnginePath);
            NewEntityCommand = new RelayCommand(NewEntity);
            UpdateLayerVisibilityCommand = new RelayCommand(UpdateLayerVisibility);

            ShowBackstage = true;
        }
        public TilesToolbarViewModel()
        {
            ViewModelMediator.Current.GetEvent<TileBrushSelectedEventArgs>().Subscribe((s, e) => ChangeBrush(e.TileBrush));
            ChangeToolCommand = new RelayCommand(ChangeTool);

            ChangeTool("Brush");
        }
        public LayoutEditingViewModel()
        {
            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);

            AddScreenCommand = new RelayCommand(p => AddScreen(), p => HasStage());

            ChangeToolCommand = new RelayCommand(ChangeTool, p => HasStage());
        }
Esempio n. 5
0
        public TilesetViewModel()
        {
            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);
            ViewModelMediator.Current.GetEvent<TileSelectedEventArgs>().Subscribe((s, e) => ChangeTile(e.Tile));

            ChangeToolCommand = new RelayCommand(ChangeTool, p => HasStage());
            ChangeTool("Brush");
        }
        public TileBrushControlViewModel()
        {
            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);
            ViewModelMediator.Current.GetEvent<SelectionChangedEventArgs>().Subscribe(SelectionChanged);

            AddTileBrushCommand = new RelayCommand(AddTileBrush, o => _tileset != null);
            CreateBrushSelectionCommand = new RelayCommand(CreateSelectionBrush, o => _selection != null);
        }
        public ProjectSettingsViewModel(ProjectDocument project)
        {
            SetProject(project);
            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe((s, e) => SetProject(e.Project));

            AddIncludeFolderCommand = new RelayCommand(AddIncludeFolder, o => _project != null);
            AddIncludeFileCommand = new RelayCommand(AddIncludeFile, o => _project != null);
            RemoveIncludeCommand = new RelayCommand(RemoveInclude, o => SelectedFile != null);
        }
        public LayoutEditingViewModel()
        {
            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);
            ViewModelMediator.Current.GetEvent<TestLocationClickedEventArgs>().Subscribe((s,e) => TestFromLocation());

            AddScreenCommand = new RelayCommand(p => AddScreen(), p => HasStage());
            ImportScreenCommand = new RelayCommand(p => ImportScreen(), p => HasStage());
            ChangeToolCommand = new RelayCommand(ChangeTool, p => HasStage());
        }
        public NewProjectViewModel(IProjectDocumentFactory projectFactory, IDataAccessService dataService)
        {
            _projectFactory = projectFactory;
            _dataService = dataService;

            CreateCommand = new RelayCommand(Create);

            Name = GetDefaultProjectName();
            Author = GetMostRecentAuthor();
            DirectoryPath = GetMostRecentDirectory();
            CreateProjectDirectory = true;
        }
Esempio n. 10
0
        public AddStageViewModel(ITilesetDocumentFactory tilesetFactory)
        {
            _tilesetFactory = tilesetFactory;

            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(ProjectChanged);

            AddStageCommand = new RelayCommand(AddStage);
            BrowseTilesetCommand = new RelayCommand(BrowseTileset);
            BrowseTilesheetCommand = new RelayCommand(BrowseTilesheet);

            CreateTileset = true;
        }
Esempio n. 11
0
        public TilesetEditorViewModel()
        {
            ChangeSheetCommand = new RelayCommand(o => ChangeSheet());
            AddTileCommand = new RelayCommand(o => AddTile());
            DeleteTileCommand = new RelayCommand(o => DeleteTile());
            AddTilePropertiesCommand = new RelayCommand(o => AddProperties());
            EditTilePropertiesCommand = new RelayCommand(EditProperties);
            DeleteTilePropertiesCommand = new RelayCommand(DeleteProperties);
            HidePropertiesEditorCommand = new RelayCommand(o => HidePropertiesEditor());

            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);
            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(ProjectOpened);

            ShowSpriteEditor = System.Windows.Visibility.Visible;
            ShowPropEditor = System.Windows.Visibility.Collapsed;
        }
        public StagePropertiesViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
                return;

            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(ProjectOpened);
            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageChanged);

            PlayCommand = new RelayCommand(Play, o => bgm != null && (!AudioManager.Instance.IsBGMPlaying || AudioManager.Instance.Paused));
            PauseCommand = new RelayCommand(Pause, o => AudioManager.Instance.IsBGMPlaying);
            StopCommand = new RelayCommand(Stop, o => (AudioManager.Instance.IsBGMPlaying || AudioManager.Instance.Paused));

            AudioManager.Instance.Initialize();
            AudioManager.Instance.Stereo = true;

            Track = 1;
        }
Esempio n. 13
0
        public MainWindowViewModel(IProjectDocumentFactory projectFactory)
        {
            _projectFactory = projectFactory;

            ProjectViewModel = new ProjectViewModel();

            ViewModelMediator.Current.GetEvent<ProjectOpenedEventArgs>().Subscribe(this.ProjectOpened);

            AppData = StoredAppData.Load();

            var attr = this.GetType().Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute)).Single() as AssemblyProductAttribute;
            ApplicationName = attr.Product;
            WindowTitle = attr.Product;

            TestCommand = new RelayCommand(TestProject, o => _openProject != null);
            TestStageCommand = new RelayCommand(TestStage, o => _openProject != null);
            TestLocationCommand = new RelayCommand(TestLocation, o => _openProject != null);
            UndoCommand = new RelayCommand(Undo, p => ProjectViewModel.CurrentStage != null);
            RedoCommand = new RelayCommand(Redo, p => ProjectViewModel.CurrentStage != null);
        }
Esempio n. 14
0
        public SpriteEditorViewModel(Sprite sprite)
        {
            if (sprite == null)
                throw new ArgumentNullException("sprite");

            _sprite = sprite;

            ((App)App.Current).Tick += Update;

            ZoomInCommand = new RelayCommand(ZoomIn, CanZoomIn);
            ZoomOutCommand = new RelayCommand(ZoomOut, CanZoomOut);
            ZoomInSheetCommand = new RelayCommand(ZoomInSheet, CanZoomInSheet);
            ZoomOutSheetCommand = new RelayCommand(ZoomOutSheet, CanZoomOutSheet);
            PlayCommand = new RelayCommand(p => PlayPreview(), p => !Sprite.Playing);
            PauseCommand = new RelayCommand(p => PausePreview(), p => Sprite.Playing);
            PreviousFrameCommand = new RelayCommand(p => PreviousFrame(), p => !Sprite.Playing);
            NextFrameCommand = new RelayCommand(p => NextFrame(), p => !Sprite.Playing);
            AddFrameCommand = new RelayCommand(p => AddFrame(), p => !Sprite.Playing);
            DeleteFrameCommand = new RelayCommand(p => DeleteFrame(), p => !Sprite.Playing && Sprite.Count > 1);
        }
Esempio n. 15
0
        public MainWindow()
        {
            _viewModel = App.Container.Get<MainWindowViewModel>();
            this.DataContext = _viewModel;

            UseLayoutRounding = true;

            InitializeComponent();

            projectTree.Update(_viewModel.ProjectViewModel);

            OpenRecentCommand = new RelayCommand(OpenRecentProject, null);
            OpenProjectSettingsCommand = new RelayCommand(OpenProjectSettings, p => IsProjectOpen());
            AddStageCommand = new RelayCommand(AddStage, p => IsProjectOpen());
            EditTilesetCommand = new RelayCommand(EditTileset, p => IsStageOpen());
            EditStageCommand = new RelayCommand(EditStage, p => IsStageOpen());
            StagePropertiesCommand = new RelayCommand(ShowStageProperties, p => IsStageOpen());

            ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Subscribe(StageSelected);

            this.Closing += MainWindow_Closing;
        }
        public EntityPlacementControlViewModel(EntityPlacement placement, EntityInfo entityInfo, ScreenDocument screen)
        {
            if (placement == null)
                throw new ArgumentNullException("placement");

            if (entityInfo == null)
                throw new ArgumentNullException("entityInfo");

            if (screen == null)
                throw new ArgumentNullException("screen");

            this.Placement = placement;
            this._entityInfo = entityInfo;
            this._screen = screen;

            DeleteCommand = new RelayCommand(Delete);
            FlipCommand = new RelayCommand(Flip);
            RespawnCommand = new RelayCommand(SetRespawnMode);
            StartStateCommand = new RelayCommand(SetStartState);

            ViewModelMediator.Current.GetEvent<ZoomChangedEventArgs>().Subscribe(ZoomChanged);
        }
 public EditableLabel()
 {
     InitializeComponent();
     (this.Content as FrameworkElement).DataContext = this;
     SwapCommand = new RelayCommand(Swap);
 }