diff --git a/src/Avalonia.Base/Threading/DispatcherPriority.cs b/src/Avalonia.Base/Threading/DispatcherPriority.cs
index 9d0b91f6f2..a71140d288 100644
--- a/src/Avalonia.Base/Threading/DispatcherPriority.cs
+++ b/src/Avalonia.Base/Threading/DispatcherPriority.cs
@@ -16,64 +16,64 @@ namespace Avalonia.Threading
{
Value = value;
}
-
- ///
- /// Minimum possible priority that's actually dispatched, default value
- ///
- internal static readonly DispatcherPriority MinimumActiveValue = new(0);
///
- /// A dispatcher priority for jobs that shouldn't be executed yet
+ /// The lowest foreground dispatcher priority
///
- public static DispatcherPriority Inactive => new(MinimumActiveValue - 1);
+ internal static readonly DispatcherPriority Default = new(0);
+
///
- /// Minimum valid priority
+ /// The job will be processed with the same priority as input.
///
- internal static readonly DispatcherPriority MinValue = new(Inactive);
+ public static readonly DispatcherPriority Input = new(Default - 1);
///
- /// Used internally in dispatcher code
+ /// The job will be processed after other non-idle operations have completed.
///
- public static DispatcherPriority Invalid => new(MinimumActiveValue - 2);
+ public static readonly DispatcherPriority Background = new(Input - 1);
+ ///
+ /// The job will be processed after background operations have completed.
+ ///
+ public static readonly DispatcherPriority ContextIdle = new(Background - 1);
///
- /// The job will be processed when the system is idle.
+ /// The job will be processed when the application is idle.
///
- [Obsolete("WPF compatibility")] public static readonly DispatcherPriority SystemIdle = MinimumActiveValue;
-
+ public static readonly DispatcherPriority ApplicationIdle = new (ContextIdle - 1);
+
///
- /// The job will be processed when the application is idle.
+ /// The job will be processed when the system is idle.
///
- [Obsolete("WPF compatibility")] public static readonly DispatcherPriority ApplicationIdle = new (SystemIdle + 1);
+ public static readonly DispatcherPriority SystemIdle = new(ApplicationIdle - 1);
///
- /// The job will be processed after background operations have completed.
+ /// Minimum possible priority that's actually dispatched, default value
///
- [Obsolete("WPF compatibility")] public static readonly DispatcherPriority ContextIdle = new(ApplicationIdle + 1);
+ internal static readonly DispatcherPriority MinimumActiveValue = new(SystemIdle);
+
///
- /// The job will be processed with normal priority.
+ /// A dispatcher priority for jobs that shouldn't be executed yet
///
-#pragma warning disable CS0618
- public static readonly DispatcherPriority Normal = new(ContextIdle + 1);
-#pragma warning restore CS0618
-
+ public static readonly DispatcherPriority Inactive = new(MinimumActiveValue - 1);
+
///
- /// The job will be processed after other non-idle operations have completed.
+ /// Minimum valid priority
///
- public static readonly DispatcherPriority Background = new(MinValue + 1);
-
+ internal static readonly DispatcherPriority MinValue = new(Inactive);
+
///
- /// The job will be processed with the same priority as input.
+ /// Used internally in dispatcher code
///
- public static readonly DispatcherPriority Input = new(Background + 1);
-
+ public static readonly DispatcherPriority Invalid = new(MinimumActiveValue - 2);
+
+
///
/// The job will be processed after layout and render but before input.
///
- public static readonly DispatcherPriority Loaded = new(Input + 1);
+ public static readonly DispatcherPriority Loaded = new(Default + 1);
///
/// The job will be processed with the same priority as render.
@@ -98,12 +98,19 @@ namespace Avalonia.Threading
///
/// The job will be processed with the same priority as data binding.
///
- [Obsolete("WPF compatibility")] public static readonly DispatcherPriority DataBind = MinValue;
+ [Obsolete("WPF compatibility")] public static readonly DispatcherPriority DataBind = new(Layout);
+
+ ///
+ /// The job will be processed with normal priority.
+ ///
+#pragma warning disable CS0618
+ public static readonly DispatcherPriority Normal = new(DataBind + 1);
+#pragma warning restore CS0618
///
/// The job will be processed before other asynchronous operations.
///
- public static readonly DispatcherPriority Send = new(Layout + 1);
+ public static readonly DispatcherPriority Send = new(Normal + 1);
///
/// Maximum possible priority
@@ -151,5 +158,42 @@ namespace Avalonia.Threading
if (priority < Inactive || priority > MaxValue)
throw new ArgumentException("Invalid DispatcherPriority value", parameterName);
}
+
+#pragma warning disable CS0618
+ public override string ToString()
+ {
+ if (this == Invalid)
+ return nameof(Invalid);
+ if (this == Inactive)
+ return nameof(Inactive);
+ if (this == SystemIdle)
+ return nameof(SystemIdle);
+ if (this == ContextIdle)
+ return nameof(ContextIdle);
+ if (this == ApplicationIdle)
+ return nameof(ApplicationIdle);
+ if (this == Background)
+ return nameof(Background);
+ if (this == Input)
+ return nameof(Input);
+ if (this == Default)
+ return nameof(Default);
+ if (this == Loaded)
+ return nameof(Loaded);
+ if (this == Render)
+ return nameof(Render);
+ if (this == Composition)
+ return nameof(Composition);
+ if (this == PreComposition)
+ return nameof(PreComposition);
+ if (this == DataBind)
+ return nameof(DataBind);
+ if (this == Normal)
+ return nameof(Normal);
+ if (this == Send)
+ return nameof(Send);
+ return Value.ToString();
+ }
+#pragma warning restore CS0618
}
}