protected DesignerViewModelBase(IMessageBoxService messageBoxService, IDirtyService dirtyService = null, ISelectionService selectionService = null) { _selectionService = selectionService ?? ApplicationContainer.Container.Resolve <ISelectionService>(); _dirtyService = dirtyService ?? new DirtyService(); MessageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService)); InitiateCommands(); }
public MainViewModel(IFileDialogService fileDialogService, IMessageBoxService messageBoxService, IDirtyService dirtyService, IViewService viewService, ILifetimeScope lifetimeScope) { if (fileDialogService == null) throw new ArgumentNullException(nameof(fileDialogService)); if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService)); if (dirtyService == null) throw new ArgumentNullException(nameof(dirtyService)); if (viewService == null) throw new ArgumentNullException(nameof(viewService)); if (lifetimeScope == null) throw new ArgumentNullException(nameof(lifetimeScope)); _fileDialogService = fileDialogService; _messageBoxService = messageBoxService; _dirtyService = dirtyService; _viewService = viewService; _lifetimeScope = lifetimeScope; dirtyService.PropertyChanged += DirtyService_PropertyChanged; NewCommand = new RelayCommand(New); OpenCommand = new RelayCommand(Open); SaveCommand = new RelayCommand(() => Save(), CanSave); SaveAsComand = new RelayCommand(() => SaveAs()); ExitCommand = new RelayCommand(Exit); AboutCommand = new RelayCommand(About); }
public StateMachineViewModel( StateMachine model, IViewService viewService, IUndoProvider undoProvider, IDirtyService dirtyService, IMessageBoxService messageBoxService, bool isReadOnly = false ) : base(messageBoxService) { _model = model ?? throw new ArgumentNullException(nameof(model)); _viewService = viewService ?? throw new ArgumentNullException(nameof(viewService)); _undoProvider = undoProvider; _dirtyService = dirtyService; _isReadOnly = isReadOnly; InitiateModel(); }
public MainViewModel(IViewService viewService, IPersistor persistor, IDirtyService dirtyService, IMessageBoxService messageBoxService) { _viewService = viewService; _persistor = persistor; _dirtyService = dirtyService; _messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService)); SaveCommand = new RelayCommand(() => Save(), CanSave); SaveAsCommand = new RelayCommand(() => SaveAs()); OpenCommand = new RelayCommand(Open); NewCommand = new RelayCommand(New); EditCommand = new RelayCommand <StateMachineReferenceViewModel>(Edit); AboutCommand = new RelayCommand(About); _dirtyService.PropertyChanged += DirtyService_PropertyChanged; New(); MessengerInstance.Register <SaveMessage>(this, Save); }
public StateMachineDialogWindowViewModel( StateMachine stateMachine, IViewService viewService, IDirtyService parentDirtyService, Action <StateMachine> updateParentModel, IMessageBoxService messageBoxService ) { _viewService = viewService ?? throw new ArgumentNullException(nameof(viewService)); _parentDirtyService = parentDirtyService ?? throw new ArgumentNullException(nameof(parentDirtyService)); _updateParentModel = updateParentModel; _messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService)); InitiateStateMachineViewModel(stateMachine); _undoService = new UndoService <StateMachine>(); _undoService.Clear(SaveMomento()); DirtyService.MarkClean(); InitializeCommands(); }
public MainViewModel(IFileDialogService fileDialogService, IMessageBoxService messageBoxService, IDirtyService dirtyService, IViewService viewService, ILifetimeScope lifetimeScope) { if (fileDialogService == null) { throw new ArgumentNullException(nameof(fileDialogService)); } if (messageBoxService == null) { throw new ArgumentNullException(nameof(messageBoxService)); } if (dirtyService == null) { throw new ArgumentNullException(nameof(dirtyService)); } if (viewService == null) { throw new ArgumentNullException(nameof(viewService)); } if (lifetimeScope == null) { throw new ArgumentNullException(nameof(lifetimeScope)); } _fileDialogService = fileDialogService; _messageBoxService = messageBoxService; _dirtyService = dirtyService; _viewService = viewService; _lifetimeScope = lifetimeScope; dirtyService.PropertyChanged += DirtyService_PropertyChanged; NewCommand = new RelayCommand(New); OpenCommand = new RelayCommand(Open); SaveCommand = new RelayCommand(() => Save(), CanSave); SaveAsComand = new RelayCommand(() => SaveAs()); ExitCommand = new RelayCommand(Exit); AboutCommand = new RelayCommand(About); }