Skip to content

Commit

Permalink
Update Rebound about
Browse files Browse the repository at this point in the history
  • Loading branch information
IviriusMain committed Jan 1, 2025
1 parent 9c3687e commit baf3c55
Show file tree
Hide file tree
Showing 87 changed files with 1,035 additions and 556 deletions.
26 changes: 0 additions & 26 deletions About/App.xaml.cs

This file was deleted.

File renamed without changes.
74 changes: 74 additions & 0 deletions About/App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.Diagnostics;
using Microsoft.UI.Xaml;
using Rebound.Helpers.Services;
using WinUIEx;

#nullable enable

namespace Rebound.About;

public partial class App : Application
{
public static WindowEx? MainWindow { get; set; }

private SingleInstanceAppService SingleInstanceAppService { get; set; }

public App()
{
InitializeComponent();
SingleInstanceAppService = new SingleInstanceAppService("ReboundAbout");
SingleInstanceAppService.Launched += SingleInstanceApp_Launched;
Current.UnhandledException += App_UnhandledException;
AddTasksToTaskbar();
}

public static async void AddTasksToTaskbar()
{
// Get the app's jump list.
var jumpList = await Windows.UI.StartScreen.JumpList.LoadCurrentAsync();

// Disable the system-managed jump list group.
jumpList.SystemGroupKind = Windows.UI.StartScreen.JumpListSystemGroupKind.None;

// Remove any previously added custom jump list items.
jumpList.Items.Clear();

var item = Windows.UI.StartScreen.JumpListItem.CreateWithArguments("legacy", "Legacy winver");
item.Logo = new Uri("ms-appx:///Assets/imageres_61.ico");

jumpList.Items.Add(item);

// Save the changes to the app's jump list.
await jumpList.SaveAsync();
}

// Override default app launch
protected override void OnLaunched(LaunchActivatedEventArgs args) => SingleInstanceAppService?.Launch(args.Arguments);

// Handle any unhandled exceptions
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) => e.Handled = true;

private void SingleInstanceApp_Launched(object? sender, SingleInstanceLaunchEventArgs e)
{
if (e.Arguments == "legacy")
{
_ = Process.Start("winver");
Process.GetCurrentProcess().Kill();
return;
}

if (e.IsFirstLaunch)
{
MainWindow = new MainWindow();
MainWindow.Activate();
}

else
{
MainWindow?.BringToFront();
}

return;
}
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added About/App/Assets/imageres_61.ico
Binary file not shown.
96 changes: 96 additions & 0 deletions About/App/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System.Linq;
using System.Management;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Win32;
using Rebound.Helpers.Environment;
using Windows.ApplicationModel.DataTransfer;

namespace Rebound.About;

public partial class MainViewModel : ObservableObject
{
[ObservableProperty]
public partial string WindowsVersionTitle { get; set; } = GetWMIValue("Caption").Replace("Microsoft ", "");

[ObservableProperty]
public partial string WindowsVersionName { get; set; } = GetWMIValue("Caption").Contains("10") ? "Windows 10" : "Windows 11";

[ObservableProperty]
public partial string DetailedWindowsVersion { get; set; } = GetDetailedWindowsVersion();

[ObservableProperty]
public partial string CurrentUserName { get; set; } = GetCurrentUserName();

public const string WMI_WIN32OPERATINGSYSTEM = "SELECT * FROM Win32_OperatingSystem";

[RelayCommand]
public void CopyDetails()
{
var content =

$@"{WindowsVersionTitle}
{DetailedWindowsVersion}
Licensed to: {CurrentUserName.Replace("\n", ", ")}
Rebound 11
{ReboundVersion.REBOUND_VERSION}";

var package = new DataPackage();
package.SetText(content);
Clipboard.SetContent(package);
}

private static string GetCurrentUserName()
{
// Open the registry key
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
if (key != null)
{
// Retrieve current username
var owner = key.GetValue("RegisteredOwner", "Unknown") as string;
var owner2 = key.GetValue("RegisteredOrganization", "Unknown") as string;

return owner + (string.IsNullOrEmpty(owner2) ? string.Empty : ("\n" + owner2));
}
return "Unknown license holders";
}

private static string GetDetailedWindowsVersion()
{
// Open the registry key
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
if (key != null)
{
// Retrieve build number and revision
var versionName = key.GetValue("DisplayVersion", "Unknown") as string;
var buildNumber = key.GetValue("CurrentBuildNumber", "Unknown") as string;
var buildLab = key.GetValue("UBR", "Unknown");

return $"Version {versionName} (OS Build {buildNumber}.{buildLab})";
}
return "Unknown version";
}

public string GetInformation()
=> $"The {
// Simplified name for Windows without the Microsoft branding
GetWMIValue("Caption").Replace("Microsoft ", "")
} operating system and its user interface are protected by trademark and other pending or existing intellectual property rights in the United States and other countries/regions.";

private static string GetWMIValue(string value) =>
// Query WMI
new ManagementObjectSearcher(WMI_WIN32OPERATINGSYSTEM)

