private void _baseNodeUrisListView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var selectIndex = _baseNodeUrisListView.SelectedIndex;
if (selectIndex == -1)
{
_baseNodeUriTextBox.Text = "tcp:";
((ComboBoxItem)_baseNodeUriSchemeComboBox.Items[0]).IsSelected = true;
return;
}
var item = _baseNodeUrisListView.SelectedItem as string;
if (item == null) return;
try
{
_baseNodeUriTextBox.Text = item;
var regex = new Regex(@"^(.+?):(.*)$");
Match match = regex.Match(item);
if (match.Success)
{
var conboboxItem = _baseNodeUriSchemeComboBox.Items.Cast<ComboBoxItem>()
.FirstOrDefault(n => (string)n.Content == match.Groups[1].Value);
if (conboboxItem != null)
{
conboboxItem.IsSelected = true;
}
}
}
catch (Exception)
{
}
}