Remove typeof(T).Name reflection in viewmodels

このコミットが含まれているのは:
Sergio Pedri committed 2023-03-11 16:08:34 +01:00
1 親 2a8528e69c
コミット c66c775812
2ファイル変更
+15 -16

検索条件に一致するファイルはありません

+11 -11
ファイルの表示
@@ -93,40 +93,40 @@ public sealed partial class MainViewModel : ObservableObject
public IReadOnlyList<ShaderRunnerViewModel> ComputeShaderOptions { get; } = new ShaderRunnerViewModel[]
{
new(
typeof(ColorfulInfinity),
nameof(ColorfulInfinity),
new ShaderRunner<ColorfulInfinity>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.ColorfulInfinity>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(FractalTiling),
nameof(FractalTiling),
new ShaderRunner<FractalTiling>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.FractalTiling>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(MengerJourney),
nameof(MengerJourney),
new ShaderRunner<MengerJourney>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.MengerJourney>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(Octagrams),
nameof(Octagrams),
new ShaderRunner<Octagrams>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.Octagrams>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(ProteanClouds),
nameof(ProteanClouds),
new ShaderRunner<ProteanClouds>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.ProteanClouds>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(TwoTiledTruchet),
nameof(TwoTiledTruchet),
new ShaderRunner<TwoTiledTruchet>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.TwoTiledTruchet>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(PyramidPattern),
nameof(PyramidPattern),
new ShaderRunner<PyramidPattern>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.PyramidPattern>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(
typeof(TriangleGridContouring),
nameof(TriangleGridContouring),
new ShaderRunner<TriangleGridContouring>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.TriangleGridContouring>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
new(typeof(ContouredLayers), new ContouredLayersRunner(), new D2D1ContouredLayersRunner()),
new(nameof(ContouredLayers), new ContouredLayersRunner(), new D2D1ContouredLayersRunner()),
new(
typeof(TerracedHills),
nameof(TerracedHills),
new ShaderRunner<TerracedHills>(static time => new((float)time.TotalSeconds)),
new D2D1ShaderRunner<SwapChain.Shaders.D2D1.TerracedHills>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
};
@@ -197,7 +197,7 @@ public sealed partial class MainViewModel : ObservableObject
/// <inheritdoc/>
partial void OnSelectedComputeShaderChanged(ShaderRunnerViewModel value)
{
this.analyticsService.Log(Event.SelectedComputeShaderChanged, (nameof(value.ShaderType), value.ShaderType.Name));
this.analyticsService.Log(Event.SelectedComputeShaderChanged, (nameof(value.ShaderType), value.ShaderType));
}
/// <inheritdoc/>
+4 -5
ファイルの表示
@@ -1,4 +1,3 @@
using System;
using CommunityToolkit.Mvvm.ComponentModel;
using ComputeSharp.SwapChain.Core.Shaders;
#if WINDOWS_UWP
@@ -17,10 +16,10 @@ public sealed partial class ShaderRunnerViewModel : ObservableObject
/// <summary>
/// Creates a new <see cref="ShaderRunnerViewModel"/> instance.
/// </summary>
/// <param name="shaderType">The <see cref="Type"/> instance for the actual shader to execute.</param>
/// <param name="shaderType">The name of the shader type to execute.</param>
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to execute.</param>
/// <param name="d2D1ShaderRunner">The <see cref="ID2D1ShaderRunner"/> instance to execute.</param>
public ShaderRunnerViewModel(Type shaderType, IShaderRunner shaderRunner, ID2D1ShaderRunner d2D1ShaderRunner)
public ShaderRunnerViewModel(string shaderType, IShaderRunner shaderRunner, ID2D1ShaderRunner d2D1ShaderRunner)
{
ShaderType = shaderType;
ShaderRunner = shaderRunner;
@@ -28,9 +27,9 @@ public sealed partial class ShaderRunnerViewModel : ObservableObject
}
/// <summary>
/// Gets the <see cref="Type"/> instance for the actual shader to execute.
/// Gets the name of the shader type to execute.
/// </summary>
public Type ShaderType { get; }
public string ShaderType { get; }
/// <summary>
/// Gets the <see cref="IShaderRunner"/> instance to execute.