/// <summary> /// Removes the CustomEnergySupplyModule model from the list of PlantSettings /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void delete_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; if (btn != null) { ((Panel)this.Parent).Children.Remove(this); AdditionalLoads to_remove = DistrictControl.Instance.ListOfDistrictLoads.OfType <AdditionalLoads>().First(x => x.Id == _id); DistrictControl.Instance.ListOfDistrictLoads.Remove(to_remove); Rhino.RhinoApp.WriteLine($"Removed {nameof(AdditionalLoads)} named {to_remove.Name}"); } }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var context = UmiContext.Current; var fileContent = string.Empty; var filePath = string.Empty; ObjRef obj_ref; var rc = RhinoGet.GetOneObject("Select a brep", true, ObjectType.Brep, out obj_ref); if (rc != Result.Success) { return(rc); } var refId = obj_ref.ObjectId; using (var openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = doc.Path; openFileDialog.Filter = "Comma Separated Value | *.csv"; openFileDialog.FilterIndex = 2; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { //Get the path of specified file filePath = openFileDialog.FileName; } } //Read the contents of the file into the umi db AdditionalLoads.AddAdditionalLoad(filePath, context, refId); RhinoApp.WriteLine($"Added additional load from '{filePath}'"); return(Result.Success); }