DisplayUnitFormat GetDefaultProjectUnitFormat( UnitFormatType defaultFormatType )
Function GetDefaultProjectUnitFormat( _ ByVal defaultFormatType As UnitFormatType _ ) As DisplayUnitFormat
Parameters
- defaultFormatType
DisplayUnitFormat GetDefaultProjectUnitFormat( UnitFormatType defaultFormatType )
Function GetDefaultProjectUnitFormat( _ ByVal defaultFormatType As UnitFormatType _ ) As DisplayUnitFormat
//Must be on the QueuedTask.Run() var unit_formats = Enum.GetValues(typeof(UnitFormatType)) .OfType<UnitFormatType>().ToList(); System.Diagnostics.Debug.WriteLine("Default project units\r\n"); foreach (var unit_format in unit_formats) { var default_unit = DisplayUnitFormats.Instance.GetDefaultProjectUnitFormat(unit_format); var line = $"{unit_format.ToString()}: {default_unit.DisplayName}, {default_unit.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 default_unit = DisplayUnitFormats.Instance.GetDefaultProjectUnitFormat( UnitFormatType.Distance);
//Must be on the QueuedTask.Run() var unit_formats = Enum.GetValues(typeof(UnitFormatType)).OfType<UnitFormatType>().ToList(); foreach (var unit_type in unit_formats) { var current_default = DisplayUnitFormats.Instance.GetDefaultProjectUnitFormat(unit_type); //Arbitrarily pick the last unit in each unit format list var replacement = DisplayUnitFormats.Instance.GetProjectUnitFormats(unit_type).Last(); DisplayUnitFormats.Instance.SetDefaultProjectUnitFormat(replacement); var line = $"{current_default.DisplayName}, {current_default.UnitName}, {current_default.UnitCode}"; var line2 = $"{replacement.DisplayName}, {replacement.UnitName}, {replacement.UnitCode}"; System.Diagnostics.Debug.WriteLine($"Format: {unit_type.ToString()}"); System.Diagnostics.Debug.WriteLine($" Current default: {line}"); System.Diagnostics.Debug.WriteLine($" Replacement default: {line2}"); }
Target Platforms: Windows 11, Windows 10