internal static bool CreateIfEmpty(GH_Document document, GH_Component component, ElementType type, string?selected = null) { var inputParam = component.Params.First(); if (inputParam.SourceCount > 0) { return(false); } var libraryParam = new LibraryParam { _type = type }; if (selected is not null) { var selectedItem = new GH_ValueListItem(selected, $"\"{selected}\"") { Selected = true }; libraryParam.ListItems.Add(selectedItem); } libraryParam.Update(); var pivot = component.Attributes.Pivot; libraryParam.Attributes.Pivot = new PointF(pivot.X - 240, pivot.Y - 21); document.AddObject(libraryParam, false); inputParam.AddSource(libraryParam); return(true); }
// static internal static bool IsConnected(GH_Component component, out LibraryParam libraryParam) { var sources = component.Params.First().Sources; libraryParam = sources.OfType <LibraryParam>().FirstOrDefault(); return(libraryParam is not null); }
public RunningEnv(MainForm mainForm) { CheckData = new CheckParam(); CheckingData = new CheckingParam(); LibraryData = new LibraryParam(); SettingData = new SettingParam(); UIContext = mainForm; EnvTimestamp = new DateTime(); }