public void Run() { while (true) { string line = this.userInterface.ReadLine(); if (string.IsNullOrWhiteSpace(line)) { break; } line = line.Trim(); try { this.Command = new Command(line); this.airConditioner.ExecuteCommands(); } catch (InvalidOperationException ex) { this.userInterface.WriteLine(ex.Message); } } }
public virtual void Apply(Command command) { AggregateInfo aggregateInfo; try { aggregateInfo = applyTo(command).Single(); } catch (InvalidOperationException e) { throw new InvalidOperationException("A command must apply to a single aggregate instance", e); } //If it's not tracked, then select it from the domain. if (aggregateInfo.Lifestate == AggregateLifestate.Untracked) selectAggregate(aggregateInfo); try { //If we haven't found it in the domain, then create it, otherwise apply the command. if (aggregateInfo.Lifestate == AggregateLifestate.Untracked) AggregateFactory.Create(aggregateInfo, command); else aggregateInfo.Instance.AsDynamic().Apply(command); } catch (ApplicationException e) { if (e.Source == "ReflectionMagic") throw new MissingMethodException( aggregateInfo.Type.FullName, string.Format( "{0}({1})", aggregateInfo.Lifestate == AggregateLifestate.Untracked ? "_ctor" : "Accept", command.GetType())); throw; } }
public Shutdown(Command command) { this.command = command; simpleJobBuilder = command.SimpleJobBuilder; }
public UtorrentCommandTask(Command command, string json) { utorrentCommand = JsonConvert.DeserializeObject<UtorrentCommand>(json); this.command = command; }
public RefreshUtorrent(Command command) { this.command = command; }
public PlexConnect(Command command) { this.command = command; }
public PlexHomeTheatre(Command command) { this.command = command; }
public SickBeardCommand(Command command) { this.command = command; }
public Plex(Command command) { this.command = command; }
public Abort(Command command) { this.command = command; simpleJobBuilder = command.SimpleJobBuilder; }
public Utorrent(Command command) { this.command = command; }