internal void DetachProcess(JProcess process) { int id = process.Id; JDebugProcessReplEvaluator evaluator; if (_evaluators.TryGetValue(id, out evaluator)) { evaluator.AvailableScopesChanged -= new EventHandler<EventArgs>(evaluator_AvailableScopesChanged); evaluator.MultipleScopeSupportChanged -= new EventHandler<EventArgs>(evaluator_MultipleScopeSupportChanged); process.DisconnectRepl(); _evaluators.Remove(id); if (_activeEvaluator == evaluator) { _activeEvaluator = null; } ActiveProcessChanged(); } }
internal void SwitchProcess(JProcess process, bool verbose) { var newEvaluator = _evaluators[process.Id]; if (newEvaluator != _activeEvaluator) { _activeEvaluator = newEvaluator; ActiveProcessChanged(); if (verbose) { _window.WriteLine(String.Format("Current process changed to {0}", process.Id)); } } }
internal void AttachProcess(JProcess process) { if (_evaluators.ContainsKey(process.Id)) { // Process is already attached, so just switch to it if needed SwitchProcess(process, false); return; } process.ProcessExited += new EventHandler<ProcessExitedEventArgs>(OnProcessExited); var evaluator = new JDebugProcessReplEvaluator(process); evaluator.Window = _window; evaluator.AvailableScopesChanged += new EventHandler<EventArgs>(evaluator_AvailableScopesChanged); evaluator.MultipleScopeSupportChanged += new EventHandler<EventArgs>(evaluator_MultipleScopeSupportChanged); _evaluators.Add(process.Id, evaluator); _activeEvaluator = evaluator; }