Browse Source

Merge branch 'feature/onplatform-xaml-compiler-support' of https://github.com/AvaloniaUI/Avalonia into feature/onplatform-xaml-compiler-support

pull/7812/head
Max Katz 4 years ago
parent
commit
9883a9600f
  1. 5
      src/Avalonia.Diagnostics/Diagnostics/Conventions.cs
  2. 7
      src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs
  3. 5
      src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs
  4. 1
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs
  5. 1
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs
  6. 9
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
  7. 14
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs
  8. 1
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs
  9. 10
      src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml
  10. 4
      src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml

5
src/Avalonia.Diagnostics/Diagnostics/Convetions.cs → src/Avalonia.Diagnostics/Diagnostics/Conventions.cs

@ -1,11 +1,8 @@
using System;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.VisualTree;
namespace Avalonia.Diagnostics
{
static class Convetions
internal static class Conventions
{
public static string DefaultScreenshotsRoot =>
System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures, Environment.SpecialFolderOption.Create),

7
src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs

@ -1,5 +1,4 @@
using System;
using Avalonia.Input;
using Avalonia.Input;
namespace Avalonia.Diagnostics
{
@ -36,11 +35,11 @@ namespace Avalonia.Diagnostics
public bool ShowImplementedInterfaces { get; set; } = true;
/// <summary>
/// Allow to customizze SreenshotHandler
/// Allow to customize SreenshotHandler
/// </summary>
/// <remarks>Default handler is <see cref="Screenshots.FilePickerHandler"/></remarks>
public IScreenshotHandler ScreenshotHandler { get; set; }
= Convetions.DefaultScreenshotHandler;
= Conventions.DefaultScreenshotHandler;
/// <summary>
/// Gets or sets whether DevTools should use the dark mode theme

5
src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs

@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Controls;
@ -40,7 +39,7 @@ namespace Avalonia.Diagnostics.Screenshots
/// The default root folder is [Environment.SpecialFolder.MyPictures]/Screenshots.
/// </summary>
public string ScreenshotsRoot { get; }
= Convetions.DefaultScreenshotsRoot;
= Conventions.DefaultScreenshotsRoot;
/// <summary>
/// SaveFilePicker Title

1
src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs

@ -1,6 +1,5 @@
using System;
using Avalonia.Data;
using Avalonia.Media;
namespace Avalonia.Diagnostics.ViewModels
{

1
src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs

@ -1,6 +1,5 @@
using System;
using System.Reflection;
using Avalonia.Media;
namespace Avalonia.Diagnostics.ViewModels
{

9
src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
@ -15,7 +14,7 @@ using Avalonia.VisualTree;
namespace Avalonia.Diagnostics.ViewModels
{
internal class ControlDetailsViewModel : ViewModelBase, IDisposable
internal class ControlDetailsViewModel : ViewModelBase, IDisposable, IClassesChangedListener
{
private readonly IAvaloniaObject _avaloniaObject;
private IDictionary<object, PropertyViewModel[]>? _propertyIndex;
@ -46,7 +45,7 @@ namespace Avalonia.Diagnostics.ViewModels
if (avaloniaObject is StyledElement styledElement)
{
styledElement.Classes.CollectionChanged += OnClassesChanged;
styledElement.Classes.AddListener(this);
var pseudoClassAttributes = styledElement.GetType().GetCustomAttributes<PseudoClassesAttribute>(true);
@ -250,7 +249,7 @@ namespace Avalonia.Diagnostics.ViewModels
if (_avaloniaObject is StyledElement se)
{
se.Classes.CollectionChanged -= OnClassesChanged;
se.Classes.RemoveListener(this);
}
}
@ -325,7 +324,7 @@ namespace Avalonia.Diagnostics.ViewModels
}
}
private void OnClassesChanged(object? sender, NotifyCollectionChangedEventArgs e)
void IClassesChangedListener.Changed()
{
if (!SnapshotStyles)
{

14
src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs

@ -1,13 +1,11 @@
using System;
using System.ComponentModel;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Diagnostics.Models;
using Avalonia.Input;
using Avalonia.Metadata;
using Avalonia.Threading;
using System.Linq;
namespace Avalonia.Diagnostics.ViewModels
{
@ -96,7 +94,9 @@ namespace Avalonia.Diagnostics.ViewModels
changed = false;
}
if (changed)
RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value);
{
RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value);
}
}
}
@ -331,7 +331,7 @@ namespace Avalonia.Diagnostics.ViewModels
private set => RaiseAndSetIfChanged(ref _showImplementedInterfaces , value);
}
public void ToggleShowImplementedInterfaces(object parametr)
public void ToggleShowImplementedInterfaces(object parameter)
{
ShowImplementedInterfaces = !ShowImplementedInterfaces;
if (Content is TreePageViewModel viewModel)
@ -340,15 +340,15 @@ namespace Avalonia.Diagnostics.ViewModels
}
}
public bool ShowDettailsPropertyType
public bool ShowDetailsPropertyType
{
get => _showPropertyType;
private set => RaiseAndSetIfChanged(ref _showPropertyType , value);
}
public void ToggleShowDettailsPropertyType(object paramter)
public void ToggleShowDetailsPropertyType(object parameter)
{
ShowDettailsPropertyType = !ShowDettailsPropertyType;
ShowDetailsPropertyType = !ShowDetailsPropertyType;
}
}
}

1
src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs

@ -6,7 +6,6 @@ using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.LogicalTree;
using Avalonia.Media;
using Avalonia.VisualTree;
namespace Avalonia.Diagnostics.ViewModels
{

10
src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml

@ -19,7 +19,7 @@
<ColumnDefinition Width="Auto"/>
<!--
When selecting the Application node, we need this trick to hide Layout Visualizer
because when using the GridSplitter it sets the Witdth property of ColumnDefinition
because when using the GridSplitter it sets the Width property of ColumnDefinition
(see https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/GridSplitter.cs#L528)
and if we hide the contents of the column, the space is not reclaimed
(see discussion https://github.com/AvaloniaUI/Avalonia/discussions/6773).
@ -62,15 +62,15 @@
<DataGridTextColumn Header="Value" Binding="{Binding Value}" />
<DataGridTextColumn Header="Type" Binding="{Binding Type}"
IsReadOnly="True"
IsVisible="{Binding !$parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
IsVisible="{Binding !$parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
/>
<DataGridTextColumn Header="Assinged Type" Binding="{Binding AssignedType, Converter={StaticResource GetTypeName}}"
<DataGridTextColumn Header="Assigned Type" Binding="{Binding AssignedType, Converter={StaticResource GetTypeName}}"
IsReadOnly="True"
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
/>
<DataGridTextColumn Header="Property Type" Binding="{Binding PropertyType, Converter={StaticResource GetTypeName}}"
IsReadOnly="True"
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
/>
<DataGridTextColumn Header="Priority" Binding="{Binding Priority}" IsReadOnly="True" />
</DataGrid.Columns>

4
src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml

@ -53,10 +53,10 @@
IsEnabled="False" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Split Property Type" Command="{Binding ToggleShowDettailsPropertyType}">
<MenuItem Header="Split Property Type" Command="{Binding ToggleShowDetailsPropertyType}">
<MenuItem.Icon>
<CheckBox BorderThickness="0"
IsChecked="{Binding ShowDettailsPropertyType}"
IsChecked="{Binding ShowDetailsPropertyType}"
IsEnabled="False"/>
</MenuItem.Icon>

Loading…
Cancel
Save