Коммит
4e48b360d5
|
@ -3,19 +3,12 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>true</IsPackable>
|
||||
<Version>0.10.11-rc.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<LangVersion>latest</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Version>0.10.12</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.12" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
|
@ -11,6 +6,11 @@ using Avalonia.Data;
|
|||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Avalonia.Markup.Declarative;
|
||||
|
||||
|
@ -21,14 +21,14 @@ public static partial class ControlExtensions
|
|||
setAction();
|
||||
return control;
|
||||
}
|
||||
|
||||
|
||||
public static TControl _setEx<TControl>(this TControl control, AvaloniaProperty destProperty, string sourcePropertyPathString, Action setAction,
|
||||
BindingMode? bindingMode, IValueConverter converter, object bindingSource)
|
||||
where TControl : AvaloniaObject
|
||||
{
|
||||
if (sourcePropertyPathString == null
|
||||
|| sourcePropertyPathString.StartsWith("@")
|
||||
|| bindingMode.HasValue
|
||||
if (sourcePropertyPathString == null
|
||||
|| sourcePropertyPathString.StartsWith("@")
|
||||
|| bindingMode.HasValue
|
||||
|| bindingSource != default)
|
||||
{
|
||||
//var path = sourcePropertyPathString.TrimStart('@');
|
||||
|
@ -153,7 +153,7 @@ public static partial class ControlExtensions
|
|||
public static TItemsControl Items<TItemsControl>(this TItemsControl container, params Control[] items)
|
||||
where TItemsControl : ItemsControl
|
||||
{
|
||||
if(container.Items is IList itemsCollection)
|
||||
if (container.Items is IList itemsCollection)
|
||||
foreach (var item in items)
|
||||
itemsCollection.Add(item);
|
||||
return container;
|
||||
|
@ -178,7 +178,7 @@ public static partial class ControlExtensions
|
|||
control.Styles.Add(style);
|
||||
return control;
|
||||
}
|
||||
|
||||
|
||||
public static TElement Classes<TElement>(this TElement control, string className, [CallerLineNumber] int line = 0, [CallerMemberName] string caller = default)
|
||||
where TElement : Control
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ public static partial class ControlExtensions
|
|||
public static TElement AddItem<TElement>(this TElement menuFlyout, string text, ICommand command, object commandParameter = null)
|
||||
where TElement : MenuFlyout
|
||||
{
|
||||
var item = new MenuItem() {Header = text, Command = command};
|
||||
var item = new MenuItem() { Header = text, Command = command };
|
||||
if (commandParameter != null)
|
||||
item.CommandParameter = commandParameter;
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Avalonia.Markup.Declarative;
|
||||
|
||||
public class GenerateMarkupExtensionsAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
|
@ -2,13 +2,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Avalonia.Markup.Declarative;
|
||||
|
||||
public static class HotReloadManager
|
||||
{
|
||||
private static readonly Dictionary<Type, HashSet<IReloadable>> _instances = new();
|
||||
|
||||
public static event Action<Type[]?> HotReloaded;
|
||||
public static event Action<Type[]?>? HotReloaded;
|
||||
|
||||
private static void OnHotReloaded(Type[]? types) => HotReloaded?.Invoke(types);
|
||||
|
||||
|
@ -20,21 +22,23 @@ public static class HotReloadManager
|
|||
public static void UpdateApplication(Type[]? types)
|
||||
{
|
||||
Console.WriteLine("UpdateApplication for types: " + PrintTypes(types));
|
||||
|
||||
foreach (var type in types)
|
||||
if (types != null)
|
||||
{
|
||||
if (!_instances.TryGetValue(type, out var instances)) continue;
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (!_instances.TryGetValue(type, out var instances)) continue;
|
||||
|
||||
foreach (var instance in instances)
|
||||
instance.Reload();
|
||||
foreach (var instance in instances)
|
||||
instance.Reload();
|
||||
}
|
||||
|
||||
OnHotReloaded(types);
|
||||
}
|
||||
|
||||
OnHotReloaded(types);
|
||||
}
|
||||
|
||||
public static string PrintTypes(Type[]? types)
|
||||
{
|
||||
if(types != null)
|
||||
if (types != null)
|
||||
{
|
||||
return string.Join(", ", types.Select(t => t.Name));
|
||||
}
|
||||
|
@ -58,7 +62,7 @@ public static class HotReloadManager
|
|||
var type = instance.GetType();
|
||||
if (!_instances.TryGetValue(type, out var instances)) return;
|
||||
|
||||
if(instances.Contains(instance))
|
||||
if (instances.Contains(instance))
|
||||
instances.Remove(instance);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Avalonia.Markup.Declarative;
|
||||
|
||||
public class ParameterAttribute: Attribute{}
|
|
@ -8,7 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.12" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,18 +2,11 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<LangVersion>latest</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.12" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче