protected ViewModelBase(IScarletCommandBuilder commandBuilder) : base((commandBuilder?.Messenger) !) { CommandBuilder = commandBuilder ?? throw new ArgumentNullException(nameof(commandBuilder)); Dispatcher = commandBuilder.Dispatcher ?? throw new ArgumentNullException(nameof(IScarletCommandBuilder.Dispatcher)); CommandManager = commandBuilder.CommandManager ?? throw new ArgumentNullException(nameof(IScarletCommandBuilder.CommandManager)); Exit = commandBuilder.Exit ?? throw new ArgumentNullException(nameof(IScarletCommandBuilder.Exit)); WeakEventManager = commandBuilder.WeakEventManager ?? throw new ArgumentNullException(nameof(IScarletCommandBuilder.WeakEventManager)); BusyStack = new ObservableBusyStack((hasItems) => IsBusy = hasItems); }
public static IScarletCommandBuilder GetTestCommandBuilder(IScarletDispatcher dispatcher = null, IScarletCommandManager commandManager = null, IScarletExceptionHandler exceptionHandler = null, IMessenger messenger = null, IExitService exitService = null, IScarletEventManager <INotifyPropertyChanged, PropertyChangedEventArgs> eventManager = null, Func <Action <bool>, IBusyStack> busyStackFactory = null) { return(new ScarletCommandBuilder(dispatcher ?? GetTestDispatcher(), commandManager ?? GetTestCommandManager(), exceptionHandler ?? GetTestExceptionHandler(), messenger ?? GetTestMessenger(), exitService ?? GetTestExitService(), eventManager ?? GetTestEventManager(), busyStackFactory ?? GetTestBusyStackFactory())); }