protected override void OnConnectionRenamed(object sender, ConnectionRenameEventArgs e)
{
var left = (BindingList<string>)cmbLeftConnection.DataSource;
var right = (BindingList<string>)cmbRightConnection.DataSource;
var target = (BindingList<string>)cmbTargetConnection.DataSource;
var idx = left.IndexOf(e.OldName);
if (idx >= 0)
left[idx] = e.NewName;
idx = right.IndexOf(e.OldName);
if (idx >= 0)
right[idx] = e.NewName;
idx = target.IndexOf(e.OldName);
if (idx >= 0)
target[idx] = e.NewName;
/*
string selLeft = this.SelectedLeftConnection;
string selRight = this.SelectedRightConnection;
string selTarget = this.SelectedTargetConnection;
//Fix the selected values if they are affected
if (selLeft.Equals(e.OldName))
{
selLeft = e.NewName;
}
if (selRight.Equals(e.OldName))
{
selRight = e.NewName;
}
if (selTarget.Equals(e.OldName))
{
selTarget = e.NewName;
}
//Fix the list, any list that is fixed needs to have
//their current value re-set
if (left.Contains(e.OldName))
{
left.Remove(e.OldName);
left.Add(e.NewName);
this.LeftConnections = left;
this.SelectedLeftConnection = selLeft;
}
if (right.Contains(e.OldName))
{
right.Remove(e.OldName);
right.Add(e.NewName);
this.RightConnections = right;
this.SelectedRightConnection = selRight;
}
if (target.Contains(e.OldName))
{
target.Remove(e.OldName);
target.Add(e.NewName);
this.TargetConnections = target;
this.SelectedTargetConnection = selTarget;
}*/
}