Refactor folder structure

This commit is contained in:
2026-02-18 00:50:46 +09:00
parent 426786397c
commit db8ca971a8
413 changed files with 2885 additions and 3634 deletions

View File

@@ -0,0 +1,46 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Reflection;
namespace Ghost.Editor.Utilities;
public class ReflectionBinding
{
private void RefreshField(FieldInfo field, FrameworkElement control, object source)
{
var value = field.GetValue(source);
switch (control)
{
case TextBox tb:
tb.Text = value?.ToString();
break;
case NumberBox nb when value is double d:
nb.Value = d;
break;
// Add more controls...
}
}
public void StartPollingField(FieldInfo field, FrameworkElement control, object component)
{
var lastValue = field.GetValue(component);
DispatcherTimer timer = new()
{
Interval = TimeSpan.FromMilliseconds(200)
};
timer.Tick += (_, _) =>
{
var currentValue = field.GetValue(component);
if (!Equals(currentValue, lastValue))
{
RefreshField(field, control, component);
lastValue = currentValue;
}
};
timer.Start();
}
}