Skip to content

Commit 66c16c6

Browse files
HakoyuHakoyu
authored andcommitted
修复 右键菜单无法使用的问题
1 parent 6a0b442 commit 66c16c6

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

App.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
OKButtonContent="{x:Static I18n:MessageBoxXI18nRes.OK}"
2323
YesButtonContent="{x:Static I18n:MessageBoxXI18nRes.YES}">
2424
<pu:MessageBoxXSettings.WindowXStyle>
25-
<Style BasedOn="{StaticResource {ComponentResourceKey ResourceId=WindowXStyle, TypeInTargetAssembly={x:Type pu:MessageBoxX}}}" TargetType="pu:WindowX">
25+
<Style BasedOn="{StaticResource {x:Static pu:MessageBoxX.WindowXStyleKey}}" TargetType="pu:WindowX">
2626
<Setter Property="Topmost" Value="True" />
2727
<Setter Property="Width" Value="NaN" />
2828
<Setter Property="Height" Value="NaN" />
@@ -111,7 +111,7 @@
111111
</pu:MessageBoxXSettings>
112112
<pu:PendingBoxSettings x:Key="pendingSettings">
113113
<pu:PendingBoxSettings.WindowStyle>
114-
<Style BasedOn="{StaticResource {x:Static pu:PendingBox.WindowStyle}}" TargetType="Window">
114+
<Style BasedOn="{StaticResource {x:Static pu:PendingBox.WindowStyleKey}}" TargetType="Window">
115115
<Setter Property="Width" Value="NaN" />
116116
<Setter Property="Height" Value="NaN" />
117117
<Setter Property="MinWidth" Value="300" />
@@ -125,7 +125,7 @@
125125
</Style>
126126
</pu:PendingBoxSettings.WindowStyle>
127127
<pu:PendingBoxSettings.SpinStyle>
128-
<Style BasedOn="{StaticResource {x:Static pu:PendingBox.SpinStyle}}" TargetType="pu:Spin">
128+
<Style BasedOn="{StaticResource {x:Static pu:PendingBox.SpinStyleKey}}" TargetType="pu:Spin">
129129
<Setter Property="SpinStyle" Value="Ring2" />
130130
<Setter Property="Width" Value="50" />
131131
<Setter Property="Height" Value="50" />

Libs/HKW/ViewModels/Controls/ItemsCollectionVM.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ public partial class ItemsCollectionVM<T> : ControlVMBase, IList<T>, IEnumerable
1919
private ObservableCollection<T> _itemsSource = null!;
2020

2121
/// <inheritdoc/>
22-
public T this[int index] { get => ItemsSource[index]; set => ItemsSource[index] = value; }
22+
public T this[int index]
23+
{
24+
get => ItemsSource[index];
25+
set => ItemsSource[index] = value;
26+
}
2327

2428
/// <inheritdoc/>
2529
public int Count => ItemsSource.Count;
@@ -56,4 +60,4 @@ public partial class ItemsCollectionVM<T> : ControlVMBase, IList<T>, IEnumerable
5660

5761
/// <inheritdoc/>
5862
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
59-
}
63+
}

Libs/HKW/ViewModels/Controls/MenuItemVM.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public partial class MenuItemVM : HeaderedItemsControlVM<MenuItemVM>
1717
[ObservableProperty]
1818
private bool _isVisible;
1919

20-
[ObservableProperty]
20+
//[ObservableProperty]
2121
//[NotifyCanExecuteChangedFor(nameof(MenuItemCommand))]
2222
//[NotifyCanExecuteChangedFor(nameof(MenuItemAsyncCommand))]
23-
private bool _canExecute;
23+
//private bool _canExecute;
2424

2525
/// <summary>
2626
/// 初始化
@@ -40,8 +40,8 @@ public MenuItemVM(CommandHandler? handler = null)
4040
// CommandEventAsync += handlerAsync;
4141
//}
4242

43-
//[RelayCommand(CanExecute = nameof(CanExecute))]
44-
//private void MenuItem(object parameter) => CommandEvent?.Invoke(parameter);
43+
[RelayCommand]
44+
private void MenuItem(object parameter) => CommandEvent?.Invoke(parameter);
4545

4646
//[RelayCommand(CanExecute = nameof(CanExecute))]
4747
//private async Task MenuItemAsync(object parameter)
@@ -62,14 +62,14 @@ public MenuItemVM(CommandHandler? handler = null)
6262
/// </summary>
6363
public event CommandHandler? CommandEvent;
6464

65-
/// <summary>
66-
/// 异步委托
67-
/// </summary>
68-
/// <param name="parameter">参数</param>
69-
public delegate Task CommandHandlerAsync(object parameter);
65+
///// <summary>
66+
///// 异步委托
67+
///// </summary>
68+
///// <param name="parameter">参数</param>
69+
//public delegate Task CommandHandlerAsync(object parameter);
7070

71-
/// <summary>
72-
/// 异步事件
73-
/// </summary>
74-
public event CommandHandlerAsync? CommandEventAsync;
71+
///// <summary>
72+
///// 异步事件
73+
///// </summary>
74+
//public event CommandHandlerAsync? CommandEventAsync;
7575
}

StarsectorToolbox.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
5+
<TargetFramework>net6.0-windows</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UseWPF>true</UseWPF>
88
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -32,7 +32,6 @@
3232
<IncludeSymbols>False</IncludeSymbols>
3333
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3434
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
35-
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
3635
</PropertyGroup>
3736

3837
<ItemGroup>
@@ -44,9 +43,8 @@
4443
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
4544
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
4645
<PackageReference Include="HKW.TOML" Version="1.1.7" />
47-
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
4846
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
49-
<PackageReference Include="Panuon.WPF.UI" Version="1.1.9.4" />
47+
<PackageReference Include="Panuon.WPF.UI" Version="1.1.10" />
5048
<PackageReference Include="SharpCompress" Version="0.33.0" />
5149
<PackageReference Include="System.Management" Version="7.0.1" />
5250
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />

ThemeResources/ControlStyles.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
</Style>
237237
<Style
238238
x:Key="MenuItemBaseStyle"
239-
BasedOn="{StaticResource {x:Static pu:ContextMenuHelper.MenuItemStyle}}"
239+
BasedOn="{StaticResource {x:Static pu:ContextMenuHelper.MenuItemStyleKey}}"
240240
TargetType="MenuItem">
241241
<Setter Property="Background" Value="{DynamicResource ColorBG}" />
242242
<Setter Property="BorderBrush" Value="{DynamicResource ColorLight3}" />

Views/CrashReporter/CrashReporterWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
WindowStartupLocation="CenterScreen"
1717
mc:Ignorable="d">
1818
<pu:WindowXCaption.CloseButtonStyle>
19-
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyle}}" TargetType="Button">
19+
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}" TargetType="Button">
2020
<Setter Property="Command" Value="{Binding DataContext.CloseCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=pu:WindowX}}" />
2121
</Style>
2222
</pu:WindowXCaption.CloseButtonStyle>

Views/Main/MainWindow.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Windows.Media;
66
using HKW.Libs.Log4Cs;
77
using HKW.ViewModels.Dialogs;
8-
using Microsoft.Toolkit.Uwp.Notifications;
98
using Panuon.WPF.UI;
109
using StarsectorToolbox.ViewModels.Main;
1110
using StarsectorToolbox.Views.CrashReporter;

0 commit comments

Comments
 (0)