mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Code style - Use file scoped namespaces
Code style - Ran code cleanup
This commit is contained in:
1 parent
e68e16df4d
commit
f6090dc296
691 files changed
+37301
-38119
No files matched your search
@@ -1,25 +1,24 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.LogicalTree;
|
||||
|
||||
namespace Artemis.UI.Shared.Extensions
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides extension methods for Avalonia's <see cref="Control" /> type
|
||||
/// </summary>
|
||||
public static class ControlExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides extension methods for Avalonia's <see cref="Control" /> type
|
||||
/// Clears all data validation errors on the given control and any of it's logical siblings
|
||||
/// </summary>
|
||||
public static class ControlExtensions
|
||||
/// <param name="target">The target control</param>
|
||||
public static void ClearAllDataValidationErrors(this Control target)
|
||||
{
|
||||
/// <summary>
|
||||
/// Clears all data validation errors on the given control and any of it's logical siblings
|
||||
/// </summary>
|
||||
/// <param name="target">The target control</param>
|
||||
public static void ClearAllDataValidationErrors(this Control target)
|
||||
DataValidationErrors.ClearErrors(target);
|
||||
foreach (ILogical logicalChild in target.GetLogicalChildren())
|
||||
{
|
||||
DataValidationErrors.ClearErrors(target);
|
||||
foreach (ILogical logicalChild in target.GetLogicalChildren())
|
||||
{
|
||||
if (logicalChild is Control childControl)
|
||||
childControl.ClearAllDataValidationErrors();
|
||||
}
|
||||
if (logicalChild is Control childControl)
|
||||
childControl.ClearAllDataValidationErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Artemis.UI.Shared.Extensions;
|
||||
public static class LayerPropertyExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an observable sequence of layer property values starting with the current value.
|
||||
/// Returns an observable sequence of layer property values starting with the current value.
|
||||
/// </summary>
|
||||
/// <param name="layerProperty">The layer property to create the sequence of.</param>
|
||||
/// <typeparam name="T">The value type of the layer property.</typeparam>
|
||||
|
||||
@@ -4,12 +4,12 @@ using SkiaSharp;
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides extension methods for the <see cref="SKColor"/> type.
|
||||
/// Provides extension methods for the <see cref="SKColor" /> type.
|
||||
/// </summary>
|
||||
public static class SKColorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a SkiaSharp <see cref="SKColor"/> to an Avalonia <see cref="Color"/>.
|
||||
/// Converts a SkiaSharp <see cref="SKColor" /> to an Avalonia <see cref="Color" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The color to convert.</param>
|
||||
/// <returns>The resulting color.</returns>
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
using Artemis.Core;
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Material.Icons;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
|
||||
namespace Artemis.UI.Shared.Extensions
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides utilities when working with types in UI elements.
|
||||
/// </summary>
|
||||
public static class TypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides utilities when working with types in UI elements.
|
||||
/// Finds an appropriate Material Design icon for the given <paramref name="type" />.
|
||||
/// </summary>
|
||||
public static class TypeExtensions
|
||||
/// <param name="type">The type to retrieve an icon for.</param>
|
||||
/// <returns>An appropriate Material Design icon for the given <paramref name="type" />.</returns>
|
||||
public static MaterialIconKind GetTypeIcon(this Type? type)
|
||||
{
|
||||
/// <summary>
|
||||
/// Finds an appropriate Material Design icon for the given <paramref name="type"/>.
|
||||
/// </summary>
|
||||
/// <param name="type">The type to retrieve an icon for.</param>
|
||||
/// <returns>An appropriate Material Design icon for the given <paramref name="type"/>.</returns>
|
||||
public static MaterialIconKind GetTypeIcon(this Type? type)
|
||||
{
|
||||
if (type == null)
|
||||
return MaterialIconKind.QuestionMarkCircle;
|
||||
if (type.TypeIsNumber())
|
||||
return MaterialIconKind.CalculatorVariantOutline;
|
||||
if (type.IsEnum)
|
||||
return MaterialIconKind.FormatListBulletedSquare;
|
||||
if (type == typeof(bool))
|
||||
return MaterialIconKind.CircleHalfFull;
|
||||
if (type == typeof(string))
|
||||
return MaterialIconKind.Text;
|
||||
if (type == typeof(SKColor))
|
||||
return MaterialIconKind.Palette;
|
||||
if (type.IsAssignableTo(typeof(IDataModelEvent)))
|
||||
return MaterialIconKind.LightningBolt;
|
||||
return MaterialIconKind.Matrix;
|
||||
}
|
||||
if (type == null)
|
||||
return MaterialIconKind.QuestionMarkCircle;
|
||||
if (type.TypeIsNumber())
|
||||
return MaterialIconKind.CalculatorVariantOutline;
|
||||
if (type.IsEnum)
|
||||
return MaterialIconKind.FormatListBulletedSquare;
|
||||
if (type == typeof(bool))
|
||||
return MaterialIconKind.CircleHalfFull;
|
||||
if (type == typeof(string))
|
||||
return MaterialIconKind.Text;
|
||||
if (type == typeof(SKColor))
|
||||
return MaterialIconKind.Palette;
|
||||
if (type.IsAssignableTo(typeof(IDataModelEvent)))
|
||||
return MaterialIconKind.LightningBolt;
|
||||
return MaterialIconKind.Matrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user