public virtual void HandleConfigure(ConfigureServer e) { m_messages = e.Messages; m_safetyMonitor = e.SafetyMonitor; m_livenessMonitor = e.LivenessMonitor; Self.Established(); }
private async Task ProcessConfigureServer(ConfigureServer configureServer) { if (this.Log().IsEnabled(LogLevel.Debug)) { this.Log().LogDebug($"Base project path: {configureServer.ProjectPath}"); this.Log().LogDebug($"Xaml Search Paths: {string.Join(", ", configureServer.XamlPaths)}"); } _watchers = configureServer.XamlPaths .Select(p => new FileSystemWatcher { Path = p, Filter = "*.xaml", NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Attributes | NotifyFilters.Size | NotifyFilters.CreationTime | NotifyFilters.FileName, EnableRaisingEvents = true, IncludeSubdirectories = false }) .ToArray(); foreach (var watcher in _watchers) { watcher.Changed += OnXamlFileChanged; } }
private async Task ProcessConfigureServer(ConfigureServer configureServer) { if (this.Log().IsEnabled(LogLevel.Debug)) { this.Log().LogDebug($"Base project path: {configureServer.ProjectPath}"); this.Log().LogDebug($"Xaml Search Paths: {string.Join(", ", configureServer.XamlPaths)}"); } _watchers = configureServer.XamlPaths .Select(p => new FileSystemWatcher { Path = p, Filter = "*.*", NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Attributes | NotifyFilters.Size | NotifyFilters.CreationTime | NotifyFilters.FileName, EnableRaisingEvents = true, IncludeSubdirectories = false }) .ToArray(); _watcherEventsDisposable = new CompositeDisposable(); foreach (var watcher in _watchers) { // Create an observable instead of using the FromEventPattern which // does not register to events properly. // Renames are required for the WriteTemporary->DeleteOriginal->RenameToOriginal that // Visual Studio uses to save files. var changes = Observable.Create <string>(o => { void changed(object s, FileSystemEventArgs args) => o.OnNext(args.FullPath); void renamed(object s, RenamedEventArgs args) => o.OnNext(args.FullPath); watcher.Changed += changed; watcher.Created += changed; watcher.Renamed += renamed; return(Disposable.Create(() => { watcher.Changed -= changed; watcher.Created -= changed; watcher.Renamed -= renamed; })); }); var disposable = changes .Buffer(TimeSpan.FromMilliseconds(250)) .Subscribe(filePaths => { foreach (var file in filePaths.Distinct().Where(f => Path.GetExtension(f).Equals(".xaml", StringComparison.OrdinalIgnoreCase))) { OnXamlFileChanged(file); } }, e => Console.WriteLine($"Error {e}")); _watcherEventsDisposable.Add(disposable); } }
public void HandleConfigure(ConfigureServer e) { Receiver.HandleConfigure(e); MachineHandledLog(nameof(HandleConfigure)); }
public void Configure(ConfigureServer e) { RuntimeHost.SendEvent(Id, e); }