Przeglądaj źródła

Merge branch 'master' into render-inside-win-ui-comp-tree

danwalmsley 5 lat temu
rodzic
commit
c0063da408

+ 1 - 1
samples/BindingDemo/App.xaml.cs

@@ -26,6 +26,6 @@ namespace BindingDemo
           => AppBuilder.Configure<App>()
                 .UsePlatformDetect()
                 .UseReactiveUI()
-                .LogToDebug();
+                .LogToTrace();
     }
 }

+ 1 - 1
samples/ControlCatalog.Desktop/Program.cs

@@ -18,7 +18,7 @@ namespace ControlCatalog
         /// </summary>
         public static AppBuilder BuildAvaloniaApp()
             => AppBuilder.Configure<App>()
-                .LogToDebug()
+                .LogToTrace()
                 .UsePlatformDetect()
                 .UseReactiveUI();
 

+ 1 - 1
samples/ControlCatalog.NetCore/Program.cs

@@ -120,7 +120,7 @@ namespace ControlCatalog.NetCore
                 .UseSkia()
                 .UseReactiveUI()
                 .UseManagedSystemDialogs()
-                .LogToDebug();
+                .LogToTrace();
 
         static void SilenceConsole()
         {

+ 1 - 1
samples/RenderDemo/App.xaml.cs

@@ -33,6 +33,6 @@ namespace RenderDemo
                })
                 .UsePlatformDetect()
                 .UseReactiveUI()
-                .LogToDebug();
+                .LogToTrace();
     }
 }

+ 1 - 1
samples/Sandbox/Program.cs

@@ -10,7 +10,7 @@ namespace Sandbox
             AppBuilder.Configure<App>()
                 .UsePlatformDetect()
                 .UseReactiveUI()
-                .LogToDebug()
+                .LogToTrace()
                 .StartWithClassicDesktopLifetime(args);
         }
     }

+ 1 - 1
samples/VirtualizationDemo/Program.cs

@@ -9,7 +9,7 @@ namespace VirtualizationDemo
             => AppBuilder.Configure<App>()
                 .UsePlatformDetect()
                 .UseReactiveUI()
-                .LogToDebug();
+                .LogToTrace();
 
         public static int Main(string[] args)
             => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);

+ 2 - 1
src/Avalonia.Base/ApiCompatBaseline.txt

@@ -1,3 +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.
-Total Issues: 1
+TypesMustExist : Type 'Avalonia.Logging.DebugLogSink' does not exist in the implementation but it does exist in the contract.
+Total Issues: 2

+ 7 - 7
src/Avalonia.Base/Logging/DebugLogSink.cs → src/Avalonia.Base/Logging/TraceLogSink.cs

