返回提交历史
Modified
SpaceEngineersBlueprintEditor/Implements/Services/NavigationViewService.cs
+6
-1
Modified
SpaceEngineersBlueprintEditor/Interface/Services/INavigationViewService.cs
+1
-0
Modified
SpaceEngineersBlueprintEditor/Model/BlueprintInfo.cs
+1
-1
Modified
SpaceEngineersBlueprintEditor/SpaceEngineersBlueprintEditor.csproj
+2
-3
Modified
SpaceEngineersBlueprintEditor/Views/AppShellPage.xaml
+1
-1
Modified
SpaceEngineersBlueprintEditor/Views/AppShellPage.xaml.cs
+5
-1
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintDetailPage.xaml
+6
-1
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintDetailPage.xaml.cs
+10
-1
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintEditPage.xaml.cs
+1
-1
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintsViewPage.xaml
+3
-3
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintsViewPage.xaml.cs
+30
-5
SpaceEngineersModDev/SpaceEngineersBlueprintEditorInWinUI
添加细节页面的连接动画,修复Header不显示的bug
1e98600
代码差异
11 个文件
+66
-18
@@ -10,10 +10,13 @@ internal class NavigationViewService : GlobalServiceBase, INavigationViewService
10
10
{
11
11
private NavigationView? navigationView;
12
12
private readonly AutoNavigationService navigationService = new();
13
private string? header;
13
14
public IAutoNavigationService NavigationService => navigationService;
14
15
15
16
public object? SelectedItem => navigationView?.SelectedItem;
16
17
18
public string? Header { get => header; set => header = value; }
19
17
20
[MemberNotNull(nameof(navigationView))]
18
21
public void Initialize(NavigationView view, Frame frame)
19
22
{
@@ -43,13 +46,15 @@ internal class NavigationViewService : GlobalServiceBase, INavigationViewService
43
46
}
44
47
45
48
public NavigationViewItem? GetSelectedItem(Type type, object? parameter = null) => navigationView is null ? null : GetSelectedItem(navigationView.MenuItems, navigationView.FooterMenuItems, type, parameter);
46
private NavigationViewItem? GetSelectedItem(IEnumerable<object> menuItems, IEnumerable<object> footerMenuItems, Type pageType, object? parameter)
49
50
private static NavigationViewItem? GetSelectedItem(IEnumerable<object> menuItems, IEnumerable<object> footerMenuItems, Type pageType, object? parameter)
47
51
{
48
52
var footerResult = GetSelectedItem(footerMenuItems, pageType, parameter);
49
53
if (footerResult is null)
50
54
return GetSelectedItem(menuItems, pageType, parameter);
51
55
return footerResult;
52
56
}
57
53
58
private static NavigationViewItem? GetSelectedItem(IEnumerable<object> menuItems, Type pageType, object? parameter)
54
59
{
55
60
foreach (var item in menuItems.OfType<NavigationViewItem>())
@@ -5,5 +5,6 @@ public interface INavigationViewService : IAutoNavigable
5
5
IAutoNavigationService NavigationService { get; }
6
6
void Initialize(NavigationView navigationView, Frame frame);
7
7
object? SelectedItem { get; }
8
string? Header { get; set; }
8
9
NavigationViewItem? GetSelectedItem(Type type, object? parameter = null);
9
10
}
@@ -8,4 +8,4 @@ public class BlueprintInfo(string imagePath, bool hasBlueprint, bool hasImage, s
8
8
public string Name { get; set; } = name;
9
9
public string FileSize { get; set; } = fileSize;
10
10
public string BlueprintPath { get; set; } = blueprintPath;
11
}
11
}
@@ -12,9 +12,8 @@
12
12
<UseWinUI>true</UseWinUI>
13
13
<EnableMsixTooling>true</EnableMsixTooling>
14
14
<Nullable>enable</Nullable>
15
<WindowsSdkPackageVersion>10.0.19041.39</WindowsSdkPackageVersion>
16
<!--<WindowsPackageType>None</WindowsPackageType>-->
17
<!--<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>-->
15
<WindowsPackageType>None</WindowsPackageType>
16
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
18
17
<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>
19
18
<ImplicitUsings>enable</ImplicitUsings>
20
19
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@@ -18,7 +18,7 @@
18
18
</Grid.TranslationTransition>
19
19
<StackPanel x:Name="messageStackPanel" Margin="0,5,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"/>
20
20
</Grid>
21
<NavigationView x:Name="navigationView" IsBackButtonVisible="Visible" Canvas.ZIndex="0" IsBackEnabled="{x:Bind ViewModel.CanGoBack, Mode=OneWay}" Header="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}" IsSettingsVisible="False" DisplayModeChanged="NavigationView_DisplayModeChanged" PaneOpening="NavigationView_PaneOpening" PaneOpened="NavigationView_PaneOpened" PaneClosing="NavigationView_PaneClosing" PaneClosed="NavigationView_PaneClosed">
21
<NavigationView x:Name="navigationView" IsBackButtonVisible="Visible" Canvas.ZIndex="0" IsBackEnabled="{x:Bind ViewModel.CanGoBack, Mode=OneWay}" Header="{x:Bind ((ContentControl)navigationView.SelectedItem).Content, Mode=OneWay}" IsSettingsVisible="False" DisplayModeChanged="NavigationView_DisplayModeChanged" PaneOpening="NavigationView_PaneOpening" PaneOpened="NavigationView_PaneOpened" PaneClosing="NavigationView_PaneClosing" PaneClosed="NavigationView_PaneClosed">
22
22
<NavigationView.MenuItems>
23
23
<NavigationViewItem x:Uid="AppShell_ShellItem_MainPage" add:NavigationAddition.NavigateTo="SpaceEngineersBlueprintEditor.Views.MainPage">
24
24
<NavigationViewItem.Icon>
@@ -31,7 +31,11 @@ public sealed partial class AppShellPage : Page
31
31
};
32
32
}
33
33
34
private void Page_Loaded(object sender, RoutedEventArgs e) => AppThemeHelper.ChangeTheme(SystemProfile.Theme);
34
private void Page_Loaded(object sender, RoutedEventArgs e)
35
{
36
ViewModel.MessageService.ShowMessage("��Ϸ���弯������...", "���ڼ���");
37
AppThemeHelper.ChangeTheme(SystemProfile.Theme);
38
}
35
39
36
40
private void NavigationView_PaneOpening(NavigationView sender, object args)
37
41
{
@@ -9,6 +9,11 @@
9
9
mc:Ignorable="d">
10
10
11
11
<Grid>
12
12
<ScrollView>
13
<StackPanel>
14
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}"/>
15
<Image x:Name="detailPreviewImage" Source="{x:Bind Parameter.BlueprintImage}" Width="350" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top"/>
16
</StackPanel>
17
</ScrollView>
13
18
</Grid>
14
19
</Page>
@@ -1,3 +1,4 @@
1
using Microsoft.UI.Xaml.Media.Animation;
1
2
using Microsoft.UI.Xaml.Navigation;
2
3
using SpaceEngineersBlueprintEditor.Model;
3
4
using SpaceEngineersBlueprintEditor.Utilities;
@@ -21,11 +22,19 @@ public sealed partial class BlueprintDetailPage : Page
21
22
22
23
protected override void OnNavigatedTo(NavigationEventArgs e)
23
24
{
24
base.OnNavigatedFrom(e);
25
base.OnNavigatedTo(e);
25
26
if (e.Parameter is BlueprintInfoViewData parameter)
26
27
{
28
ConnectedAnimationService.GetForCurrentView().GetAnimation("ForwardConnectedAnimation")?.TryStart(detailPreviewImage, []);
27
29
Parameter = parameter;
28
30
ViewModel.NavigationParameterService.OnParameterChange(Parameter);
29
31
}
30
32
}
33
34
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
35
{
36
base.OnNavigatingFrom(e);
37
if (e.SourcePageType == typeof(BlueprintsViewPage))
38
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("BackConnectedAnimation", detailPreviewImage);
39
}
31
40
}
@@ -22,7 +22,7 @@ public sealed partial class BlueprintEditPage : Page
22
22
23
23
protected override void OnNavigatedTo(NavigationEventArgs e)
24
24
{
25
base.OnNavigatedFrom(e);
25
base.OnNavigatedTo(e);
26
26
if (e.Parameter is BlueprintInfoViewData parameter)
27
27
{
28
28
Parameter = parameter;
@@ -15,7 +15,7 @@
15
15
<AppBarButton.Flyout>
16
16
<Flyout>
17
17
<StackPanel>
18
<TextBox Text="" PlaceholderText="Enter the new blueprint name" SelectedText=""/>
18
<TextBox Text="" PlaceholderText="Enter the new blueprint name"/>
19
19
<Button Content="Copy"/>
20
20
</StackPanel>
21
21
</Flyout>
@@ -26,10 +26,10 @@
26
26
</Page.Resources>
27
27
28
28
<Grid>
29
<GridView x:Name="blueprintGridView" ItemsSource="{x:Bind ViewModel.BlueprintInfoViewDataList}" SelectionMode="None" IsItemClickEnabled="True" IsRightTapEnabled="True" RightTapped="GridView_RightTapped" ItemClick="GridView_ItemClick">
29
<GridView x:Name="blueprintGridView" ItemsSource="{x:Bind ViewModel.BlueprintInfoViewDataList}" SelectionMode="None" IsItemClickEnabled="True" IsRightTapEnabled="True" ItemClick="GridView_ItemClick" Loaded="BlueprintGridView_Loaded">
30
30
<GridView.ItemTemplate>
31
31
<DataTemplate x:DataType="model:BlueprintInfoViewData">
32
<Grid Width="280" ToolTipService.ToolTip="{x:Bind Name}">
32
<Grid Width="280" ToolTipService.ToolTip="{x:Bind Name}" RightTapped="GridView_RightTapped">
33
33
<Rectangle Opacity="0.5" Fill="{ThemeResource AcrylicInAppFillColorDefaultBrush}"/>
34
34
<Image x:Name="connectedElement" Grid.RowSpan="2" Source="{x:Bind BlueprintImage,FallbackValue='/Assets/Images/BlueprintDrag.png'}" Stretch="Uniform" VerticalAlignment="Top"/>
35
35
<StackPanel Visibility="{x:Bind NoBlueprint}" Opacity="0.5" Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}">
@@ -1,6 +1,9 @@
1
using Microsoft.UI.Xaml.Media.Animation;
1
2
using Microsoft.UI.Xaml.Navigation;
3
using SpaceEngineersBlueprintEditor.Model;
2
4
using SpaceEngineersBlueprintEditor.Utilities;
3
5
using SpaceEngineersBlueprintEditor.ViewModels;
6
using Windows.Foundation.Metadata;
4
7
5
8
namespace SpaceEngineersBlueprintEditor.Views;
6
9
@@ -10,10 +13,10 @@ namespace SpaceEngineersBlueprintEditor.Views;
10
13
public sealed partial class BlueprintsViewPage : Page
11
14
{
12
15
public string? Parameter { get; set; }
13
16
public BlueprintInfoViewData? CurrentBlueprintInfoViewData { get; set; }
14
17
public BlueprintsViewPageViewModel ViewModel { get; set; } = new();
18
public static BlueprintsViewPage? Current { get; set; }
15
19
16
public BlueprintsViewPage? Current { get; set; }
17
20
public BlueprintsViewPage()
18
21
{
19
22
PageManager.AddOrUpdateCurrentPage(Current = this);
@@ -23,8 +26,8 @@ public sealed partial class BlueprintsViewPage : Page
23
26
24
27
protected override void OnNavigatedTo(NavigationEventArgs e)
25
28
{
26
base.OnNavigatedFrom(e);
27
if (e.Parameter is string parameter)
29
base.OnNavigatedTo(e);
30
if (e.Parameter is string parameter && parameter != Parameter)
28
31
{
29
32
Parameter = parameter;
30
33
ViewModel.NavigationParameterService.OnParameterChange(Parameter);
@@ -33,14 +36,36 @@ public sealed partial class BlueprintsViewPage : Page
33
36
34
37
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
35
38
{
36
if (blueprintGridView.ContainerFromItem(e.ClickedItem) is GridViewItem container)
39
if (e.ClickedItem is BlueprintInfoViewData blueprintInfoViewData)
37
40
{
41
CurrentBlueprintInfoViewData = blueprintInfoViewData;
38
42
blueprintGridView.PrepareConnectedAnimation("ForwardConnectedAnimation", e.ClickedItem, "connectedElement");
43
Frame.Navigate(typeof(BlueprintDetailPage), e.ClickedItem, new SuppressNavigationTransitionInfo());
39
44
}
40
45
}
41
46
42
47
private void GridView_RightTapped(object sender, Microsoft.UI.Xaml.Input.RightTappedRoutedEventArgs e)
43
48
{
49
if (sender is Grid grid && grid.DataContext is BlueprintInfoViewData blueprintInfoViewData)
50
{
51
CurrentBlueprintInfoViewData = blueprintInfoViewData;
52
commandBarFlyout.ShowAt(grid);
53
}
54
}
44
55
56
private async void BlueprintGridView_Loaded(object sender, RoutedEventArgs e)
57
{
58
if (CurrentBlueprintInfoViewData is not null)
59
{
60
blueprintGridView.ScrollIntoView(CurrentBlueprintInfoViewData, ScrollIntoViewAlignment.Default);
61
blueprintGridView.UpdateLayout();
62
var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("BackConnectedAnimation");
63
if (animation is not null && ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
64
{
65
animation.Configuration = new DirectConnectedAnimationConfiguration();
66
await blueprintGridView.TryStartConnectedAnimationAsync(animation, CurrentBlueprintInfoViewData, "connectedElement");
67
}
68
blueprintGridView.Focus(FocusState.Programmatic);
69
}
45
70
}
46
71
}