//-------------------------------------------------------------------------------------------------------------------------------------------------------------- private void Refresh_All_Du_Lieu(object sender, RoutedEventArgs e) { my_family = new ObservableCollection <data_family>(); my_parameters = new ObservableCollection <data_parameters>(); my_materials = new ObservableCollection <data_materials>(); my_material = new ObservableCollection <data_material>(); thong_tin_kich_thuoc.ItemsSource = new ObservableCollection <data_parameters>(); thong_tin_cong_tac_vat_lieu.ItemsSource = new ObservableCollection <data_materials>(); thong_tin_family_type.ItemsSource = new ObservableCollection <data_materials>(); ElementType type = F_TypeDefault.get_type_select(uidoc, doc, descipline, category, outhome, inhome, kc); Show_Tat_Ca_Family_Type(); if (type != null) { foreach (data_family family in my_family) { if (family.ten_family_type == type.FamilyName) { family.ValueExpanded = true; foreach (data_type element_Type in family.Children) { if (element_Type.ten_element_type == type.Name) { element_Type.ValueIsSelect = true; F_ViewDetail.view_detail(doc, element_Type, my_parameters, my_materials, my_material, thong_tin_kich_thuoc, thong_tin_cong_tac_vat_lieu, unit_length); } } } } } }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------- private void Xem_Thong_Tin_Element_Type(object sender, MouseButtonEventArgs e) { try { if (thong_tin_family_type.SelectedItem != null) { my_parameters = new ObservableCollection <data_parameters>(); my_materials = new ObservableCollection <data_materials>(); my_material = new ObservableCollection <data_material>(); thong_tin_kich_thuoc.ItemsSource = new ObservableCollection <data_parameters>(); thong_tin_cong_tac_vat_lieu.ItemsSource = new ObservableCollection <data_materials>(); if (thong_tin_family_type.SelectedItem is data_type) { data_type type = (data_type)thong_tin_family_type.SelectedItem; F_ViewDetail.view_detail(doc, type, my_parameters, my_materials, my_material, thong_tin_kich_thuoc, thong_tin_cong_tac_vat_lieu, unit_length); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//---------------------------------------------------------- public void Function_Dau_Vao() { List <string> file_name = doc.Title.Split('_').ToList(); project_number = doc.ProjectInformation.Number; block = doc.ProjectInformation.BuildingName; Class = doc.ProjectInformation.LookupParameter("Class") == null ? "" : doc.ProjectInformation.LookupParameter("Class").AsString(); if (string.IsNullOrEmpty(Class)) { MessageBox.Show("Share Parameter Class not found", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } if (file_name.Count() > 3) { unit_length = F_GetUnits.get_unit_length_type(doc); List <string> format = new List <string>(); if (project_number != file_name[0]) { format.Add("Project Number"); } if (block != file_name[1]) { format.Add("Block"); } if (Class != file_name[3]) { format.Add("Class"); } if (format.Count() == 0) { F_GetDesciplineAndCategory.get_descipline_and_category(descipline, category); CollectionView view_category = (CollectionView)CollectionViewSource.GetDefaultView(category.ItemsSource); view_category.Filter = Filter_category; my_family = new ObservableCollection <data_family>(); my_parameters = new ObservableCollection <data_parameters>(); my_materials = new ObservableCollection <data_materials>(); my_material = new ObservableCollection <data_material>(); ElementType type = F_TypeDefault.get_type_select(uidoc, doc, descipline, category, outhome, inhome, kc); Show_Tat_Ca_Family_Type(); if (type != null) { foreach (data_family family in my_family) { if (family.ten_family_type == type.FamilyName) { family.ValueExpanded = true; foreach (data_type element_Type in family.Children) { if (element_Type.ten_element_type == type.Name) { element_Type.ValueIsSelect = true; F_ViewDetail.view_detail(doc, element_Type, my_parameters, my_materials, my_material, thong_tin_kich_thuoc, thong_tin_cong_tac_vat_lieu, unit_length); } } } } } } else { MessageBox.Show(string.Format("Data is incorrect.\nPlease check {0} and try again!", string.Join(",", format)), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } } else { MessageBox.Show("File name is incorrect. Please check and try again!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }