IList<DisplayUnitFormat> GetProjectUnitFormats( UnitFormatType unitFormat )
Function GetProjectUnitFormats( _ ByVal unitFormat As UnitFormatType _ ) As IList(Of DisplayUnitFormat)
Parameters
- unitFormat
IList<DisplayUnitFormat> GetProjectUnitFormats( UnitFormatType unitFormat )
Function GetProjectUnitFormats( _ ByVal unitFormat As UnitFormatType _ ) As IList(Of DisplayUnitFormat)
//Must be on the QueuedTask.Run() var unit_formats = Enum.GetValues(typeof(UnitFormatType)) .OfType<UnitFormatType>().ToList(); System.Diagnostics.Debug.WriteLine("Project units\r\n"); foreach (var unit_format in unit_formats) { var units = DisplayUnitFormats.Instance.GetProjectUnitFormats(unit_format); System.Diagnostics.Debug.WriteLine(unit_format.ToString()); foreach (var display_unit_format in units) { var line = $"{display_unit_format.DisplayName}, {display_unit_format.UnitCode}"; System.Diagnostics.Debug.WriteLine(line); } System.Diagnostics.Debug.WriteLine(""); }
//Must be on the QueuedTask.Run() //UnitFormatType.Angular, UnitFormatType.Area, UnitFormatType.Distance, //UnitFormatType.Direction, UnitFormatType.Location, UnitFormatType.Page //UnitFormatType.Symbol2D, UnitFormatType.Symbol3D var units = DisplayUnitFormats.Instance.GetProjectUnitFormats(UnitFormatType.Distance);
//UnitFormatType.Angular, UnitFormatType.Area, UnitFormatType.Distance, //UnitFormatType.Direction, UnitFormatType.Location var angle_units = DisplayUnitFormats.Instance.GetProjectUnitFormats(UnitFormatType.Angular); //Edit the display name of each unit - append the abbreviation foreach (var unit in angle_units) { unit.DisplayName = $"{unit.DisplayName} ({unit.Abbreviation})"; } //apply the changes to the units and set the default to be the first entry DisplayUnitFormats.Instance.SetProjectUnitFormats(angle_units, angle_units.First()); //The project must be saved to persist the changes...
Target Platforms: Windows 11, Windows 10