mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Added shape properties
This commit is contained in:
1 parent
2c60a42315
commit
12d5fd39a0
31 files changed
+373
-114
No files matched your search
@@ -13,7 +13,7 @@
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
|
||||
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
@@ -38,6 +38,9 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Humanizer, Version=2.7.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Humanizer.Core.2.7.9\lib\netstandard2.0\Humanizer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MaterialDesignColors, Version=1.2.0.325, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MaterialDesignColors.1.2.0\lib\net45\MaterialDesignColors.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -76,6 +79,7 @@
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Utilities\EnumUtilities.cs" />
|
||||
<Page Include="ColorPicker.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
|
||||
namespace Artemis.UI.Shared.Utilities
|
||||
{
|
||||
public static class EnumUtilities
|
||||
{
|
||||
public static string Description(this Enum value)
|
||||
{
|
||||
var attributes = value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (attributes.Any())
|
||||
return (attributes.First() as DescriptionAttribute).Description;
|
||||
|
||||
// If no description is found, the least we can do is replace underscores with spaces
|
||||
// You can add your own custom default formatting logic here
|
||||
var ti = CultureInfo.CurrentCulture.TextInfo;
|
||||
return ti.ToTitleCase(ti.ToLower(value.ToString().Replace("_", " ")));
|
||||
}
|
||||
|
||||
public static IEnumerable<ValueDescription> GetAllValuesAndDescriptions(Type t)
|
||||
{
|
||||
if (!t.IsEnum)
|
||||
throw new ArgumentException($"{nameof(t)} must be an enum type");
|
||||
|
||||
return Enum.GetValues(t).Cast<Enum>().Select(e => new ValueDescription {Value = e, Description = e.Humanize()}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class ValueDescription
|
||||
{
|
||||
public object Value { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Humanizer.Core" version="2.7.9" targetFramework="net472" />
|
||||
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
||||
<package id="MaterialDesignThemes" version="2.6.0" targetFramework="net472" />
|
||||
<package id="SkiaSharp" version="1.68.1" targetFramework="net472" />
|
||||
|
||||
Reference in new issue
Block a user