@@ -6,12 +6,12 @@ using Avalonia.Utilities;
 
 namespace Avalonia.Logging
 {
-    public class DebugLogSink : ILogSink
+    public class TraceLogSink : ILogSink
     {
         private readonly LogEventLevel _level;
         private readonly IList<string> _areas;
 
-        public DebugLogSink(
+        public TraceLogSink(
             LogEventLevel minimumLevel,
             IList<string> areas = null)
         {
@@ -28,7 +28,7 @@ namespace Avalonia.Logging
         {
             if (IsEnabled(level, area))
             {
-                Debug.WriteLine(Format<object, object, object>(area, messageTemplate, source));
+                Trace.WriteLine(Format<object, object, object>(area, messageTemplate, source));
             }
         }
 
@@ -36,7 +36,7 @@ namespace Avalonia.Logging
         {
             if (IsEnabled(level, area))
             {
-                Debug.WriteLine(Format<T0, object, object>(area, messageTemplate, source, propertyValue0));
+                Trace.WriteLine(Format<T0, object, object>(area, messageTemplate, source, propertyValue0));
             }
         }
 
@@ -44,7 +44,7 @@ namespace Avalonia.Logging
         {
             if (IsEnabled(level, area))
             {
-                Debug.WriteLine(Format<T0, T1, object>(area, messageTemplate, source, propertyValue0, propertyValue1));
+                Trace.WriteLine(Format<T0, T1, object>(area, messageTemplate, source, propertyValue0, propertyValue1));
             }
         }
 
@@ -52,7 +52,7 @@ namespace Avalonia.Logging
         {
             if (IsEnabled(level, area))
             {
-                Debug.WriteLine(Format(area, messageTemplate, source, propertyValue0, propertyValue1, propertyValue2));
+                Trace.WriteLine(Format(area, messageTemplate, source, propertyValue0, propertyValue1, propertyValue2));
             }
         }
 
@@ -60,7 +60,7 @@ namespace Avalonia.Logging
         {
             if (IsEnabled(level, area))
             {
-                Debug.WriteLine(Format(area, messageTemplate, source, propertyValues));
+                Trace.WriteLine(Format(area, messageTemplate, source, propertyValues));
             }
         }
 

+ 13 - 0
src/Avalonia.Controls/ContextMenu.cs

@@ -62,6 +62,12 @@ namespace Avalonia.Controls
         public static readonly StyledProperty<Rect?> PlacementRectProperty =
             AvaloniaProperty.Register<Popup, Rect?>(nameof(PlacementRect));
 
+        /// <summary>
+        /// Defines the <see cref="WindowManagerAddShadowHint"/> property.
+        /// </summary>
+        public static readonly StyledProperty<bool> WindowManagerAddShadowHintProperty  =
+            Popup.WindowManagerAddShadowHintProperty.AddOwner<ContextMenu>();
+
         /// <summary>
         /// Defines the <see cref="PlacementTarget"/> property.
         /// </summary>
@@ -158,6 +164,12 @@ namespace Avalonia.Controls
             set { SetValue(PlacementModeProperty, value); }
         }
 
+        public bool WindowManagerAddShadowHint
+        {
+            get { return GetValue(WindowManagerAddShadowHintProperty); }
+            set { SetValue(WindowManagerAddShadowHintProperty, value); }
+        }
+
         /// <summary>
         /// Gets or sets the the anchor rectangle within the parent that the context menu will be placed
         /// relative to when <see cref="PlacementMode"/> is <see cref="PlacementMode.AnchorAndGravity"/>.
@@ -267,6 +279,7 @@ namespace Avalonia.Controls
                     PlacementTarget = PlacementTarget ?? control,
                     IsLightDismissEnabled = true,
                     OverlayDismissEventPassThrough = true,
+                    WindowManagerAddShadowHint = WindowManagerAddShadowHint,
                 };
 
                 _popup.Opened += PopupOpened;

+ 15 - 4
src/Avalonia.Controls/LoggingExtensions.cs

@@ -1,25 +1,36 @@
-using Avalonia.Controls;
+using System;
+using Avalonia.Controls;
 using Avalonia.Logging;
 
 namespace Avalonia
 {
     public static class LoggingExtensions
     {
+        [Obsolete("Use LogToTrace")]
+        public static T LogToDebug<T>(
+            this T builder,
+            LogEventLevel level = LogEventLevel.Warning,
+            params string[] areas)
+                where T : AppBuilderBase<T>, new()
+        {
+            return LogToTrace(builder, level, areas);
+        }
+
         /// <summary>
-        /// Logs Avalonia events to the <see cref="System.Diagnostics.Debug"/> sink.
+        /// Logs Avalonia events to the <see cref="System.Diagnostics.Trace"/> sink.
         /// </summary>
         /// <typeparam name="T">The application class type.</typeparam>
         /// <param name="builder">The app builder instance.</param>
         /// <param name="level">The minimum level to log.</param>
         /// <param name="areas">The areas to log. Valid values are listed in <see cref="LogArea"/>.</param>
         /// <returns>The app builder instance.</returns>
-        public static T LogToDebug<T>(
+        public static T LogToTrace<T>(
             this T builder,
             LogEventLevel level = LogEventLevel.Warning,
             params string[] areas)
                 where T : AppBuilderBase<T>, new()
         {
-            Logger.Sink = new DebugLogSink(level, areas);
+            Logger.Sink = new TraceLogSink(level, areas);
             return builder;
         }
     }

+ 1 - 0
src/Avalonia.ReactiveUI/Avalonia.ReactiveUI.csproj

@@ -2,6 +2,7 @@
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <PackageId>Avalonia.ReactiveUI</PackageId>
+    <SignAssembly>True</SignAssembly>
   </PropertyGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" />