MVVM frame work done, under unit test

This commit is contained in:
Nitload
2024-07-25 04:41:24 +08:00
parent 924fe6eef7
commit da75200347
101 changed files with 8435 additions and 847 deletions
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace StgSharpDebug.Logic
{
#nullable enable
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate ref object BindingDataGetter();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void BindingDataSetter(ref object value);
public unsafe struct DataBindingEntry
{
private IntPtr getterPtr, setterPtr;
public DataBindingEntry(
[NotNull] BindingDataGetter gettingCallback,
[NotNull] BindingDataSetter settingCallback)
{
getterPtr = Marshal.GetFunctionPointerForDelegate(gettingCallback);
setterPtr = Marshal.GetFunctionPointerForDelegate(settingCallback);
}
public ref object GetValue()
{
return ref ((delegate* unmanaged[Cdecl]<ref object>)getterPtr)();
}
public void SetData(ref object value)
{
((delegate* unmanaged[Cdecl]<ref object, void>)setterPtr)(ref value);
}
public static DataBindingEntry NullBinding
{
get => new DataBindingEntry();
}
public bool ExactEqual(DataBindingEntry other)
{
return getterPtr == other.getterPtr && setterPtr == other.setterPtr;
}
}
#nullable restore
}