//-------------------------------------------------------------------------------------------------------------------------------------------------------------- private void delete_clash_parent_Click(object sender, RoutedEventArgs e) { try { if (thong_tin_clash_parent.SelectedItem != null) { var result_message = MessageBox.Show("Are you sure! This process cannot be undone", "QUESTION", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result_message == MessageBoxResult.Yes) { parent item = (parent)thong_tin_clash_parent.SelectedItem; List <string> Para2 = new List <string>() { "@DBProjectNumber", "@DBDisplayNameParent", "@DBFilesName" }; List <string> Para2_Values = new List <string>() { project_number, item.clash_parent, item.clash_file_name }; var result = SQL.SQLWrite(Source.path_FileStream, "dbo.sp_Delete_FromClashDetective_By_FilesName_And_NameParent", Source.type_Procedure, Para2, Para2_Values); if (result == "S") { MessageBox.Show("Delete success!", "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information); Get_Data_For_Parent(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//---------------------------------------------------------- private void Change_Status_Child(object sender, EventArgs e) { try { List <string> Check_Finish = new List <string>(); foreach (child item in my_child) { status_data data = (status_data)item.status_child; item.color = data.color; Check_Finish.Add(data.name); thong_tin_clash_child.Items.Refresh(); } if (Check_Finish.Distinct().ToList().Count() == 1 && Check_Finish[0] == Source.list_status_child[2].name) { parent item_parent = (parent)thong_tin_clash_parent.SelectedItem; item_parent.status_parent = Source.list_status_parent[1].name; item_parent.color = Source.list_status_parent[1].color; thong_tin_clash_parent.Items.Refresh(); } else { parent item_parent = (parent)thong_tin_clash_parent.SelectedItem; item_parent.status_parent = Source.list_status_parent[0].name; item_parent.color = Source.list_status_parent[0].color; thong_tin_clash_parent.Items.Refresh(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//--------------------------------------------------------------------------------- private void Choose_Clash_Parent(object sender, MouseButtonEventArgs e) { try { parent item = (parent)thong_tin_clash_parent.SelectedItem; if (item != null) { List <Document> docs = new List <Document>(); foreach (Document doc in uiapp.Application.Documents) { docs.Add(doc); } string file_name_1 = item.clash_file_name.Split(',')[0]; string file_name_2 = item.clash_file_name.Split(',')[1]; if (docs.Any(x => x.Title.Split('.')[0] == file_name_1) == false || docs.Any(x => x.Title.Split('.')[0] == file_name_2) == false) { MessageBox.Show("File clash không tồn tại trong dự án. Vui lòng link file cần kiểm tra và thử lại lần nữa", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } else { foreach (RevitLinkType type in new FilteredElementCollector(doc).OfClass(typeof(RevitLinkType)).Cast <RevitLinkType>().ToList()) { if (type.Name.Split('.')[0] == file_name_1 || type.Name.Split('.')[0] == file_name_2) { if (type.IsHidden(doc.ActiveView)) { doc.ActiveView.UnhideElements(new List <ElementId>() { type.Id }); } } } doc_file_1 = docs.First(x => x.Title.Split('.')[0] == file_name_1); doc_file_2 = docs.First(x => x.Title.Split('.')[0] == file_name_2); Get_Data_Clash_Child(item.clash_parent, item.clash_file_name); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { parent item = (parent)value; return(item != null ? item.clash_parent : "Null"); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { parent item = (parent)value; return(value != null ? Visibility.Visible : Visibility.Collapsed); }