Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IviriusMain committed Aug 23, 2024
1 parent 1db9fdf commit 4e36356
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 11 deletions.
9 changes: 9 additions & 0 deletions ReboundHub/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ protected async override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventA
m_window = null;
return;
}
if (string.Join(" ", Environment.GetCommandLineArgs().Skip(1)).Contains("UNINSTALL"))
{
var win = new UninstallationWindow();
win.Show();
await Task.Delay(10);
win.BringToFront();
m_window = null;
return;
}
else
{
m_window = new MainWindow();
Expand Down
8 changes: 4 additions & 4 deletions ReboundHub/ControlPanelWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ public void RunMaximization()
this.Maximize();
RootFrame.Focus(FocusState.Programmatic);
CheckMaximization();
closeWidth = 48;
additionalHeight = 6;
CaptionButtons.Margin = new Thickness(0, 0, 2, 0);
return;
}
Expand All @@ -659,8 +657,6 @@ public void RunMaximization()
this.Restore();
RootFrame.Focus(FocusState.Programmatic);
CheckMaximization();
closeWidth = 46;
additionalHeight = 0;
CaptionButtons.Margin = new Thickness(0);
return;
}
Expand All @@ -676,13 +672,17 @@ public async void CheckMaximization()
MaxResGlyph.Glyph = "";
await Task.Delay(10);
VisualStateManager.GoToState(CrimsonMaxRes, "Normal", true);
closeWidth = 46;
additionalHeight = 0;
return;
}
else if (state == OverlappedPresenterState.Maximized)
{
MaxResGlyph.Glyph = "";
await Task.Delay(10);
VisualStateManager.GoToState(CrimsonMaxRes, "Normal", true);
closeWidth = 48;
additionalHeight = 6;
return;
}
}
Expand Down
6 changes: 6 additions & 0 deletions ReboundHub/ReboundHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<None Remove="ReboundHub\UserControls\HomePageHeaderImage.xaml" />
<None Remove="RegionBlock.xaml" />
<None Remove="UACWindow.xaml" />
<None Remove="UninstallationWindow.xaml" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -265,6 +266,11 @@
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Page Update="UninstallationWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="ReboundHub\UserControls\HomePageHeaderImage.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
2 changes: 1 addition & 1 deletion ReboundHub/ReboundHub/Pages/Rebound11Page.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
<TextBlock Text="Rebound 11 is installed." FontWeight="SemiBold" FontSize="20" Margin="110, 20, 0, 0"/>
<TextBlock Text="v0.0.1 ALPHA" Opacity="0.5" Margin="110, 45, 0, 0"/>
<StackPanel VerticalAlignment="Top" Margin="0, 30, 0, 0" Orientation="Horizontal" Spacing="8" HorizontalAlignment="Right">
<Button HorizontalAlignment="Right">
<Button HorizontalAlignment="Right" Click="Button_Click_2">
<StackPanel Spacing="10" Orientation="Horizontal">
<Image Width="16" Source="/Assets/AppIcons/imageres_78.ico" x:Name="Admin5"/>
<TextBlock Text="Uninstall"/>
Expand Down
36 changes: 30 additions & 6 deletions ReboundHub/ReboundHub/Pages/Rebound11Page.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,23 @@ public Rebound11Page()

public async void GetWallpaper()
{
if (this.ActualTheme == ElementTheme.Light)
try
{
BKGImage.Path = "/Assets/Backgrounds/BackgroundLight.png";
if (this.ActualTheme == ElementTheme.Light)
{
BKGImage.Path = "/Assets/Backgrounds/BackgroundLight.png";
}
if (this.ActualTheme == ElementTheme.Dark)
{
BKGImage.Path = "/Assets/Backgrounds/BackgroundDark.png";
}
await Task.Delay(100);
GetWallpaper();
}
if (this.ActualTheme == ElementTheme.Dark)
catch
{
BKGImage.Path = "/Assets/Backgrounds/BackgroundDark.png";

}
await Task.Delay(100);
GetWallpaper();
}

