523 changed files with 16865 additions and 9392 deletions
@ -0,0 +1,31 @@ |
|||||
|
--- |
||||
|
name: Bug report |
||||
|
about: Create a report to help us improve |
||||
|
title: '' |
||||
|
labels: '' |
||||
|
assignees: '' |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
**Describe the bug** |
||||
|
A clear and concise description of what the bug is. |
||||
|
|
||||
|
**To Reproduce** |
||||
|
Steps to reproduce the behavior: |
||||
|
1. Go to '...' |
||||
|
2. Click on '....' |
||||
|
3. Scroll down to '....' |
||||
|
4. See error |
||||
|
|
||||
|
**Expected behavior** |
||||
|
A clear and concise description of what you expected to happen. |
||||
|
|
||||
|
**Screenshots** |
||||
|
If applicable, add screenshots to help explain your problem. |
||||
|
|
||||
|
**Desktop (please complete the following information):** |
||||
|
- OS: [e.g. Windows, Mac, Linux (State distribution)] |
||||
|
- Version [e.g. 0.10.0-rc1 or 0.9.12] |
||||
|
|
||||
|
**Additional context** |
||||
|
Add any other context about the problem here. |
||||
@ -0,0 +1,20 @@ |
|||||
|
--- |
||||
|
name: Feature request |
||||
|
about: Suggest an idea for this project |
||||
|
title: '' |
||||
|
labels: '' |
||||
|
assignees: '' |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
**Is your feature request related to a problem? Please describe.** |
||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] |
||||
|
|
||||
|
**Describe the solution you'd like** |
||||
|
A clear and concise description of what you want to happen. |
||||
|
|
||||
|
**Describe alternatives you've considered** |
||||
|
A clear and concise description of any alternative solutions or features you've considered. |
||||
|
|
||||
|
**Additional context** |
||||
|
Add any other context or screenshots about the feature request here. |
||||
@ -1,5 +1,3 @@ |
|||||
<ProjectConfiguration> |
<ProjectConfiguration> |
||||
<Settings> |
<Settings /> |
||||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|
||||
</Settings> |
|
||||
</ProjectConfiguration> |
</ProjectConfiguration> |
||||
@ -0,0 +1,5 @@ |
|||||
|
<ProjectConfiguration> |
||||
|
<Settings> |
||||
|
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
||||
|
</Settings> |
||||
|
</ProjectConfiguration> |
||||
@ -1,6 +1,6 @@ |
|||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="HarfBuzzSharp" Version="2.6.1.6" /> |
<PackageReference Include="HarfBuzzSharp" Version="2.6.1.7" /> |
||||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.6.1.6" /> |
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.6.1.7" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -0,0 +1,33 @@ |
|||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
|
||||
|
<!-- Ensure that code generator is actually built --> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\src\tools\MicroComGenerator\MicroComGenerator.csproj"> |
||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
||||
|
<ExcludeAssets>all</ExcludeAssets> |
||||
|
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> |
||||
|
</ProjectReference> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<Target Name="GenerateAvaloniaNativeComInterop" |
||||
|
BeforeTargets="CoreCompile" |
||||
|
DependsOnTargets="ResolveReferences" |
||||
|
Inputs="@(AvnComIdl);$(MSBuildThisFileDirectory)../src/tools/MicroComGenerator/**/*.cs" |
||||
|
Outputs="%(AvnComIdl.OutputFile)"> |
||||
|
<Message Importance="high" Text="Generating file %(AvnComIdl.OutputFile) from @(AvnComIdl)" /> |
||||
|
<Exec Command="dotnet $(MSBuildThisFileDirectory)../src/tools/MicroComGenerator/bin/$(Configuration)/netcoreapp3.1/MicroComGenerator.dll -i @(AvnComIdl) --cs %(AvnComIdl.OutputFile)" LogStandardErrorAsError="true" /> |
||||
|
<ItemGroup> |
||||
|
<!-- Remove and re-add generated file, this is needed for the clean build --> |
||||
|
<Compile Remove="%(AvnComIdl.OutputFile)"/> |
||||
|
<Compile Include="%(AvnComIdl.OutputFile)"/> |
||||
|
</ItemGroup> |
||||
|
</Target> |
||||
|
<ItemGroup> |
||||
|
<UpToDateCheckInput Include="@(AvnComIdl)"/> |
||||
|
<UpToDateCheckInput Include="$(MSBuildThisFileDirectory)/../src/tools/MicroComGenerator/**/*.cs"/> |
||||
|
</ItemGroup> |
||||
|
<PropertyGroup> |
||||
|
<_AvaloniaPatchComInterop>true</_AvaloniaPatchComInterop> |
||||
|
</PropertyGroup> |
||||
|
<Import Project="$(MSBuildThisFileDirectory)/BuildTargets.targets" /> |
||||
|
</Project> |
||||
@ -1,5 +1,5 @@ |
|||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="ReactiveUI" Version="11.5.17" /> |
<PackageReference Include="ReactiveUI" Version="12.1.1" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -1,5 +1,5 @@ |
|||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="System.Reactive" Version="4.4.1" /> |
<PackageReference Include="System.Reactive" Version="5.0" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -1,5 +1,26 @@ |
|||||
<Project> |
<Project> |
||||
|
<PropertyGroup> |
||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl> |
||||
|
<IncludeSymbols>false</IncludeSymbols> |
||||
|
<EmbedUntrackedSources>true</EmbedUntrackedSources> |
||||
|
<DebugType>embedded</DebugType> |
||||
|
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'"> |
||||
|
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'"> |
||||
|
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> |
||||
|
</PropertyGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" /> |
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<!-- Workaround for https://github.com/dotnet/sdk/issues/11105 --> |
||||
|
<ItemGroup> |
||||
|
<SourceRoot Include="$(NuGetPackageRoot)" Condition="'$(NuGetPackageRoot)' != ''" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -0,0 +1 @@ |
|||||
|
avalonia-native.h |
||||
@ -1,516 +0,0 @@ |
|||||
#include "com.h" |
|
||||
#include "key.h" |
|
||||
#include "stddef.h" |
|
||||
|
|
||||
#define AVNCOM(name, id) COMINTERFACE(name, 2e2cda0a, 9ae5, 4f1b, 8e, 20, 08, 1a, 04, 27, 9f, id) |
|
||||
|
|
||||
struct IAvnWindowEvents; |
|
||||
struct IAvnWindow; |
|
||||
struct IAvnPopup; |
|
||||
struct IAvnMacOptions; |
|
||||
struct IAvnPlatformThreadingInterface; |
|
||||
struct IAvnSystemDialogEvents; |
|
||||
struct IAvnSystemDialogs; |
|
||||
struct IAvnScreens; |
|
||||
struct IAvnClipboard; |
|
||||
struct IAvnCursor; |
|
||||
struct IAvnCursorFactory; |
|
||||
struct IAvnGlFeature; |
|
||||
struct IAvnGlContext; |
|
||||
struct IAvnGlDisplay; |
|
||||
struct IAvnGlSurfaceRenderTarget; |
|
||||
struct IAvnGlSurfaceRenderingSession; |
|
||||
struct IAvnMenu; |
|
||||
struct IAvnMenuItem; |
|
||||
struct IAvnStringArray; |
|
||||
struct IAvnDndResultCallback; |
|
||||
struct IAvnGCHandleDeallocatorCallback; |
|
||||
struct IAvnMenuEvents; |
|
||||
struct IAvnNativeControlHost; |
|
||||
struct IAvnNativeControlHostTopLevelAttachment; |
|
||||
enum SystemDecorations { |
|
||||
SystemDecorationsNone = 0, |
|
||||
SystemDecorationsBorderOnly = 1, |
|
||||
SystemDecorationsFull = 2, |
|
||||
}; |
|
||||
|
|
||||
struct AvnSize |
|
||||
{ |
|
||||
double Width, Height; |
|
||||
}; |
|
||||
|
|
||||
struct AvnPixelSize |
|
||||
{ |
|
||||
int Width, Height; |
|
||||
}; |
|
||||
|
|
||||
struct AvnRect |
|
||||
{ |
|
||||
double X, Y, Width, Height; |
|
||||
}; |
|
||||
|
|
||||
struct AvnVector |
|
||||
{ |
|
||||
double X, Y; |
|
||||
}; |
|
||||
|
|
||||
struct AvnPoint |
|
||||
{ |
|
||||
double X, Y; |
|
||||
}; |
|
||||
|
|
||||
struct AvnScreen |
|
||||
{ |
|
||||
AvnRect Bounds; |
|
||||
AvnRect WorkingArea; |
|
||||
float PixelDensity; |
|
||||
bool Primary; |
|
||||
}; |
|
||||
|
|
||||
enum AvnPixelFormat |
|
||||
{ |
|
||||
kAvnRgb565, |
|
||||
kAvnRgba8888, |
|
||||
kAvnBgra8888 |
|
||||
}; |
|
||||
|
|
||||
struct AvnFramebuffer |
|
||||
{ |
|
||||
void* Data; |
|
||||
int Width; |
|
||||
int Height; |
|
||||
int Stride; |
|
||||
AvnVector Dpi; |
|
||||
AvnPixelFormat PixelFormat; |
|
||||
}; |
|
||||
|
|
||||
struct AvnColor |
|
||||
{ |
|
||||
unsigned char Alpha; |
|
||||
unsigned char Red; |
|
||||
unsigned char Green; |
|
||||
unsigned char Blue; |
|
||||
}; |
|
||||
|
|
||||
enum AvnRawMouseEventType |
|
||||
{ |
|
||||
LeaveWindow, |
|
||||
LeftButtonDown, |
|
||||
LeftButtonUp, |
|
||||
RightButtonDown, |
|
||||
RightButtonUp, |
|
||||
MiddleButtonDown, |
|
||||
MiddleButtonUp, |
|
||||
XButton1Down, |
|
||||
XButton1Up, |
|
||||
XButton2Down, |
|
||||
XButton2Up, |
|
||||
Move, |
|
||||
Wheel, |
|
||||
NonClientLeftButtonDown, |
|
||||
TouchBegin, |
|
||||
TouchUpdate, |
|
||||
TouchEnd, |
|
||||
TouchCancel |
|
||||
}; |
|
||||
|
|
||||
enum AvnRawKeyEventType |
|
||||
{ |
|
||||
KeyDown, |
|
||||
KeyUp |
|
||||
}; |
|
||||
|
|
||||
enum AvnInputModifiers |
|
||||
{ |
|
||||
AvnInputModifiersNone = 0, |
|
||||
Alt = 1, |
|
||||
Control = 2, |
|
||||
Shift = 4, |
|
||||
Windows = 8, |
|
||||
LeftMouseButton = 16, |
|
||||
RightMouseButton = 32, |
|
||||
MiddleMouseButton = 64, |
|
||||
XButton1MouseButton = 128, |
|
||||
XButton2MouseButton = 256 |
|
||||
}; |
|
||||
|
|
||||
enum class AvnDragDropEffects |
|
||||
{ |
|
||||
None = 0, |
|
||||
Copy = 1, |
|
||||
Move = 2, |
|
||||
Link = 4, |
|
||||
}; |
|
||||
|
|
||||
enum class AvnDragEventType |
|
||||
{ |
|
||||
Enter, |
|
||||
Over, |
|
||||
Leave, |
|
||||
Drop |
|
||||
}; |
|
||||
|
|
||||
enum AvnWindowState |
|
||||
{ |
|
||||
Normal, |
|
||||
Minimized, |
|
||||
Maximized, |
|
||||
FullScreen, |
|
||||
}; |
|
||||
|
|
||||
enum AvnStandardCursorType |
|
||||
{ |
|
||||
CursorArrow, |
|
||||
CursorIbeam, |
|
||||
CursorWait, |
|
||||
CursorCross, |
|
||||
CursorUpArrow, |
|
||||
CursorSizeWestEast, |
|
||||
CursorSizeNorthSouth, |
|
||||
CursorSizeAll, |
|
||||
CursorNo, |
|
||||
CursorHand, |
|
||||
CursorAppStarting, |
|
||||
CursorHelp, |
|
||||
CursorTopSide, |
|
||||
CursorBottomSize, |
|
||||
CursorLeftSide, |
|
||||
CursorRightSide, |
|
||||
CursorTopLeftCorner, |
|
||||
CursorTopRightCorner, |
|
||||
CursorBottomLeftCorner, |
|
||||
CursorBottomRightCorner, |
|
||||
CursorDragMove, |
|
||||
CursorDragCopy, |
|
||||
CursorDragLink, |
|
||||
CursorNone |
|
||||
}; |
|
||||
|
|
||||
enum AvnWindowEdge |
|
||||
{ |
|
||||
WindowEdgeNorthWest, |
|
||||
WindowEdgeNorth, |
|
||||
WindowEdgeNorthEast, |
|
||||
WindowEdgeWest, |
|
||||
WindowEdgeEast, |
|
||||
WindowEdgeSouthWest, |
|
||||
WindowEdgeSouth, |
|
||||
WindowEdgeSouthEast |
|
||||
}; |
|
||||
|
|
||||
enum AvnMenuItemToggleType |
|
||||
{ |
|
||||
None, |
|
||||
CheckMark, |
|
||||
Radio |
|
||||
}; |
|
||||
|
|
||||
enum AvnExtendClientAreaChromeHints |
|
||||
{ |
|
||||
AvnNoChrome = 0, |
|
||||
AvnSystemChrome = 0x01, |
|
||||
AvnPreferSystemChrome = 0x02, |
|
||||
AvnOSXThickTitleBar = 0x08, |
|
||||
AvnDefaultChrome = AvnSystemChrome, |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvaloniaNativeFactory, 01) : IUnknown |
|
||||
{ |
|
||||
public: |
|
||||
virtual HRESULT Initialize(IAvnGCHandleDeallocatorCallback* deallocator) = 0; |
|
||||
virtual IAvnMacOptions* GetMacOptions() = 0; |
|
||||
virtual HRESULT CreateWindow(IAvnWindowEvents* cb, IAvnGlContext* gl, IAvnWindow** ppv) = 0; |
|
||||
virtual HRESULT CreatePopup (IAvnWindowEvents* cb, IAvnGlContext* gl, IAvnPopup** ppv) = 0; |
|
||||
virtual HRESULT CreatePlatformThreadingInterface(IAvnPlatformThreadingInterface** ppv) = 0; |
|
||||
virtual HRESULT CreateSystemDialogs (IAvnSystemDialogs** ppv) = 0; |
|
||||
virtual HRESULT CreateScreens (IAvnScreens** ppv) = 0; |
|
||||
virtual HRESULT CreateClipboard(IAvnClipboard** ppv) = 0; |
|
||||
virtual HRESULT CreateDndClipboard(IAvnClipboard** ppv) = 0; |
|
||||
virtual HRESULT CreateCursorFactory(IAvnCursorFactory** ppv) = 0; |
|
||||
virtual HRESULT ObtainGlDisplay(IAvnGlDisplay** ppv) = 0; |
|
||||
virtual HRESULT SetAppMenu(IAvnMenu* menu) = 0; |
|
||||
virtual HRESULT CreateMenu (IAvnMenuEvents* cb, IAvnMenu** ppv) = 0; |
|
||||
virtual HRESULT CreateMenuItem (IAvnMenuItem** ppv) = 0; |
|
||||
virtual HRESULT CreateMenuItemSeperator (IAvnMenuItem** ppv) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnString, 17) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT Pointer(void**retOut) = 0; |
|
||||
virtual HRESULT Length(int*ret) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnWindowBase, 02) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT Show() = 0; |
|
||||
virtual HRESULT Hide () = 0; |
|
||||
virtual HRESULT Close() = 0; |
|
||||
virtual HRESULT Activate () = 0; |
|
||||
virtual HRESULT GetClientSize(AvnSize*ret) = 0; |
|
||||
virtual HRESULT GetScaling(double*ret)=0; |
|
||||
virtual HRESULT SetMinMaxSize(AvnSize minSize, AvnSize maxSize) = 0; |
|
||||
virtual HRESULT Resize(double width, double height) = 0; |
|
||||
virtual HRESULT Invalidate (AvnRect rect) = 0; |
|
||||
virtual HRESULT BeginMoveDrag () = 0; |
|
||||
virtual HRESULT BeginResizeDrag (AvnWindowEdge edge) = 0; |
|
||||
virtual HRESULT GetPosition (AvnPoint*ret) = 0; |
|
||||
virtual HRESULT SetPosition (AvnPoint point) = 0; |
|
||||
virtual HRESULT PointToClient (AvnPoint point, AvnPoint*ret) = 0; |
|
||||
virtual HRESULT PointToScreen (AvnPoint point, AvnPoint*ret) = 0; |
|
||||
virtual HRESULT ThreadSafeSetSwRenderedFrame(AvnFramebuffer* fb, IUnknown* dispose) = 0; |
|
||||
virtual HRESULT SetTopMost (bool value) = 0; |
|
||||
virtual HRESULT SetCursor(IAvnCursor* cursor) = 0; |
|
||||
virtual HRESULT CreateGlRenderTarget(IAvnGlSurfaceRenderTarget** ret) = 0; |
|
||||
virtual HRESULT SetMainMenu(IAvnMenu* menu) = 0; |
|
||||
virtual HRESULT ObtainNSWindowHandle(void** retOut) = 0; |
|
||||
virtual HRESULT ObtainNSWindowHandleRetained(void** retOut) = 0; |
|
||||
virtual HRESULT ObtainNSViewHandle(void** retOut) = 0; |
|
||||
virtual HRESULT ObtainNSViewHandleRetained(void** retOut) = 0; |
|
||||
virtual HRESULT CreateNativeControlHost(IAvnNativeControlHost** retOut) = 0; |
|
||||
virtual HRESULT BeginDragAndDropOperation(AvnDragDropEffects effects, AvnPoint point, |
|
||||
IAvnClipboard* clipboard, IAvnDndResultCallback* cb, void* sourceHandle) = 0; |
|
||||
virtual HRESULT SetBlurEnabled (bool enable) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnPopup, 03) : virtual IAvnWindowBase |
|
||||
{ |
|
||||
|
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnWindow, 04) : virtual IAvnWindowBase |
|
||||
{ |
|
||||
virtual HRESULT SetEnabled (bool enable) = 0; |
|
||||
virtual HRESULT SetParent (IAvnWindow* parent) = 0; |
|
||||
virtual HRESULT SetCanResize(bool value) = 0; |
|
||||
virtual HRESULT SetDecorations(SystemDecorations value) = 0; |
|
||||
virtual HRESULT SetTitle (void* utf8Title) = 0; |
|
||||
virtual HRESULT SetTitleBarColor (AvnColor color) = 0; |
|
||||
virtual HRESULT SetWindowState(AvnWindowState state) = 0; |
|
||||
virtual HRESULT GetWindowState(AvnWindowState*ret) = 0; |
|
||||
virtual HRESULT TakeFocusFromChildren() = 0; |
|
||||
virtual HRESULT SetExtendClientArea (bool enable) = 0; |
|
||||
virtual HRESULT SetExtendClientAreaHints (AvnExtendClientAreaChromeHints hints) = 0; |
|
||||
virtual HRESULT GetExtendTitleBarHeight (double*ret) = 0; |
|
||||
virtual HRESULT SetExtendTitleBarHeight (double value) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnWindowBaseEvents, 05) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT Paint() = 0; |
|
||||
virtual void Closed() = 0; |
|
||||
virtual void Activated() = 0; |
|
||||
virtual void Deactivated() = 0; |
|
||||
virtual void Resized(const AvnSize& size) = 0; |
|
||||
virtual void PositionChanged (AvnPoint position) = 0; |
|
||||
virtual void RawMouseEvent (AvnRawMouseEventType type, |
|
||||
unsigned int timeStamp, |
|
||||
AvnInputModifiers modifiers, |
|
||||
AvnPoint point, |
|
||||
AvnVector delta) = 0; |
|
||||
virtual bool RawKeyEvent (AvnRawKeyEventType type, unsigned int timeStamp, AvnInputModifiers modifiers, unsigned int key) = 0; |
|
||||
virtual bool RawTextInputEvent (unsigned int timeStamp, const char* text) = 0; |
|
||||
virtual void ScalingChanged(double scaling) = 0; |
|
||||
virtual void RunRenderPriorityJobs() = 0; |
|
||||
virtual void LostFocus() = 0; |
|
||||
virtual AvnDragDropEffects DragEvent(AvnDragEventType type, AvnPoint position, |
|
||||
AvnInputModifiers modifiers, AvnDragDropEffects effects, |
|
||||
IAvnClipboard* clipboard, void* dataObjectHandle) = 0; |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
AVNCOM(IAvnWindowEvents, 06) : IAvnWindowBaseEvents |
|
||||
{ |
|
||||
/**
|
|
||||
* Closing Event |
|
||||
* Called when the user presses the OS window close button. |
|
||||
* return true to allow the close, return false to prevent close. |
|
||||
*/ |
|
||||
virtual bool Closing () = 0; |
|
||||
|
|
||||
virtual void WindowStateChanged (AvnWindowState state) = 0; |
|
||||
|
|
||||
virtual void GotInputWhenDisabled () = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnMacOptions, 07) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT SetShowInDock(int show) = 0; |
|
||||
virtual HRESULT SetApplicationTitle (void* utf8string) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnActionCallback, 08) : IUnknown |
|
||||
{ |
|
||||
virtual void Run() = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnSignaledCallback, 09) : IUnknown |
|
||||
{ |
|
||||
virtual void Signaled(int priority, bool priorityContainsMeaningfulValue) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnLoopCancellation, 0a) : IUnknown |
|
||||
{ |
|
||||
virtual void Cancel() = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnPlatformThreadingInterface, 0b) : IUnknown |
|
||||
{ |
|
||||
virtual bool GetCurrentThreadIsLoopThread() = 0; |
|
||||
virtual void SetSignaledCallback(IAvnSignaledCallback* cb) = 0; |
|
||||
virtual IAvnLoopCancellation* CreateLoopCancellation() = 0; |
|
||||
virtual HRESULT RunLoop(IAvnLoopCancellation* cancel) = 0; |
|
||||
// Can't pass int* to sharpgentools for some reason
|
|
||||
virtual void Signal(int priority) = 0; |
|
||||
virtual IUnknown* StartTimer(int priority, int ms, IAvnActionCallback* callback) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnSystemDialogEvents, 0c) : IUnknown |
|
||||
{ |
|
||||
virtual void OnCompleted (int numResults, void* ptrFirstResult) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnSystemDialogs, 0d) : IUnknown |
|
||||
{ |
|
||||
virtual void SelectFolderDialog (IAvnWindow* parentWindowHandle, |
|
||||
IAvnSystemDialogEvents* events, |
|
||||
const char* title, |
|
||||
const char* initialPath) = 0; |
|
||||
|
|
||||
virtual void OpenFileDialog (IAvnWindow* parentWindowHandle, |
|
||||
IAvnSystemDialogEvents* events, |
|
||||
bool allowMultiple, |
|
||||
const char* title, |
|
||||
const char* initialDirectory, |
|
||||
const char* initialFile, |
|
||||
const char* filters) = 0; |
|
||||
|
|
||||
virtual void SaveFileDialog (IAvnWindow* parentWindowHandle, |
|
||||
IAvnSystemDialogEvents* events, |
|
||||
const char* title, |
|
||||
const char* initialDirectory, |
|
||||
const char* initialFile, |
|
||||
const char* filters) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnScreens, 0e) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT GetScreenCount (int* ret) = 0; |
|
||||
virtual HRESULT GetScreen (int index, AvnScreen* ret) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnClipboard, 0f) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT GetText (char* type, IAvnString**ppv) = 0; |
|
||||
virtual HRESULT SetText (char* type, void* utf8Text) = 0; |
|
||||
virtual HRESULT ObtainFormats(IAvnStringArray**ppv) = 0; |
|
||||
virtual HRESULT GetStrings(char* type, IAvnStringArray**ppv) = 0; |
|
||||
virtual HRESULT SetBytes(char* type, void* utf8Text, int len) = 0; |
|
||||
virtual HRESULT GetBytes(char* type, IAvnString**ppv) = 0; |
|
||||
|
|
||||
virtual HRESULT Clear() = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnCursor, 10) : IUnknown |
|
||||
{ |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnCursorFactory, 11) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT GetCursor (AvnStandardCursorType cursorType, IAvnCursor** retOut) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnGlDisplay, 13) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT CreateContext(IAvnGlContext* share, IAvnGlContext**ppv) = 0; |
|
||||
virtual void LegacyClearCurrentContext() = 0; |
|
||||
virtual HRESULT WrapContext(void* native, IAvnGlContext**ppv) = 0; |
|
||||
virtual void* GetProcAddress(char* proc) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnGlContext, 14) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT MakeCurrent(IUnknown** ppv) = 0; |
|
||||
virtual HRESULT LegacyMakeCurrent() = 0; |
|
||||
virtual int GetSampleCount() = 0; |
|
||||
virtual int GetStencilSize() = 0; |
|
||||
virtual void* GetNativeHandle() = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnGlSurfaceRenderTarget, 15) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT BeginDrawing(IAvnGlSurfaceRenderingSession** ret) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnGlSurfaceRenderingSession, 16) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT GetPixelSize(AvnPixelSize* ret) = 0; |
|
||||
virtual HRESULT GetScaling(double* ret) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnMenu, 17) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT InsertItem (int index, IAvnMenuItem* item) = 0; |
|
||||
virtual HRESULT RemoveItem (IAvnMenuItem* item) = 0; |
|
||||
virtual HRESULT SetTitle (void* utf8String) = 0; |
|
||||
virtual HRESULT Clear () = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnPredicateCallback, 18) : IUnknown |
|
||||
{ |
|
||||
virtual bool Evaluate() = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnMenuItem, 19) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT SetSubMenu (IAvnMenu* menu) = 0; |
|
||||
virtual HRESULT SetTitle (void* utf8String) = 0; |
|
||||
virtual HRESULT SetGesture (void* utf8String, AvnInputModifiers modifiers) = 0; |
|
||||
virtual HRESULT SetAction (IAvnPredicateCallback* predicate, IAvnActionCallback* callback) = 0; |
|
||||
virtual HRESULT SetIsChecked (bool isChecked) = 0; |
|
||||
virtual HRESULT SetToggleType (AvnMenuItemToggleType toggleType) = 0; |
|
||||
virtual HRESULT SetIcon (void* data, size_t length) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnMenuEvents, 1A) : IUnknown |
|
||||
{ |
|
||||
/**
|
|
||||
* NeedsUpdate |
|
||||
*/ |
|
||||
virtual void NeedsUpdate () = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnStringArray, 20) : IUnknown |
|
||||
{ |
|
||||
virtual unsigned int GetCount() = 0; |
|
||||
virtual HRESULT Get(unsigned int index, IAvnString**ppv) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnDndResultCallback, 21) : IUnknown |
|
||||
{ |
|
||||
virtual void OnDragAndDropComplete(AvnDragDropEffects effecct) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnGCHandleDeallocatorCallback, 22) : IUnknown |
|
||||
{ |
|
||||
virtual void FreeGCHandle(void* handle) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnNativeControlHost, 20) : IUnknown |
|
||||
{ |
|
||||
virtual HRESULT CreateDefaultChild(void* parent, void** retOut) = 0; |
|
||||
virtual IAvnNativeControlHostTopLevelAttachment* CreateAttachment() = 0; |
|
||||
virtual void DestroyDefaultChild(void* child) = 0; |
|
||||
}; |
|
||||
|
|
||||
AVNCOM(IAvnNativeControlHostTopLevelAttachment, 21) : IUnknown |
|
||||
{ |
|
||||
virtual void* GetParentHandle() = 0; |
|
||||
virtual HRESULT InitializeWithChildHandle(void* child) = 0; |
|
||||
virtual HRESULT AttachTo(IAvnNativeControlHost* host) = 0; |
|
||||
virtual void ShowInBounds(float x, float y, float width, float height) = 0; |
|
||||
virtual void HideWithSize(float width, float height) = 0; |
|
||||
virtual void ReleaseChild() = 0; |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
extern "C" IAvaloniaNativeFactory* CreateAvaloniaNative(); |
|
||||
File diff suppressed because it is too large
@ -1,9 +1,14 @@ |
|||||
#ifndef keytransform_h |
#ifndef keytransform_h |
||||
#define keytransform_h |
#define keytransform_h |
||||
#include "common.h" |
#include "common.h" |
||||
#include "key.h" |
|
||||
#include <map> |
#include <map> |
||||
|
|
||||
extern std::map<int, AvnKey> s_KeyMap; |
extern std::map<int, AvnKey> s_KeyMap; |
||||
|
|
||||
|
extern std::map<AvnKey, int> s_AvnKeyMap; |
||||
|
|
||||
|
extern std::map<int, const char*> s_QwertyKeyMap; |
||||
|
|
||||
|
extern std::map<AvnKey, int> s_UnicodeKeyMap; |
||||
|
|
||||
#endif |
#endif |
||||
|
|||||
@ -0,0 +1,14 @@ |
|||||
|
using System.IO; |
||||
|
using MicroComGenerator; |
||||
|
using Nuke.Common; |
||||
|
|
||||
|
partial class Build : NukeBuild |
||||
|
{ |
||||
|
Target GenerateCppHeaders => _ => _.Executes(() => |
||||
|
{ |
||||
|
var text = File.ReadAllText(RootDirectory / "src" / "Avalonia.Native" / "avn.idl"); |
||||
|
var ast = AstParser.Parse(text); |
||||
|
File.WriteAllText(RootDirectory / "native" / "Avalonia.Native" / "inc" / "avalonia-native.h", |
||||
|
CppGen.GenerateCpp(ast)); |
||||
|
}); |
||||
|
} |
||||
@ -1,5 +1,5 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ControlCatalog.Android" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"> |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ControlCatalog.Android" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"> |
||||
<uses-sdk /> |
<uses-sdk android:targetSdkVersion="29" /> |
||||
<application android:label="ControlCatalog.Android"></application> |
<application android:label="ControlCatalog.Android"></application> |
||||
</manifest> |
</manifest> |
||||
|
Before Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
|
||||
|
<item> |
||||
|
<color android:color="@color/splash_background"/> |
||||
|
</item> |
||||
|
|
||||
|
<item android:drawable="@drawable/icon" |
||||
|
android:width="120dp" |
||||
|
android:height="120dp" |
||||
|
android:gravity="center" /> |
||||
|
|
||||
|
</layer-list> |
||||
@ -1,13 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||
android:orientation="vertical" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="match_parent" |
|
||||
> |
|
||||
<Button |
|
||||
android:id="@+id/MyButton" |
|
||||
android:layout_width="match_parent" |
|
||||
android:layout_height="wrap_content" |
|
||||
android:text="@string/Hello" |
|
||||
/> |
|
||||
</LinearLayout> |
|
||||
@ -1,5 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<resources> |
|
||||
<string name="Hello">Hello World, Click Me!</string> |
|
||||
<string name="ApplicationName">ControlCatalog.Android</string> |
|
||||
</resources> |
|
||||
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<resources> |
||||
|
<color name="splash_background">#FFFFFF</color> |
||||
|
</resources> |
||||
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<resources> |
||||
|
|
||||
|
<style name="MyTheme"> |
||||
|
</style> |
||||
|
|
||||
|
<style name="MyTheme.NoActionBar"> |
||||
|
<item name="android:windowActionBar">false</item> |
||||
|
<item name="android:windowNoTitle">true</item> |
||||
|
</style> |
||||
|
|
||||
|
<style name="MyTheme.Splash" parent ="MyTheme.NoActionBar"> |
||||
|
<item name="android:windowBackground">@drawable/splash_screen</item> |
||||
|
<item name="android:windowContentOverlay">@null</item> |
||||
|
</style> |
||||
|
|
||||
|
</resources> |
||||
@ -0,0 +1,32 @@ |
|||||
|
using Android.App; |
||||
|
using Android.Content; |
||||
|
using Android.OS; |
||||
|
using Application = Android.App.Application; |
||||
|
|
||||
|
using Avalonia; |
||||
|
|
||||
|
namespace ControlCatalog.Android |
||||
|
{ |
||||
|
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] |
||||
|
public class SplashActivity : Activity |
||||
|
{ |
||||
|
protected override void OnCreate(Bundle savedInstanceState) |
||||
|
{ |
||||
|
base.OnCreate(savedInstanceState); |
||||
|
} |
||||
|
|
||||
|
protected override void OnResume() |
||||
|
{ |
||||
|
base.OnResume(); |
||||
|
|
||||
|
if (Avalonia.Application.Current == null) |
||||
|
{ |
||||
|
AppBuilder.Configure<App>() |
||||
|
.UseAndroid() |
||||
|
.SetupWithoutStarting(); |
||||
|
} |
||||
|
|
||||
|
StartActivity(new Intent(Application.Context, typeof(MainActivity))); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Binary file not shown.
@ -0,0 +1,66 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace MiniMvvm |
||||
|
{ |
||||
|
public sealed class MiniCommand<T> : MiniCommand, ICommand |
||||
|
{ |
||||
|
private readonly Action<T> _cb; |
||||
|
private bool _busy; |
||||
|
private Func<T, Task> _acb; |
||||
|
|
||||
|
public MiniCommand(Action<T> cb) |
||||
|
{ |
||||
|
_cb = cb; |
||||
|
} |
||||
|
|
||||
|
public MiniCommand(Func<T, Task> cb) |
||||
|
{ |
||||
|
_acb = cb; |
||||
|
} |
||||
|
|
||||
|
private bool Busy |
||||
|
{ |
||||
|
get => _busy; |
||||
|
set |
||||
|
{ |
||||
|
_busy = value; |
||||
|
CanExecuteChanged?.Invoke(this, EventArgs.Empty); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public override event EventHandler CanExecuteChanged; |
||||
|
public override bool CanExecute(object parameter) => !_busy; |
||||
|
|
||||
|
public override async void Execute(object parameter) |
||||
|
{ |
||||
|
if(Busy) |
||||
|
return; |
||||
|
try |
||||
|
{ |
||||
|
Busy = true; |
||||
|
if (_cb != null) |
||||
|
_cb((T)parameter); |
||||
|
else |
||||
|
await _acb((T)parameter); |
||||
|
} |
||||
|
finally |
||||
|
{ |
||||
|
Busy = false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public abstract class MiniCommand : ICommand |
||||
|
{ |
||||
|
public static MiniCommand Create(Action cb) => new MiniCommand<object>(_ => cb()); |
||||
|
public static MiniCommand Create<TArg>(Action<TArg> cb) => new MiniCommand<TArg>(cb); |
||||
|
public static MiniCommand CreateFromTask(Func<Task> cb) => new MiniCommand<object>(_ => cb()); |
||||
|
|
||||
|
public abstract bool CanExecute(object parameter); |
||||
|
public abstract void Execute(object parameter); |
||||
|
public abstract event EventHandler CanExecuteChanged; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
</PropertyGroup> |
||||
|
<Import Project="..\..\build\Rx.props" /> |
||||
|
</Project> |
||||
@ -0,0 +1,108 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Reactive.Linq; |
||||
|
using System.Reflection; |
||||
|
|
||||
|
namespace MiniMvvm |
||||
|
{ |
||||
|
public static class PropertyChangedExtensions |
||||
|
{ |
||||
|
class PropertyObservable<T> : IObservable<T> |
||||
|
{ |
||||
|
private readonly INotifyPropertyChanged _target; |
||||
|
private readonly PropertyInfo _info; |
||||
|
|
||||
|
public PropertyObservable(INotifyPropertyChanged target, PropertyInfo info) |
||||
|
{ |
||||
|
_target = target; |
||||
|
_info = info; |
||||
|
} |
||||
|
|
||||
|
class Subscription : IDisposable |
||||
|
{ |
||||
|
private readonly INotifyPropertyChanged _target; |
||||
|
private readonly PropertyInfo _info; |
||||
|
private readonly IObserver<T> _observer; |
||||
|
|
||||
|
public Subscription(INotifyPropertyChanged target, PropertyInfo info, IObserver<T> observer) |
||||
|
{ |
||||
|
_target = target; |
||||
|
_info = info; |
||||
|
_observer = observer; |
||||
|
_target.PropertyChanged += OnPropertyChanged; |
||||
|
_observer.OnNext((T)_info.GetValue(_target)); |
||||
|
} |
||||
|
|
||||
|
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) |
||||
|
{ |
||||
|
if (e.PropertyName == _info.Name) |
||||
|
_observer.OnNext((T)_info.GetValue(_target)); |
||||
|
} |
||||
|
|
||||
|
public void Dispose() |
||||
|
{ |
||||
|
_target.PropertyChanged -= OnPropertyChanged; |
||||
|
_observer.OnCompleted(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public IDisposable Subscribe(IObserver<T> observer) |
||||
|
{ |
||||
|
return new Subscription(_target, _info, observer); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static IObservable<TRes> WhenAnyValue<TModel, TRes>(this TModel model, |
||||
|
Expression<Func<TModel, TRes>> expr) where TModel : INotifyPropertyChanged |
||||
|
{ |
||||
|
var l = (LambdaExpression)expr; |
||||
|
var ma = (MemberExpression)l.Body; |
||||
|
var prop = (PropertyInfo)ma.Member; |
||||
|
return new PropertyObservable<TRes>(model, prop); |
||||
|
} |
||||
|
|
||||
|
public static IObservable<TRes> WhenAnyValue<TModel, T1, TRes>(this TModel model, |
||||
|
Expression<Func<TModel, T1>> v1, |
||||
|
Func<T1, TRes> cb |
||||
|
) where TModel : INotifyPropertyChanged |
||||
|
{ |
||||
|
return model.WhenAnyValue(v1).Select(cb); |
||||
|
} |
||||
|
|
||||
|
public static IObservable<TRes> WhenAnyValue<TModel, T1, T2, TRes>(this TModel model, |
||||
|
Expression<Func<TModel, T1>> v1, |
||||
|
Expression<Func<TModel, T2>> v2, |
||||
|
Func<T1, T2, TRes> cb |
||||
|
) where TModel : INotifyPropertyChanged => |
||||
|
Observable.CombineLatest( |
||||
|
model.WhenAnyValue(v1), |
||||
|
model.WhenAnyValue(v2), |
||||
|
cb); |
||||
|
|
||||
|
public static IObservable<ValueTuple<T1, T2>> WhenAnyValue<TModel, T1, T2>(this TModel model, |
||||
|
Expression<Func<TModel, T1>> v1, |
||||
|
Expression<Func<TModel, T2>> v2 |
||||
|
) where TModel : INotifyPropertyChanged => |
||||
|
model.WhenAnyValue(v1, v2, (a1, a2) => (a1, a2)); |
||||
|
|
||||
|
public static IObservable<TRes> WhenAnyValue<TModel, T1, T2, T3, TRes>(this TModel model, |
||||
|
Expression<Func<TModel, T1>> v1, |
||||
|
Expression<Func<TModel, T2>> v2, |
||||
|
Expression<Func<TModel, T3>> v3, |
||||
|
Func<T1, T2, T3, TRes> cb |
||||
|
) where TModel : INotifyPropertyChanged => |
||||
|
Observable.CombineLatest( |
||||
|
model.WhenAnyValue(v1), |
||||
|
model.WhenAnyValue(v2), |
||||
|
model.WhenAnyValue(v3), |
||||
|
cb); |
||||
|
|
||||
|
public static IObservable<ValueTuple<T1, T2, T3>> WhenAnyValue<TModel, T1, T2, T3>(this TModel model, |
||||
|
Expression<Func<TModel, T1>> v1, |
||||
|
Expression<Func<TModel, T2>> v2, |
||||
|
Expression<Func<TModel, T3>> v3 |
||||
|
) where TModel : INotifyPropertyChanged => |
||||
|
model.WhenAnyValue(v1, v2, v3, (a1, a2, a3) => (a1, a2, a3)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Reactive.Joins; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
|
||||
|
namespace MiniMvvm |
||||
|
{ |
||||
|
public class ViewModelBase : INotifyPropertyChanged |
||||
|
{ |
||||
|
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string propertyName = null) |
||||
|
{ |
||||
|
if (!EqualityComparer<T>.Default.Equals(field, value)) |
||||
|
{ |
||||
|
field = value; |
||||
|
RaisePropertyChanged(propertyName); |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) |
||||
|
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
||||
|
} |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue