//---------------------------------------------------------- public void Get_Data_Item() { try { var list_viewsection = new FilteredElementCollector(doc).OfClass(typeof(ViewSection)).Cast <ViewSection>().ToList(); foreach (Parameter para in list_viewsection[0].Parameters) { my_parameter_list_data.Add(new parameter_data() { parameter = para, parameter_name = para.Definition.Name, parameter_value = mySupport_All.Get_Parameter_Information(para, doc, myAll_Data) }); } paramater_1.ItemsSource = my_parameter_list_data; paramater_1.SelectedItem = my_parameter_list_data.First(X => X.parameter_name == "Ansichtstyp"); CollectionView view_paramater_1 = (CollectionView)CollectionViewSource.GetDefaultView(paramater_1.ItemsSource); view_paramater_1.SortDescriptions.Add(new SortDescription("parameter_name", ListSortDirection.Ascending)); paramater_2.ItemsSource = my_parameter_list_data; paramater_2.SelectedItem = my_parameter_list_data.First(X => X.parameter_name == "Planart"); CollectionView view_paramater_2 = (CollectionView)CollectionViewSource.GetDefaultView(paramater_2.ItemsSource); view_paramater_2.SortDescriptions.Add(new SortDescription("parameter_name", ListSortDirection.Ascending)); paramater_3.ItemsSource = my_parameter_list_data; paramater_3.SelectedItem = my_parameter_list_data.First(X => X.parameter_name == "Plantype"); CollectionView view_paramater_3 = (CollectionView)CollectionViewSource.GetDefaultView(paramater_3.ItemsSource); view_paramater_3.SortDescriptions.Add(new SortDescription("parameter_name", ListSortDirection.Ascending)); } catch (Exception) { } }
//---------------------------------------------------------- public void Apply_Sort(UIApplication uiapp, Document doc) { try { myFunctionSupport = new Support_All(); parameter_data item1 = (parameter_data)parameter_1.SelectedItem; parameter_data item2 = (parameter_data)parameter_2.SelectedItem; parameter_data item3 = (parameter_data)parameter_3.SelectedItem; List <ViewSection> list_view_section = new List <ViewSection>(); var list_viewsection = new FilteredElementCollector(doc).OfClass(typeof(ViewSection)).Cast <ViewSection>().ToList(); foreach (var view in list_viewsection) { if (myFunctionSupport.Get_Parameter_Information(view.LookupParameter(item1.parameter_name), doc, myAll_Data) == value_1.Text && myFunctionSupport.Get_Parameter_Information(view.LookupParameter(item2.parameter_name), doc, myAll_Data) == value_2.Text && myFunctionSupport.Get_Parameter_Information(view.LookupParameter(item3.parameter_name), doc, myAll_Data) == value_3.Text) { list_view_section.Add(view); } } List <view_section_list_data> list_view_section_data = new List <view_section_list_data>(); for (int i = Convert.ToInt32(sheet_start.Text); i < Convert.ToInt32(sheet_end.Text) + 1; i++) { foreach (ViewSection view in list_view_section) { if (myFunctionSupport.Get_Parameter_Information(view.LookupParameter("Sheet Number"), doc, myAll_Data) == i.ToString()) { list_view_section_data.Add(new view_section_list_data() { view_section = view, sheet_number = i.ToString() }); } } } Change_Number(uiapp, doc, list_view_section_data); } catch (Exception ex) { MessageBox.Show(ex.Message); } }