public WorldController(IWorldView view, IControllerFactory controllerFactory, IMessageBus messageBus, IConfigFile <Config> configFile, IFileSystem fileSystem) : base(view) { messageBus.ThrowIfNull(nameof(messageBus)); _controllerFactory = controllerFactory.EnsureNotNull(nameof(controllerFactory)); _configFile = configFile.EnsureNotNull(nameof(configFile)); _fileSystem = fileSystem.EnsureNotNull(nameof(fileSystem)); AddDisposables( messageBus.GetObservable <WorldChangedMessage>().Subscribe(ReceiveMessage), View.FileCloseWorldRequested.Subscribe(x => CloseWorld()), View.FileExitRequested.Subscribe(x => Exit()), View.FileNewWorldRequested.Subscribe(x => NewWorld()), View.FileOpenWorldRequested.Subscribe(x => OpenWorld()), View.FileSaveWorldAsRequested.Subscribe(x => SaveWorldAs()), View.FileSaveWorldRequested.Subscribe(x => SaveWorld()), View.HelpAboutRequested.Subscribe(x => About()), View.ToolsOptionsRequested.Subscribe(x => Options()), View.ViewClosing.Subscribe(x => x.Cancel = !ViewClosing(x.CloseReason == CloseReason.UserClosing)), View.WorldVariablesRequested.Subscribe(x => Variables())); View.RestoreBounds(_configFile.Config.Views.World.Bounds); View.SetTitle(ViewTitle); View.HideWorldToolStrips(); View.DisableCloseWorldToolStripItems(); View.DisableSaveWorldToolStripItems(); View.DisableSaveWorldAsToolStripItems(); }
public WorldVariableController(IWorldVariableView view, IConfigFile <Config> configFile) : base(view) { _configFile = configFile.EnsureNotNull(nameof(configFile)); AddDisposables(View.ViewClosing.Subscribe(x => ViewClosing())); View.RestoreBounds(_configFile.Config.Views.WorldVariable.Bounds); }
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())); }
public WorldVariablesController(IWorldVariablesView view, IControllerFactory controllerFactory, IMessageBus messageBus, IConfigFile <Config> configFile) : base(view) { _controllerFactory = controllerFactory.EnsureNotNull(nameof(controllerFactory)); _messageBus = messageBus.EnsureNotNull(nameof(messageBus)); _configFile = configFile.EnsureNotNull(nameof(configFile)); AddDisposables( View.NewRequested.Subscribe(x => NewRequested()), View.EditRequested.Subscribe(EditRequested), View.DeleteRequested.Subscribe(DeleteRequested)); View.RestoreBounds(configFile.Config.Views.WorldVariables.Bounds, false); View.RestoreVariablesListColumnWidths(configFile.Config.Views.WorldVariables.ColumnWidths); }