コード例 #1
0
        /// <summary>
        /// Creates an instance of <see cref="SpellsViewModel"/>
        /// </summary>
        public SpellsViewModel(Compendium compendium, SpellSearchService spellSearchService, SpellSearchInput spellSearchInput,
                               StringService stringService, DialogService dialogService, XMLImporter xmlImporter, XMLExporter xmlExporter, DocumentService documentService)
        {
            _compendium         = compendium;
            _spellSearchService = spellSearchService;
            _spellSearchInput   = spellSearchInput;
            _stringService      = stringService;
            _dialogService      = dialogService;
            _xmlImporter        = xmlImporter;
            _xmlExporter        = xmlExporter;
            _documentService    = documentService;

            _selectSpellCommand     = new RelayCommand(obj => true, obj => SelectSpell(obj as SpellListItemViewModel));
            _editSpellCommand       = new RelayCommand(obj => true, obj => EditSpell(obj as SpellViewModel));
            _exportSpellCommand     = new RelayCommand(obj => true, obj => ExportSpell(obj as SpellViewModel));
            _cancelEditSpellCommand = new RelayCommand(obj => true, obj => CancelEditSpell());
            _saveEditSpellCommand   = new RelayCommand(obj => HasUnsavedChanges, obj => SaveEditSpell());
            _resetFiltersCommand    = new RelayCommand(obj => true, obj => InitializeSearch());
            _addCommand             = new RelayCommand(obj => true, obj => Add());
            _copyCommand            = new RelayCommand(obj => _selectedSpell != null, obj => Copy());
            _deleteCommand          = new RelayCommand(obj => _selectedSpell != null, obj => Delete());
            _importCommand          = new RelayCommand(obj => true, obj => Import());
            _selectNextCommand      = new RelayCommand(obj => true, obj => SelectNext());
            _selectPreviousCommand  = new RelayCommand(obj => true, obj => SelectPrevious());

            InitializeSearch();
        }
コード例 #2
0
        /// <summary>
        /// Creates an instance of <see cref="SpellSearchViewModel"/>
        /// </summary>
        public SpellSearchViewModel(Compendium compendium, SpellSearchService spellSearchService, SpellSearchInput spellSearchInput,
                                    StringService stringService, DialogService dialogService)
        {
            _compendium         = compendium;
            _spellSearchService = spellSearchService;
            _spellSearchInput   = spellSearchInput;
            _stringService      = stringService;
            _dialogService      = dialogService;

            _selectSpellCommand  = new RelayCommand(obj => true, obj => SelectSpell(obj as SpellListItemViewModel));
            _resetFiltersCommand = new RelayCommand(obj => true, obj => InitializeSearch());
            _acceptCommand       = new RelayCommand(obj => true, obj => OnAccept());
            _rejectCommand       = new RelayCommand(obj => true, obj => OnReject());

            Search();
        }