public bool IsAdmin()
Expand Down Expand Up @@ -109,4 +116,21 @@ private async void Button_Click_1(object sender, RoutedEventArgs e)
await process.WaitForExitAsync();
App.m_window.Close();
}

private async void Button_Click_2(object sender, RoutedEventArgs e)
{
var info = new ProcessStartInfo()
{
FileName = "powershell.exe",
UseShellExecute = false,
CreateNoWindow = true,
Verb = "runas",
Arguments = @$"Start-Process ""shell:AppsFolder\d6ef5e04-e9da-4e22-9782-8031af8beae7_yejd587sfa94t!App"" -ArgumentList ""UNINSTALL"" -Verb RunAs"
};
var process = Process.Start(info);

// Wait for the process to exit before proceeding
await process.WaitForExitAsync();
App.m_window.Close();
}
}
27 changes: 27 additions & 0 deletions ReboundHub/UninstallationWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<winuiex:WindowEx
x:Class="ReboundHub.UninstallationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ReboundHub"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winuiex="using:WinUIEx"
mc:Ignorable="d">

<Grid Background="Black" RequestedTheme="Dark">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="15">
<ProgressRing x:Name="Ring" IsIndeterminate="True" Width="50" Height="50" Foreground="White"/>
<TextBlock x:Name="Title" Foreground="White" Text="Uninstalling Rebound 11: 7%" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center"/>
<TextBlock x:Name="Subtitle" Foreground="White" IsTextSelectionEnabled="True" Text="Step 1 of 23: Uninstalling Rebound Defragment and Optimize Drives." FontSize="16" FontWeight="Bold" HorizontalAlignment="Center"/>
<StackPanel Orientation="Horizontal" Spacing="15" x:Name="Buttons" Visibility="Collapsed" HorizontalAlignment="Center" Margin="20">
<Button Content="Restart now" Click="Button_Click" Width="150"/>
<Button Content="Restart later" Click="Button_Click_1" Width="150"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="135" VerticalAlignment="Bottom" Spacing="15" Orientation="Horizontal" HorizontalAlignment="Center" x:Name="ProgressBars">
<ProgressBar Width="250" x:Name="ReboundProgress" Foreground="White"/>
</StackPanel>
<TextBlock x:Name="Description" Foreground="White" FontWeight="Bold" Text="Please do not turn off your computer. Rebound 11 is modifying essential files.&#x0a;You can revert all changes after the installation." HorizontalTextAlignment="Center" TextWrapping="WrapWholeWords" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="35"/>
</Grid>
</winuiex:WindowEx>
77 changes: 77 additions & 0 deletions ReboundHub/UninstallationWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using WinUIEx;
using static ReboundHub.InstallationWindow;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace ReboundHub;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class UninstallationWindow : WindowEx
{
public UninstallationWindow()
{
this.InitializeComponent();
this.MoveAndResize(0, 0, 0, 0);
Load();
}

public async void Load()
{

}

private void Timer_Tick(object sender, object e)
{
ExplorerManager.StopExplorer();
}

DispatcherTimer timer = new DispatcherTimer();

private async void Button_Click(object sender, RoutedEventArgs e)
{
Ring.Visibility = Visibility.Visible;
Title.Text = "Restarting...";
Subtitle.Visibility = Visibility.Collapsed;
Description.Visibility = Visibility.Collapsed;
Buttons.Visibility = Visibility.Collapsed;

await Task.Delay(3000);

timer.Stop();
ExplorerManager.StartExplorer();
RestartPC();
}

private async void Button_Click_1(object sender, RoutedEventArgs e)
{
timer.Stop();
ExplorerManager.StartExplorer();
Ring.Visibility = Visibility.Visible;
Title.Text = "Restarting Explorer...";
Subtitle.Visibility = Visibility.Collapsed;
Description.Visibility = Visibility.Collapsed;
Buttons.Visibility = Visibility.Collapsed;

await Task.Delay(3000);

SystemLock.Lock();
Close();
}
}

0 comments on commit 4e36356

Please sign in to comment.