csharp4405de34 | 1 | using System.Globalization; |
| 2 | using CascadeIDE.Contracts; |
| 3 | |
| 4 | namespace CascadeIDE.Features.Shell.Application; |
| 5 | |
| 6 | [PresentationProjection] |
| 7 | public static class UiModeSelectionParameter |
| 8 | { |
| 9 | public static int ParseIndex(object? parameter) => |
| 10 | parameter switch |
| 11 | { |
| 12 | int i => i, |
| 13 | long l => l > int.MaxValue ? -1 : (int)l, |
| 14 | string s when int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var j) => j, |
| 15 | _ => -1, |
| 16 | }; |
| 17 | } |
| 18 | |
View only · write via MCP/CIDE