Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions Source/Examples/Avalonia/AvaloniaExamples/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Serilog;
using OxyPlot.Avalonia;

namespace AvaloniaExamples
Expand Down Expand Up @@ -33,9 +31,11 @@ public override void OnFrameworkInitializationCompleted()
static void Main(string[] args)
{
OxyPlotModule.EnsureLoaded();
InitializeLogging();
AppBuilder.Configure<App>()
.UsePlatformDetect()
#if DEBUG
.LogToDebug()
#endif
.StartWithClassicDesktopLifetime(args);
}

Expand All @@ -45,15 +45,5 @@ public static void AttachDevTools(Window window)
DevToolsExtensions.AttachDevTools(window);
#endif
}

private static void InitializeLogging()
{
#if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration()
.MinimumLevel.Warning()
.WriteTo.Trace(outputTemplate: "{Area}: {Message}")
.CreateLogger());
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="11.0.0" />
<ProjectReference Include="..\..\..\OxyPlot.Avalonia\OxyPlot.Avalonia.csproj" />
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.3" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Source/Examples/Avalonia/ExampleBrowser/ExampleBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.9.3" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.3" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
<PackageReference Include="OxyPlot.Core" Version="2.0.0" />
<PackageReference Include="OxyPlot.ExampleLibrary" Version="2.0.0" />
</ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions Source/Examples/Avalonia/ExampleBrowser/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Logging.Serilog;
using Avalonia;

namespace ExampleBrowser
{
Expand Down
16 changes: 3 additions & 13 deletions Source/Examples/Avalonia/MemoryTest/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
using Serilog;
using OxyPlot.Avalonia;

namespace MemoryTest
Expand Down Expand Up @@ -33,26 +31,18 @@ public override void OnFrameworkInitializationCompleted()
static void Main(string[] args)
{
OxyPlotModule.EnsureLoaded();
InitializeLogging();
AppBuilder.Configure<App>()
.UsePlatformDetect()
#if DEBUG
.LogToDebug()
#endif
.StartWithClassicDesktopLifetime(args);
}

public static void AttachDevTools(Window window)
{
#if DEBUG
DevToolsExtensions.AttachDevTools(window);
#endif
}

private static void InitializeLogging()
{
#if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration()
.MinimumLevel.Warning()
.WriteTo.Trace(outputTemplate: "{Area}: {Message}")
.CreateLogger());
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Examples/Avalonia/MemoryTest/MemoryTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="11.0.0" />
<ProjectReference Include="..\..\..\OxyPlot.Avalonia\OxyPlot.Avalonia.csproj" />
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.3" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/Examples/Avalonia/SimpleDemo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MainWindow : Window
public MainWindow()
{
InitializeComponent();
DevToolsExtensions.AttachDevTools(this);
this.AttachDevTools();
}

private void InitializeComponent()
Expand Down
3 changes: 2 additions & 1 deletion Source/Examples/Avalonia/SimpleDemo/SimpleDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageReference Include="JetBrains.Annotations" Version="11.0.0" />
<ProjectReference Include="..\..\..\OxyPlot.Avalonia\OxyPlot.Avalonia.csproj" />
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.3" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/OxyPlot.Avalonia/Axes/Axis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ protected void OnDataChanged()
/// The on property changed handler.
/// </summary>
/// <param name="e">The event args.</param>
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> e)
{
base.OnPropertyChanged(e);
if (e.Property.OwnerType == GetType())
Expand Down
14 changes: 3 additions & 11 deletions Source/OxyPlot.Avalonia/Axes/LinearColorAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ public class LinearColorAxis : Axis
/// <summary>
/// Identifies the <see cref="PaletteSizeProperty"/> dependency property.
/// </summary>
public static readonly StyledProperty<int> PaletteSizeProperty = AvaloniaProperty.Register<LinearColorAxis, int>(nameof(PaletteSize), 20, validate: (obj, val) =>
{
if (!ValidatePaletteSize(val))
{
throw new System.ArgumentException();
}

return val;
});
public static readonly StyledProperty<int> PaletteSizeProperty = AvaloniaProperty.Register<LinearColorAxis, int>(nameof(PaletteSize), 20, validate: ValidatePaletteSize);

/// <summary>
/// Initializes a new instance of the <see cref="LinearColorAxis"/> class.
Expand Down Expand Up @@ -209,9 +201,9 @@ private static OxyPalette Interpolate(List<GradientStop> stops, int paletteSize)
/// <returns>
/// The validation result.
/// </returns>
private static bool ValidatePaletteSize(object value)
private static bool ValidatePaletteSize(int value)
{
return (int)value >= 1;
return value >= 1;
}

static LinearColorAxis()
Expand Down
2 changes: 1 addition & 1 deletion Source/OxyPlot.Avalonia/OxyPlot.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.xaml;Assets\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<PackageReference Include="Avalonia" Version="0.9.3" />
<PackageReference Include="Avalonia" Version="0.10.0-preview1" />
<PackageReference Include="OxyPlot.Core" Version="2.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/OxyPlot.Avalonia/PlotBase.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override void OnKeyDown(KeyEventArgs e)
return;
}

