protected virtual void SetSelectionWithUndo(string description, ListOfT newSelection, T newPrimarySelection) { this.OnSelectionChanging((IList <T>)newSelection); int primarySelection = this.GetIndexOfPrimarySelection(newSelection, newPrimarySelection); if (this.editTransactionFactory != null) { description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, description, new object[1] { (object)this.namingHelper.Name }); using (SceneEditTransaction editTransaction = this.editTransactionFactory.CreateEditTransaction(description, true)) { editTransaction.AddUndoUnit((IUndoUnit) new SelectionSet <T, ListOfT> .SelectionChangeUndoUnit(this, newSelection, primarySelection)); editTransaction.Commit(); } } else { this.SetSelectionInternal(newSelection, primarySelection); } if (this.ViewModel == null || !this.IsExclusive || newSelection.Count <= 0) { return; } this.ViewModel.EnforceExclusiveSelection((ISelectionSet)this); }