public ServerRCON(Server server) { this.runtimeChangedNotifier = new PropertyChangeNotifier(server.Runtime, ServerRuntime.ProfileSnapshotProperty, (s, d) => { var oldSnapshot = this.snapshot; if (d == null || d.NewValue == null) { return; } var newSnapshot = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue; this.snapshot = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue; bool reinitLoggers = !String.Equals(this.snapshot.ProfileName, newSnapshot.ProfileName); if (reinitLoggers) { ReinitializeLoggers(); } }); this.commandProcessor = new ActionQueue(TaskScheduler.Default); // This is on the UI thread so we can do things like update dependency properties and whatnot. this.outputProcessor = new ActionQueue(TaskScheduler.FromCurrentSynchronizationContext()); this.Players = new SortableObservableCollection <PlayerInfo>(); this.snapshot = server.Runtime.ProfileSnapshot; ReinitializeLoggers(); commandProcessor.PostAction(AutoPlayerList); commandProcessor.PostAction(AutoGetChat); }
public ServerRCON(Server server) { this.runtimeChangedNotifier = new PropertyChangeNotifier(server.Runtime, ServerRuntime.ProfileSnapshotProperty, (s, d) => { this.snapshot = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue; commandProcessor.PostAction(() => Reconnect()); }); this.commandProcessor = new ActionQueue(); // This is on the UI thread so we can do things like update dependency properties and whatnot. this.outputProcessor = new ActionBlock <ConsoleCommand>(new Func <ConsoleCommand, Task>(ProcessOutput), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1, TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext() }); this.Players = new SortableObservableCollection <PlayerInfo>(); }