committed by
GitHub
260 changed files with 2651 additions and 1955 deletions
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="System.Reactive" Version="4.4.1" /> |
|||
<PackageReference Include="System.Reactive" Version="5.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
File diff suppressed because it is too large
@ -1,9 +1,14 @@ |
|||
#ifndef keytransform_h |
|||
#define keytransform_h |
|||
#include "common.h" |
|||
#include "key.h" |
|||
#include <map> |
|||
|
|||
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 |
|||
|
|||
@ -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)); |
|||
} |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
Compat issues with assembly Avalonia.Base: |
|||
CannotAddAbstractMembers : Member 'protected System.IObservable<Avalonia.AvaloniaPropertyChangedEventArgs> Avalonia.AvaloniaProperty.GetChanged()' is abstract in the implementation but is missing in the contract. |
|||
TypesMustExist : Type 'Avalonia.Logging.DebugLogSink' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Threading.AvaloniaSynchronizationContext..ctor(Avalonia.Threading.AvaloniaSynchronizationContext.INonPumpingPlatformWaitProvider)' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Threading.AvaloniaSynchronizationContext.INonPumpingPlatformWaitProvider' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 2 |
|||
|
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
|
|||
namespace Avalonia.Utilities |
|||
{ |
|||
public class NonPumpingLockHelper |
|||
{ |
|||
public interface IHelperImpl |
|||
{ |
|||
IDisposable Use(); |
|||
} |
|||
|
|||
public static IDisposable Use() => AvaloniaLocator.Current.GetService<IHelperImpl>()?.Use(); |
|||
} |
|||
} |
|||
@ -1,5 +1 @@ |
|||
Compat issues with assembly Avalonia.Controls.DataGrid: |
|||
MembersMustExist : Member 'public Avalonia.StyledProperty<System.String> Avalonia.StyledProperty<System.String> Avalonia.Controls.DataGridTextColumn.FontFamilyProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public System.String Avalonia.Controls.DataGridTextColumn.FontFamily.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.DataGridTextColumn.FontFamily.set(System.String)' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 3 |
|||
Total Issues: 0 |
|||
|
|||
@ -1,26 +1,5 @@ |
|||
Compat issues with assembly Avalonia.Controls: |
|||
TypesMustExist : Type 'Avalonia.Controls.IndexPath' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Controls.ISelectedItemInfo' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Controls.ISelectionModel' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.DirectProperty<Avalonia.Controls.Primitives.SelectingItemsControl, Avalonia.Controls.ISelectionModel> Avalonia.DirectProperty<Avalonia.Controls.Primitives.SelectingItemsControl, Avalonia.Controls.ISelectionModel> Avalonia.Controls.ListBox.SelectionProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Controls.ISelectionModel Avalonia.Controls.ListBox.Selection.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.ListBox.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Controls.SelectionModel' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Controls.SelectionModelChildrenRequestedEventArgs' does not exist in the implementation but it does exist in the contract. |
|||
TypesMustExist : Type 'Avalonia.Controls.SelectionModelSelectionChangedEventArgs' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.StyledProperty<Avalonia.Controls.IControl> Avalonia.StyledProperty<Avalonia.Controls.IControl> Avalonia.Controls.SplitView.ContentProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.StyledProperty<Avalonia.Controls.IControl> Avalonia.StyledProperty<Avalonia.Controls.IControl> Avalonia.Controls.SplitView.PaneProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Controls.IControl Avalonia.Controls.SplitView.Content.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.SplitView.Content.set(Avalonia.Controls.IControl)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Controls.IControl Avalonia.Controls.SplitView.Pane.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.SplitView.Pane.set(Avalonia.Controls.IControl)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.DirectProperty<Avalonia.Controls.TreeView, Avalonia.Controls.ISelectionModel> Avalonia.DirectProperty<Avalonia.Controls.TreeView, Avalonia.Controls.ISelectionModel> Avalonia.Controls.TreeView.SelectionProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Interactivity.RoutedEvent<Avalonia.Controls.SelectionChangedEventArgs> Avalonia.Interactivity.RoutedEvent<Avalonia.Controls.SelectionChangedEventArgs> Avalonia.Controls.TreeView.SelectionChangedEvent' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Controls.ISelectionModel Avalonia.Controls.TreeView.Selection.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Controls.TreeView.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public System.String[] Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.Args' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public System.String[] Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.Args.get()' is present in the implementation but not in the contract. |
|||
MembersMustExist : Member 'public Avalonia.DirectProperty<Avalonia.Controls.Primitives.SelectingItemsControl, Avalonia.Controls.ISelectionModel> Avalonia.DirectProperty<Avalonia.Controls.Primitives.SelectingItemsControl, Avalonia.Controls.ISelectionModel> Avalonia.Controls.Primitives.SelectingItemsControl.SelectionProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'protected Avalonia.Controls.ISelectionModel Avalonia.Controls.Primitives.SelectingItemsControl.Selection.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'protected void Avalonia.Controls.Primitives.SelectingItemsControl.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 24 |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IWindowBaseImpl.Show()' is present in the contract but not in the implementation. |
|||
MembersMustExist : Member 'public void Avalonia.Platform.IWindowBaseImpl.Show()' does not exist in the implementation but it does exist in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IWindowBaseImpl.Show(System.Boolean)' is present in the implementation but not in the contract. |
|||
Total Issues: 3 |
|||
|
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue