Skip to content

Commit 33d7342

Browse files
authored
Merge pull request #335 from AvaloniaUI/updateToRc
Update to Avalonia 11 RC
2 parents 41ed3f1 + 01257d1 commit 33d7342

File tree

8 files changed

+21
-14
lines changed

8 files changed

+21
-14
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<LangVersion>latest</LangVersion>
44
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5-
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
5+
<AvaloniaVersion>11.0.0-rc1.1</AvaloniaVersion>
66
<TextMateSharpVersion>1.0.55</TextMateSharpVersion>
77
<VersionSuffix>beta</VersionSuffix>
88
</PropertyGroup>

src/AvaloniaEdit.Demo/MainWindow.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public MyCompletionData(string text)
347347
Text = text;
348348
}
349349

350-
public IBitmap Image => null;
350+
public Bitmap Image => null;
351351

352352
public string Text { get; }
353353

src/AvaloniaEdit/CodeCompletion/CompletionWindow.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected override void OnKeyDown(KeyEventArgs e)
174174
private void TextArea_PreviewTextInput(object sender, TextInputEventArgs e)
175175
{
176176
e.Handled = RaiseEventPair(this, null, TextInputEvent,
177-
new TextInputEventArgs { Device = e.Device, Text = e.Text });
177+
new TextInputEventArgs { Text = e.Text });
178178
}
179179

180180
private void TextArea_MouseWheel(object sender, PointerWheelEventArgs e)

src/AvaloniaEdit/CodeCompletion/CompletionWindowBase.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ public override void OnPreviewKeyDown(KeyEventArgs e)
218218
if (e.Key == Key.DeadCharProcessed)
219219
return;
220220
e.Handled = RaiseEventPair(Window, null, KeyDownEvent,
221-
new KeyEventArgs { Device = e.Device, Key = e.Key });
221+
new KeyEventArgs { Key = e.Key });
222222
}
223223

224224
public override void OnPreviewKeyUp(KeyEventArgs e)
225225
{
226226
if (e.Key == Key.DeadCharProcessed)
227227
return;
228228
e.Handled = RaiseEventPair(Window, null, KeyUpEvent,
229-
new KeyEventArgs { Device = e.Device, Key = e.Key });
229+
new KeyEventArgs { Key = e.Key });
230230
}
231231
}
232232
#endregion

src/AvaloniaEdit/CodeCompletion/ICompletionData.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface ICompletionData
3535
/// <summary>
3636
/// Gets the image.
3737
/// </summary>
38-
IBitmap Image { get; }
38+
Bitmap Image { get; }
3939

4040
/// <summary>
4141
/// Gets the text. This property is used to filter the list of visible elements.

src/AvaloniaEdit/Editing/CaretNavigationCommandHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static void AddBinding(RoutedCommand command, KeyGesture gesture, EventH
8282

8383
static CaretNavigationCommandHandler()
8484
{
85-
var keymap = AvaloniaLocator.Current.GetService<PlatformHotkeyConfiguration>();
85+
var keymap = Application.Current.PlatformSettings.HotkeyConfiguration;
8686

8787
AddBinding(EditingCommands.MoveLeftByCharacter, KeyModifiers.None, Key.Left, OnMoveCaret(CaretMovementType.CharLeft));
8888
AddBinding(EditingCommands.SelectLeftByCharacter, keymap.SelectionModifiers, Key.Left, OnMoveCaretExtendSelection(CaretMovementType.CharLeft));

src/AvaloniaEdit/RoutedCommand.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Windows.Input;
5-
using Avalonia;
65
using Avalonia.Input;
76
using Avalonia.Interactivity;
87

98
namespace AvaloniaEdit
109
{
1110
public class RoutedCommand : ICommand
1211
{
12+
private static IInputElement _inputElement;
13+
1314
public string Name { get; }
1415
public KeyGesture Gesture { get; }
1516

@@ -23,6 +24,7 @@ static RoutedCommand()
2324
{
2425
CanExecuteEvent.AddClassHandler<Interactive>(CanExecuteEventHandler);
2526
ExecutedEvent.AddClassHandler<Interactive>(ExecutedEventHandler);
27+
InputElement.GotFocusEvent.AddClassHandler<Interactive>(GotFocusEventHandler);
2628
}
2729

2830
private static void CanExecuteEventHandler(Interactive control, CanExecuteRoutedEventArgs args)
@@ -46,6 +48,11 @@ private static void ExecutedEventHandler(Interactive control, ExecutedRoutedEven
4648
}
4749
}
4850

51+
private static void GotFocusEventHandler(Interactive control, GotFocusEventArgs args)
52+
{
53+
_inputElement = control as IInputElement;
54+
}
55+
4956
public static RoutedEvent<CanExecuteRoutedEventArgs> CanExecuteEvent { get; } = RoutedEvent.Register<CanExecuteRoutedEventArgs>(nameof(CanExecuteEvent), RoutingStrategies.Bubble, typeof(RoutedCommand));
5057

5158
public bool CanExecute(object parameter, IInputElement target)
@@ -60,7 +67,7 @@ public bool CanExecute(object parameter, IInputElement target)
6067

6168
bool ICommand.CanExecute(object parameter)
6269
{
63-
return CanExecute(parameter, Application.Current.FocusManager.Current);
70+
return CanExecute(parameter, _inputElement);
6471
}
6572

6673
public static RoutedEvent<ExecutedRoutedEventArgs> ExecutedEvent { get; } = RoutedEvent.Register<ExecutedRoutedEventArgs>(nameof(ExecutedEvent), RoutingStrategies.Bubble, typeof(RoutedCommand));
@@ -75,7 +82,7 @@ public void Execute(object parameter, IInputElement target)
7582

7683
void ICommand.Execute(object parameter)
7784
{
78-
Execute(parameter, Application.Current.FocusManager.Current);
85+
Execute(parameter, _inputElement);
7986
}
8087

8188
// TODO

test/AvaloniaEdit.Tests/AvaloniaEdit.Tests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Avalonia" Version="11.0.999-cibuild0034510-beta" />
9-
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.999-cibuild0034510-beta" />
10-
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.999-cibuild0034510-beta" />
11-
<PackageReference Include="Avalonia.Headless.NUnit" Version="11.0.999-cibuild0034510-beta" />
8+
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
9+
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
10+
<PackageReference Include="Avalonia.Themes.Simple" Version="$(AvaloniaVersion)" />
11+
<PackageReference Include="Avalonia.Headless.NUnit" Version="$(AvaloniaVersion)" />
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
1313
<PackageReference Include="Moq" Version="4.18.4" />
1414
<PackageReference Include="NUnit" Version="3.13.2" />

0 commit comments

Comments
 (0)