private void OnInterpretersChanged(object sender, EventArgs e) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke((Action)(() => OnInterpretersChanged(sender, e))); return; } var existing = Interpreters.Where(iv => iv.Interpreter != null).ToDictionary(iv => iv.Interpreter); var def = _interpreterService.DefaultInterpreter; int i = 0; foreach (var interp in _interpreterService.Interpreters) { if (!existing.Remove(interp)) { Interpreters.Insert(i, new InterpreterView(interp, interp.Description, interp == def)); } i += 1; } foreach (var kv in existing) { Interpreters.Remove(kv.Value); } }
private void OnInterpretersChanged(object sender, EventArgs e) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke((Action)(() => OnInterpretersChanged(sender, e))); return; } var existing = Interpreters.Where(iv => iv.Interpreter != null).ToDictionary(iv => iv.Interpreter); var def = _project.GetInterpreterFactory(); int i = 0; foreach (var interp in InterpreterView.GetInterpreters(_project.Site, _project).Select(x => x.Interpreter)) { if (!existing.Remove(interp)) { Interpreters.Insert(i, new InterpreterView(interp, interp.Configuration.FullDescription, interp == def)); } i += 1; } foreach (var kv in existing) { Interpreters.Remove(kv.Value); } }