Skip to content

Commit

Permalink
在 OOBE 和关于页面中标明发行通道
Browse files Browse the repository at this point in the history
  • Loading branch information
natsurainko committed Dec 27, 2024
1 parent 98a5e42 commit f1b0708
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 13 deletions.
8 changes: 8 additions & 0 deletions Natsurainko.FluentLauncher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ public partial class App : Application

public static Windows.ApplicationModel.PackageVersion Version => Windows.ApplicationModel.Package.Current.Id.Version;

#if FLUENT_LAUNCHER_DEV_CHANNEL
public static string AppChannel => "Dev";
#elif FLUENT_LAUNCHER_PREVIEW_CHANNEL
public static string AppChannel => "Preview";
#elif FLUENT_LAUNCHER_STABLE_CHANNEL
public static string AppChannel => "Stable";
#endif

public App()
{
InitializeComponent();
Expand Down
2 changes: 2 additions & 0 deletions Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public void NavigateTo(int pageIndex)

public string Version => App.Version.GetVersionString();

public string Channel => App.AppChannel.ToUpper();

#if DEBUG
public string Edition { get; } = ResourceUtils.GetValue("Settings", "AboutPage", "_Debug");
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ internal partial class AboutViewModel : ObservableObject
private string edition = ResourceUtils.GetValue("Settings", "AboutPage", "_Release");
#endif

public string Channel => App.AppChannel.ToUpper();

[RelayCommand]
public async Task CheckUpdate()
=> await Launcher.LaunchUriAsync(new Uri("ms-windows-store://pdp/?productid=9P4NQQXQ942P"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public DefaultViewModel(SettingsService settingsService, INavigationService navi
private string edition = ResourceUtils.GetValue("Settings", "AboutPage", "_Release");
#endif

public string Channel => App.AppChannel.ToUpper();

partial void OnCurrentLanguageChanged(string oldValue, string newValue)
{
if (Languages.Contains(CurrentLanguage) && oldValue is not null) // oldValue is null at startup
Expand Down
25 changes: 20 additions & 5 deletions Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,25 @@
Grid.Column="1"
Margin="16,0,0,0"
VerticalAlignment="Center">
<TextBlock FontSize="18" Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
<StackPanel
Margin="2,0,0,0"
Orientation="Horizontal"
Spacing="5">
<TextBlock VerticalAlignment="Center" Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
<Border
Padding="5,0"
VerticalAlignment="Center"
Background="{ThemeResource SystemAccentColor}"
CornerRadius="4">
<TextBlock
FontWeight="SemiBold"
Foreground="White"
Text="{Binding Channel}" />
</Border>
</StackPanel>
<TextBlock
Margin="0,-7.5,0,0"
FontSize="36"
Expand All @@ -57,7 +72,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
<RowDefinition Height="25" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<TextBlock
Expand Down
21 changes: 17 additions & 4 deletions Natsurainko.FluentLauncher/Views/Settings/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,23 @@
IsClickEnabled="True" />
</controls:SettingsExpander.Items>

<TextBlock Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}" Style="{ThemeResource CaptionTextBlockStyle}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
<StackPanel>
<Border
Padding="5,0"
HorizontalAlignment="Right"
Background="{ThemeResource SystemAccentColor}"
CornerRadius="2">
<TextBlock
FontWeight="SemiBold"
Foreground="White"
Style="{ThemeResource CaptionTextBlockStyle}"
Text="{Binding Channel}" />
</Border>
<TextBlock Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}" Style="{ThemeResource CaptionTextBlockStyle}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
</StackPanel>
</controls:SettingsExpander>

<controls:SettingsCard
Expand Down
21 changes: 17 additions & 4 deletions Natsurainko.FluentLauncher/Views/Settings/DefaultPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,23 @@
<ImageIcon Source="ms-appx:///Assets/AppIcon.png" />
</controls:SettingsCard.HeaderIcon>

<TextBlock Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}" Style="{ThemeResource CaptionTextBlockStyle}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
<StackPanel>
<Border
Padding="5,0"
HorizontalAlignment="Right"
Background="{ThemeResource SystemAccentColor}"
CornerRadius="2">
<TextBlock
FontWeight="SemiBold"
Foreground="White"
Style="{ThemeResource CaptionTextBlockStyle}"
Text="{Binding Channel}" />
</Border>
<TextBlock Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}" Style="{ThemeResource CaptionTextBlockStyle}">
<Run Text="{Binding Edition}" />
<Run Text="{Binding Version}" />
</TextBlock>
</StackPanel>
</controls:SettingsCard>
</StackPanel>
</Border>
Expand Down

0 comments on commit f1b0708

Please sign in to comment.