public bool LoadContent(IntegrationBase intBase) { IntBase = intBase; if (intBase.CurrentProject == null || intBase.CurrentProject.Id == Guid.Empty) { return(false); } List <DtoDivision> divisions = intBase.ApiCore.Divisions.GetProjectDivisions(intBase.CurrentProject.Id); // Test //List<DtoDivision> toDelete = divisions.Where(d => d.Name.Contains("create new Division")).ToList(); //for (int i = 0; i < toDelete.Count; i++) //{ // bool deleted = intBase.ApiCore.Divisions.DeleteDtoDivision(toDelete[i].Id); //} foreach (DtoDivision division in divisions) { ViewDivs.Add(division); } DtoDivision newDivision = new DtoDivision { Name = "<create new Division>" }; ViewDivs.Add(newDivision); ModelView.SelectedItem = newDivision; return(true); }
private void StartImport_Click(object sender, RoutedEventArgs e) { if (SelectedDivision == null) { MessageBoxHelper.ShowInformation("No valid model selected."); return; } string ifcFile = IfcFile.Content.ToString(); if (String.IsNullOrEmpty(ifcFile)) { MessageBoxHelper.ShowInformation("No valid Ifc-File selected."); return; } // Create model if it doesn't exist. if (SelectedDivision.Id == Guid.Empty) { SelectedDivision.Id = Guid.NewGuid(); IntBase.ApiCore.Divisions.UploadProjectDivision(IntBase.CurrentProject.Id, SelectedDivision); } // Create new Revision else { IntBase.ApiCore.Divisions.CreateRevision(SelectedDivision.Id, "new Revision", ""); } // Upload IntBase.ApiCore.Divisions.UploadIfcModel(IntBase.CurrentProject.Id, SelectedDivision.Id, ifcFile, ifcFile); MessageBoxHelper.ShowInformation("The model was exported to Allplan Bimplus."); IfcFile.Content = ""; _adorner.InvalidateVisual(); HasIfcFileName = false; ViewDivs.Clear(); LoadContent(IntBase); }