public override void Click() { // Save SynchronizationContext var context = SynchronizationContext.Current; try { var dialog = new ReferenceDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var command = new CompoundCommand(); foreach (var reference in dialog.References) { if (!FReferences.Contains(reference)) { command.Append(Command.Add(FReferences, reference)); } } CommandHistory.Insert(command); } } finally { // Restore SynchronizationContext SynchronizationContext.SetSynchronizationContext(context); } }
public override void Click() { var dialog = new ReferenceDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var command = new CompoundCommand(); foreach (var reference in dialog.References) { if (!FReferences.Contains(reference)) { command.Append(Command.Add(FReferences, reference)); } } CommandHistory.Insert(command); } }