public AnimationViewModel(IAssetRepo assetRepo,
                                  IRegionManager regionManager, IEventAggregator eventAggregator,
                                  IDialogCoordinator dialogService, IGameConfigSvc gameConfig)
        {
            //< add key = "assets:AssetLocation" value = "..\asset" />
            var assetLocation = ConfigurationManager.AppSettings["assets:AssetLocation"].ToString();

            _regionManager   = regionManager;
            _dialogService   = dialogService;
            _gameConfig      = gameConfig;
            _assetRepo       = assetRepo;
            _eventAggregator = eventAggregator;

            ConvertSettings = new ConvertSettings();

            _assetRepo.DeserializeAssets(assetLocation);

            Animations = new ListCollectionView(_assetRepo.Animation.Animations);
            Animations.MoveCurrentTo("");
            Animations.CurrentChanged += Animations_CurrentChanged;

            Videos = new ListCollectionView(_assetRepo.Animation.Videos);
            Videos.MoveCurrentTo("");
            Videos.CurrentChanged += Videos_CurrentChanged;;

            NavigateCommand = new DelegateCommand <string>(x =>
            {
                _regionManager.RequestNavigate(RegionNames.ContentRegion, x);
            });

            CloseAllPendingFileDropCommand = new DelegateCommand(async() =>
            {
                //cancelPending = true;

                await _dialogService.HideMetroDialogAsync(this, customDialog);

                // cancelPending = false;
            });

            SaveCommand = new DelegateCommand(async() =>
            {
                await SaveDroppedFileAsync();
            });

            _eventAggregator.GetEvent <CloseCustomDialogAnimsEvent>().Subscribe(x =>
            {
                CloseDialogs();
            });
        }
예제 #2
0
        public ConfigViewModel(IRegionManager regionManager,
                               IGameConfigSvc gameConfig)
        {
            _regionManager = regionManager;
            _gameConfig    = gameConfig;

            NavigateCommand = new DelegateCommand <string>(x =>
            {
                _regionManager.RequestNavigate(RegionNames.ContentRegion, x);
            });

            SaveConfigCommand = new DelegateCommand(() =>
            {
                if (_gameConfig != null)
                {
                    _gameConfig.SaveGameConfig(Config);
                }
            });

            _gameConfig.LoadGameConfig("config.yaml");

            Config = _gameConfig.Config;
        }