private void ChangeComponents_OnClick(object sender, RoutedEventArgs e)
{
try
{
ChangeValue cv = new ChangeValue();
cv.WindowStartupLocation = WindowStartupLocation.CenterScreen;
List<Component> components = compCollection.ToList<Component>();
cv.valuesList.ItemsSource = components;
cv.valuesList.SelectionMode = SelectionMode.Multiple;
cv.Title = "Change Components";
DataTemplate componentTemplate = cv.FindResource("componentTemplate") as DataTemplate;
cv.valuesList.ItemTemplate = componentTemplate;
cv.valuesList.SelectedIndex = -1;
if (SelectedComponents != null && SelectedComponents.Any())
{
foreach (var o in SelectedComponents)
{
var selindex = components.IndexOf(o);
if (selindex != -1)
cv.valuesList.SelectedItems.Add(cv.valuesList.Items[selindex]);
}
}
// ChangeStatus ChangSt = new ChangeStatus(jira.issuesCollection[jiraPan.issueList.SelectedIndex].transitions);
cv.ShowDialog();
if (cv.DialogResult.HasValue && cv.DialogResult.Value)
{
SelectedComponents = new List<Component>();
foreach (var c in cv.valuesList.SelectedItems)
{
Component cc = c as Component;
SelectedComponents.Add(cc);
}
string componentsout = "none";
if (SelectedComponents != null && SelectedComponents.Any())
{
componentsout = "";
foreach (var c in SelectedComponents)
componentsout += c.name + ", ";
componentsout = componentsout.Remove(componentsout.Count() - 2);
}
ChangeComponents.Content = componentsout;
}
}
catch (System.Exception ex1)
{
MessageBox.Show("exception: " + ex1);
}
}
}