private void ColletComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox insertComboBox = sender as ComboBox; ToolInfo toolInfo = insertComboBox.DataContext as ToolInfo; int toolId = toolInfo.ToolPosition; foreach (var tool in currentTools) { if (tool.ToolPosition.Equals(toolId)) { tool.CurrentCollet = insertComboBox.SelectedItem as string; } } }
void PerformToolInfo() { IEnumerable <Tool> distinctProjectTools = projectTools.Distinct(); foreach (Tool tool in distinctProjectTools) { ToolInfo toolInfo = new ToolInfo(); toolInfo.ToolPosition = tool.PositionNumber; toolInfo.SourceToolName = tool.Type + " " + tool.Name; toolInfo.SourceToolDiametr = tool.Diametr; toolInfo.SourceToolLength = tool.Length; toolInfo.SourceCuttingLength = tool.WorkingLength; toolInfo.SourceCutRadius = tool.EdgeRadius; toolInfo.SourceCutAngle = tool.Angle; toolInfo.SourceNumberOfTeeth = tool.NumberOfTeeth; toolInfo.SourceToolOverhang = tool.WorkingOverhang; toolInfo.SourceHolderName = tool.HolderName; toolInfo.SourceInsertNames1 = SearchMatchedToolFromExcel(tool.InsertPattern1, inserts); toolInfo.SourceInsertNames2 = SearchMatchedToolFromExcel(tool.InsertPattern2, inserts); toolInfo.SourceColletNames = SearchMatchedToolFromExcel(tool.FromSpindelSideInterface, collets); toolInfoContainer.Add(toolInfo); } }