var args = new OxyKeyEventArgs { ModifierKeys = e.Modifiers.ToModifierKeys(), Key = e.Key.Convert() };
var args = new OxyKeyEventArgs { ModifierKeys = e.KeyModifiers.ToModifierKeys(), Key = e.Key.Convert() };
e.Handled = ActualController.HandleKeyDown(this, args);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/OxyPlot.Avalonia/PlotBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ public void InvalidatePlot(bool updateData = true)
/// just before a UI element displays in an application. For more information, see Remarks.
/// </summary>
/// <param name="e">Event data for applying the template.</param>
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnTemplateApplied(e);
base.OnApplyTemplate(e);
panel = e.NameScope.Find(PartPanel) as Panel;
if (panel == null)
{
Expand Down
10 changes: 1 addition & 9 deletions Source/OxyPlot.Avalonia/Series/HeatMapSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ public class HeatMapSeries : XYAxisSeries
/// <summary>
/// Identifies this <see cref="DataProperty"/> dependency property.
/// </summary>
public static readonly StyledProperty<double[,]> DataProperty = AvaloniaProperty.Register<HeatMapSeries, double[,]>(nameof(Data), new double[0, 0], validate: (obj, val) =>
{
if (val == null)
{
throw new System.ArgumentException();
}

return val;
});
public static readonly StyledProperty<double[,]> DataProperty = AvaloniaProperty.Register<HeatMapSeries, double[,]>(nameof(Data), new double[0, 0], validate: val => val != null);

/// <summary>
/// Identifies this <see cref="X0Property"/> dependency property.
Expand Down
4 changes: 2 additions & 2 deletions Source/OxyPlot.Avalonia/Tracker/TrackerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ public ScreenPoint Position
}
}

protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnTemplateApplied(e);
base.OnApplyTemplate(e);
path = e.NameScope.Get<Path>(PartPath);
content = e.NameScope.Get<ContentPresenter>(PartContent);
contentContainer = e.NameScope.Get<Panel>(PartContentContainer);
Expand Down
16 changes: 8 additions & 8 deletions Source/OxyPlot.Avalonia/Utilities/ConverterExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,25 +372,25 @@ public static OxyMouseButton Convert(this MouseButton button)
}
}

public static OxyModifierKeys ToModifierKeys(this InputModifiers modifiers)
public static OxyModifierKeys ToModifierKeys(this KeyModifiers modifiers)
{
var modifierKeys = OxyModifierKeys.None;
if ((modifiers & InputModifiers.Shift) != 0)
if ((modifiers & KeyModifiers.Shift) != 0)
{
modifierKeys |= OxyModifierKeys.Shift;
}

if ((modifiers & InputModifiers.Control) != 0)
if ((modifiers & KeyModifiers.Control) != 0)
{
modifierKeys |= OxyModifierKeys.Control;
}

if ((modifiers & InputModifiers.Alt) != 0)
if ((modifiers & KeyModifiers.Alt) != 0)
{
modifierKeys |= OxyModifierKeys.Alt;
}

if ((modifiers & InputModifiers.Windows) != 0)
if ((modifiers & KeyModifiers.Meta) != 0)
{
modifierKeys |= OxyModifierKeys.Windows;
}
Expand Down Expand Up @@ -427,7 +427,7 @@ public static OxyMouseDownEventArgs ToMouseDownEventArgs(this PointerPressedEven
ChangedButton = e.MouseButton.Convert(),
ClickCount = e.ClickCount,
Position = e.GetPosition(relativeTo).ToScreenPoint(),
ModifierKeys = e.InputModifiers.ToModifierKeys()
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}

Expand All @@ -442,7 +442,7 @@ public static OxyMouseEventArgs ToMouseReleasedEventArgs(this PointerReleasedEve
return new OxyMouseEventArgs
{
Position = e.GetPosition(relativeTo).ToScreenPoint(),
ModifierKeys = e.InputModifiers.ToModifierKeys()
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}

Expand All @@ -457,7 +457,7 @@ public static OxyMouseEventArgs ToMouseEventArgs(this PointerEventArgs e, IInput
return new OxyMouseEventArgs
{
Position = e.GetPosition(relativeTo).ToScreenPoint(),
ModifierKeys = e.InputModifiers.ToModifierKeys()
ModifierKeys = e.KeyModifiers.ToModifierKeys()
};
}

Expand Down