public SettingsWindowViewModel(
            IDispatcherMessenger messenger,
            SaveSettingsCommand saveCommand,
            CloseWindowCommand cancelCommand)
        {
            if (messenger == null) throw new ArgumentNullException("messenger");
            if (saveCommand == null) throw new ArgumentNullException("saveCommand");
            if (cancelCommand == null) throw new ArgumentNullException("cancelCommand");
            SaveCommand = saveCommand;
            CloseCommand = cancelCommand;

            messenger.Register<ConfigSavedEvent>(this, _ => Close = true);
        }
        public GuardUnsavedChangesService(
            IDispatcherMessenger messenger,
            ICurrentMixProvider mixProvider,
            SaveMixAsCommand saveAsCommand)
        {
            if (mixProvider == null)
            {
                throw new ArgumentNullException("mixProvider");
            }

            if (saveAsCommand == null)
            {
                throw new ArgumentNullException("saveAsCommand");
            }

            this.messenger = messenger;
            this.mixProvider = mixProvider;
            this.saveAsCommand = saveAsCommand;

            messenger.Register<MixLoadedEvent>(this, OnMixLoaded);
            messenger.Register<MixDirtyEvent>(this, OnMixDirty);
            messenger.Register<MixSavedEvent>(this, OnMixSaved);
        }
Ejemplo n.º 3
0
 public ConfigProvider(
     string filename,
     IDispatcherMessenger messenger,
     IConfigReader reader,
     IConfigWriter writer)
 {
     if (filename == null) throw new ArgumentNullException("filename");
     if (messenger == null) throw new ArgumentNullException("messenger");
     if (reader == null) throw new ArgumentNullException("reader");
     if (writer == null) throw new ArgumentNullException("writer");
     messenger.Register<ConfigSavedEvent>(this, e => Config = e.Config);
     this.filename = filename;
     this.messenger = messenger;
     this.reader = reader;
     this.writer = writer;
 }