Skip to content

Commit

Permalink
Merge pull request #14 from Baka632/231229-AddStoryGlance
Browse files Browse the repository at this point in the history
添加剧情概览界面
  • Loading branch information
Baka632 authored Jan 9, 2024
2 parents bcb5f55 + 8647a2b commit 91b7930
Show file tree
Hide file tree
Showing 33 changed files with 1,490 additions and 403 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# IDE0290: 使用主构造函数
dotnet_diagnostic.IDE0290.severity = silent
1 change: 1 addition & 0 deletions ArknightsStoryText.UWP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArknightsStoryText.UWP", "s
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{19903B95-91D3-4878-8C88-6F23EC5C966D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
LICENSE.txt = LICENSE.txt
Expand Down
16 changes: 9 additions & 7 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace ArknightsStoryText.UWP;
/// </summary>
sealed partial class App : Application
{
public static bool IsGreaterThan18362 => EnvironmentHelper.IsSystemBuildVersionEqualOrGreaterThan(18362);

/// <summary>
/// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,已执行,逻辑上等同于 main() 或 WinMain()。
/// </summary>
Expand All @@ -42,15 +44,15 @@ private async void OnUnhandledException(object sender, Windows.UI.Xaml.Unhandled
{
new AdaptiveText()
{
Text = exception.GetType().Name
Text = exception?.GetType()?.Name
},
new AdaptiveText()
{
Text = exception.Message
Text = exception?.Message
},
new AdaptiveText()
{
Text = exception.StackTrace
Text = exception?.StackTrace
}
}
}
Expand All @@ -71,16 +73,16 @@ private async void OnUnhandledException(object sender, Windows.UI.Xaml.Unhandled
using StreamWriter writer = new(target);
await writer.WriteAsync($"""
[Exception Detail]
{exception.GetType().Name}: {exception.Message}
{exception?.GetType()?.Name}: {exception?.Message}
======
Source: {exception.Source}
HResult: {exception.HResult}
Source: {exception?.Source}
HResult: {exception?.HResult}
TargetSite Info:
Name: {exception?.TargetSite.Name}
Module Name: {exception?.TargetSite?.Module.Name}
DeclaringType: {exception?.TargetSite?.DeclaringType.Name}
StackTrace:
{exception.StackTrace}
{exception?.StackTrace}
""");
await writer.FlushAsync();

Expand Down
32 changes: 30 additions & 2 deletions src/ArknightsStoryText.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<AssemblyName>ArknightsStoryText.UWP</AssemblyName>
<DefaultLanguage>zh-CN</DefaultLanguage>
<LangVersion>latest</LangVersion>
<AnalysisLevel>latest-recommended</AnalysisLevel>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.22000.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
Expand Down Expand Up @@ -130,12 +131,14 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Commands\DelegateCommand.cs" />
<Compile Include="CommonValues.cs" />
<Compile Include="Controls\StoryTextExpander.xaml.cs">
<DependentUpon>StoryTextExpander.xaml</DependentUpon>
</Compile>
<Compile Include="GlobalUsings.cs" />
<Compile Include="Helpers\Converter\ActTypeToStringConverter.cs" />
<Compile Include="Helpers\Converter\ObjectToFontFamilyOrFontSizeConverter.cs" />
<Compile Include="Helpers\EnvironmentHelper.cs" />
<Compile Include="Helpers\FontHelper.cs" />
<Compile Include="Helpers\LocalizationHelper.cs" />
<Compile Include="Helpers\ReswHelper.cs" />
Expand Down Expand Up @@ -172,18 +175,25 @@
<Compile Include="Models\ArknightsResources.Stories.Models\Commands\TextCommand\TextCommand.cs" />
<Compile Include="Models\ArknightsResources.Stories.Models\StoryScene.cs" />
<Compile Include="Models\FontInfo.cs" />
<Compile Include="Models\PivotItemIdentify.cs" />
<Compile Include="Models\StoryFileInfo.cs" />
<Compile Include="Models\StoryGroup.cs" />
<Compile Include="Models\StoryInfo.cs" />
<Compile Include="Models\StoryMetadataInfo.cs" />
<Compile Include="Services\StoryMetadataService.cs" />
<Compile Include="ViewModels\NotificationObject.cs" />
<Compile Include="Models\StoryDataPack.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
<Compile Include="ViewModels\StoryGlanceViewModel.cs" />
<Compile Include="ViewModels\TextMergeViewModel.cs" />
<Compile Include="ViewModels\TextReadViewModel.cs" />
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\StoryReader.cs" />
<Compile Include="Views\StoryGlancePage.xaml.cs">
<DependentUpon>StoryGlancePage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\TextMergePage.xaml.cs">
<DependentUpon>TextMergePage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -268,6 +278,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\StoryGlancePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\TextMergePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -278,6 +292,20 @@
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm">
<Version>8.2.2</Version>
</PackageReference>
<PackageReference Include="IndexRange">
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="IsExternalInit">
<Version>1.0.3</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Macross.Json.Extensions">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
<Version>8.0.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
39 changes: 0 additions & 39 deletions src/Commands/DelegateCommand.cs

This file was deleted.

8 changes: 8 additions & 0 deletions src/CommonValues.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ArknightsStoryText.UWP;

internal static class CommonValues
{
public const string NotifyUpdateStoriesMessageToken = "Notify_UpdateStories_MessageToken";
public const string NotifyUpdateStoryFileInfosMessageToken = "Notify_UpdateStoryFileInfos_MessageToken";
public const string NotifyPivotNavigationMessageToken = "Notify_PivotNavigation_MessageToken";
}
7 changes: 6 additions & 1 deletion src/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
global using System.Threading.Tasks;
global using System.Globalization;
global using System.Collections.ObjectModel;

global using Windows.Storage;
global using Windows.UI;
global using Windows.UI.Xaml;
global using Windows.UI.Xaml.Input;
global using Windows.UI.Xaml.Media;
global using Windows.UI.Xaml.Controls;
global using Windows.UI.Xaml.Controls.Primitives;

global using CommunityToolkit.Mvvm;
global using CommunityToolkit.Mvvm.Input;
global using CommunityToolkit.Mvvm.ComponentModel;

global using ArknightsStoryText.UWP.Views;
global using ArknightsStoryText.UWP.Helpers;
global using ArknightsStoryText.UWP.Commands;
global using ArknightsStoryText.UWP.ViewModels;
global using ArknightsStoryText.UWP.Models;
global using ArknightsResources.Utility;
Expand Down
30 changes: 30 additions & 0 deletions src/Helpers/Converter/ActTypeToStringConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Windows.UI.Xaml.Data;

namespace ArknightsStoryText.UWP.Helpers.Converter;

public sealed class ActTypeToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is ActType actType)
{
return actType switch
{
ActType.MainStory => "MainStory".GetLocalized(),
ActType.Activity => "ActivityStory".GetLocalized(),
ActType.MiniStory => "MiniStory".GetLocalized(),
ActType.Others => "OtherStory".GetLocalized(),
_ => throw new NotImplementedException(),
};
}
else
{
return DependencyProperty.UnsetValue;
}
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
31 changes: 31 additions & 0 deletions src/Helpers/EnvironmentHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Windows.System.Profile;

namespace ArknightsStoryText.UWP.Helpers;

/// <summary>
/// 为确定当前设备环境提供帮助方法的类
/// </summary>
public static class EnvironmentHelper
{
/// <summary>
/// 确定设备是否为 Windows 10 Mobile
/// </summary>
/// <returns>若是 Windows 10 Mobile,则返回 <see langword="true"/>,否则返回 <see langword="false"/></returns>
public static bool IsWindowsMobile => AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile";

/// <summary>
/// 确定设备的 Windows 版本是否为 Windows 11
/// </summary>
/// <returns>若是 Windows 11,则返回 <see langword="true"/>,否则返回 <see langword="false"/></returns>
public static bool IsWindows11 => Environment.OSVersion.Version.Build >= 22000;

/// <summary>
/// 确定设备的 Windows 内部版本号是否大于等于指定的版本号
/// </summary>
/// <param name="buildVersion">内部版本号</param>
/// <returns>若大于等于指定的版本号,则返回 <see langword="true"/>,否则返回 <see langword="false"/></returns>
public static bool IsSystemBuildVersionEqualOrGreaterThan(int buildVersion)
{
return Environment.OSVersion.Version.Build >= buildVersion;
}
}
Loading

0 comments on commit 91b7930

Please sign in to comment.