Пример #1
0
        public DialogResult ShowView(IWin32Window owner, NewWorldViewModel viewModel)
        {
            owner.ThrowIfNull(nameof(owner));
            _viewModel = viewModel.EnsureNotNull(nameof(viewModel));

            return(ShowDialog(owner));
        }
        public NewWorldController(INewWorldView view, IConfigFile <Config> configFile, IGuidFactory guidFactory, ISystemClock systemClock)
            : base(view)
        {
            _configFile  = configFile.EnsureNotNull(nameof(configFile));
            _guidFactory = guidFactory.EnsureNotNull(nameof(guidFactory));
            _systemClock = systemClock.EnsureNotNull(nameof(systemClock));
            _viewModel   = new NewWorldViewModel
            {
                Author   = _configFile.Config.Views.NewWorld.DefaultAuthor,
                IdAsGuid = _guidFactory.Random(),
                Version  = "1.0"
            };

            AddDisposables(View.IdGenerationRequested.Subscribe(x => _viewModel.IdAsGuid = _guidFactory.Random()));
        }