// Obtain collection
.Get()

// Cast to ManagementObject
.Cast<ManagementObject>()

// Get the first object available
.First()

// Obtain the required value
[value].ToString();
}
154 changes: 154 additions & 0 deletions About/App/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8" ?>
<winuiex:WindowEx
x:Class="Rebound.About.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Rebound.About"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winuiex="using:WinUIEx"
xmlns:environment="using:Rebound.Helpers.Environment"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="16"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="16"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel
Margin="32"
x:Name="WinverPanel"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="24"
Grid.Row="0">
<Path VerticalAlignment="Center" Data="M 0 6 C 0 3 3 0 6 0 L 36 0 L 36 36 L 0 36 M 40 0 L 70 0 C 73 0 76 3 76 6 L 76 36 L 40 36 M 36 40 L 0 40 L 0 70 C 0 73 3 76 6 76 L 36 76 M 40 40 L 76 40 L 76 70 C 76 73 73 76 70 76 L 40 76">
<Path.Fill>
<LinearGradientBrush StartPoint="0, 0" EndPoint="1, 1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#a8f4ff" />
<GradientStop Offset="1" Color="#0073d5" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Path.Fill>
</Path>
<TextBlock
x:Name="WindowsVer"
VerticalAlignment="Center"
FontFamily="Segoe UI Semibold"
FontSize="60"
FontWeight="SemiBold"
Text="{x:Bind ViewModel.WindowsVersionName}"/>
</StackPanel>
<Border
Margin="16, 0"
Background="{ThemeResource CardBackgroundFillColorDefault}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
CornerRadius="4"
BorderThickness="1"
Grid.Row="1">
<Grid Padding="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<FontIcon Glyph="&#xF167;" FontSize="16" VerticalAlignment="Top" Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"/>
<StackPanel Spacing="10" Grid.Column="2">
<TextBlock
Text="Microsoft Windows"
TextWrapping="WrapWholeWords"
FontWeight="SemiBold"
Margin="0, -3, 0, 8"/>
<TextBlock TextWrapping="WrapWholeWords" Text="{x:Bind ViewModel.DetailedWindowsVersion}"/>
<TextBlock Text="Copyright ©️ Microsoft Corporation. All rights reserved." />
<TextBlock
x:Name="LegalStuff"
Text="The Windows 11 Pro operating system and its user interface are protected by trademark and other pending or existing intellectual property rights in the United States and other countries/regions."
TextWrapping="WrapWholeWords" />
<TextBlock>
<Run Text="This product is licensed under the" />
<Hyperlink NavigateUri="https://support.microsoft.com/en-us/windows/microsoft-software-license-terms-e26eedad-97a2-5250-2670-aad156b654bd">
<Run Text="Microsoft Software License Terms" />
</Hyperlink>
<Run Text="to:" />
</TextBlock>
<TextBlock x:Name="User" Text="Le" />
</StackPanel>
<Button Grid.Column="2" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Padding="8" Margin="-8">
<FontIcon Glyph="&#xE8C8;" FontSize="16"/>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Copy Windows version"/>
<MenuFlyoutItem Text="Copy license owners"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</Grid>
</Border>
<Border
Margin="16, 0"
Background="{ThemeResource CardBackgroundFillColorDefault}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
CornerRadius="4"
BorderThickness="1"
Grid.Row="3">
<Grid Padding="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<FontIcon Glyph="&#xF167;" FontSize="16" VerticalAlignment="Top" Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"/>
<StackPanel Spacing="10" Grid.Column="2">
<TextBlock
Text="Rebound"
TextWrapping="WrapWholeWords"
FontWeight="SemiBold"
Margin="0, -3, 0, 8"/>
<TextBlock>
<Run Text="{x:Bind environment:ReboundVersion.REBOUND_VERSION, Mode=OneWay}" />
<Run Text="- Rebound About" />
<Run Text="{x:Bind environment:ReboundVersion.REBOUND_ABOUT_VERSION, Mode=OneWay}" />
</TextBlock>
<TextBlock Text="Rebound is a Windows mod that does not interfere with the system. The current Windows installation contains additional apps to run Rebound." TextWrapping="WrapWholeWords" />
</StackPanel>
<Button Grid.Column="2" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Padding="8" Margin="-8">
<FontIcon Glyph="&#xE8C8;" FontSize="16"/>
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Copy Rebound version"/>
<MenuFlyoutItem Text="Copy app version"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</Grid>
</Border>
<Border
Grid.Row="5"
Height="75"
VerticalAlignment="Bottom"
Background="{ThemeResource SystemControlBackgroundAltMediumLowBrush}" />
<Grid Grid.Row="5" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
Style="{ThemeResource AccentButtonStyle}"
Grid.Column="4"
Margin="0,20,20,20"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Click="Button_Click_1"
Content="OK" />
</Grid>
</Grid>
</winuiex:WindowEx>
Loading

0 comments on commit baf3c55

Please sign in to comment.