Skip to content

Commit 58ab3b1

Browse files
committed
New Setup page for selecting redirect or removal
1 parent 1844601 commit 58ab3b1

File tree

10 files changed

+173
-51
lines changed

10 files changed

+173
-51
lines changed

GoAwayEdge/Common/Configuration.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.IO;
1+
using System.IO;
22
using System.IO.Pipes;
33
using System.Windows;
44
using GoAwayEdge.Common.Debugging;
@@ -42,6 +42,7 @@ internal class Configuration
4242
public static EdgeChannel Channel { get; set; }
4343
public static SearchEngine Search { get; set; }
4444
public static AiProvider Provider { get; set; }
45+
public static bool LicenseAccepted { get; set; }
4546
public static bool Uninstall { get; set; }
4647
public static bool UninstallEdge { get; set; }
4748
public static bool NoEdgeInstalled { get; set; }

GoAwayEdge/GoAwayEdge.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
<Resource Include="Localization\ResourceDictionary.xaml" />
5656
</ItemGroup>
5757
<ItemGroup>
58-
<PackageReference Include="ManagedShell" Version="0.0.260" />
58+
<PackageReference Include="ManagedShell" Version="0.0.264" />
5959
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
60-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2651.64" />
61-
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
60+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2849.39" />
61+
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
6262
<PackageReference Include="TaskScheduler" Version="2.11.0" />
6363
<PackageReference Include="WPF-UI" Version="3.0.5" />
6464
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@@ -70,5 +70,8 @@
7070
<Compile Update="UserInterface\ControlPanel\Pages\CopilotSettings.xaml.cs">
7171
<SubType>Code</SubType>
7272
</Compile>
73+
<Compile Update="UserInterface\Setup\Pages\RedirectOrRemove.xaml.cs">
74+
<SubType>Code</SubType>
75+
</Compile>
7376
</ItemGroup>
7477
</Project>

GoAwayEdge/GoAwayEdge.csproj.user

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
<Page Update="UserInterface\ControlPanel\ControlPanel.xaml">
7676
<SubType>Designer</SubType>
7777
</Page>
78+
<Page Update="UserInterface\Setup\Pages\RedirectOrRemove.xaml">
79+
<SubType>Designer</SubType>
80+
</Page>
7881
<Page Update="UserInterface\Setup\Pages\Welcome.xaml">
7982
<SubType>Designer</SubType>
8083
</Page>

GoAwayEdge/UserInterface/Setup/Installer.xaml

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,59 @@
1515
ResizeMode="NoResize">
1616

1717
<Grid>
18-
<Grid.RowDefinitions>
19-
<RowDefinition Height="50"/>
20-
<RowDefinition Height="*"/>
21-
<RowDefinition Height="60"/>
22-
</Grid.RowDefinitions>
18+
<Grid>
19+
<Grid.RowDefinitions>
20+
<RowDefinition Height="50"/>
21+
<RowDefinition Height="*"/>
22+
<RowDefinition Height="60"/>
23+
</Grid.RowDefinitions>
2324

24-
<Border Grid.Row="1"
25+
26+
<Border Grid.Row="1"
2527
CornerRadius="8,0,0,0">
26-
<Frame Margin="15,10,15,10" x:Name="FrameWindow" />
27-
</Border>
28+
<Frame Margin="15,10,15,10" x:Name="FrameWindow" />
29+
</Border>
2830

29-
<StatusBar
31+
<StatusBar
3032
Grid.Row="2"
3133
VerticalAlignment="Bottom"
3234
Height="50"
3335
Margin="0"
34-
Padding="8,2">
35-
<StatusBar.ItemsPanel>
36-
<ItemsPanelTemplate>
37-
<Grid>
38-
<Grid.ColumnDefinitions>
39-
<ColumnDefinition Width="Auto" />
40-
<ColumnDefinition Width="*" />
41-
<ColumnDefinition Width="Auto" />
42-
</Grid.ColumnDefinitions>
43-
</Grid>
44-
</ItemsPanelTemplate>
45-
</StatusBar.ItemsPanel>
36+
Padding="15,2">
37+
<StatusBar.ItemsPanel>
38+
<ItemsPanelTemplate>
39+
<Grid>
40+
<Grid.ColumnDefinitions>
41+
<ColumnDefinition Width="Auto" />
42+
<ColumnDefinition Width="*" />
43+
<ColumnDefinition Width="Auto" />
44+
</Grid.ColumnDefinitions>
45+
</Grid>
46+
</ItemsPanelTemplate>
47+
</StatusBar.ItemsPanel>
4648

47-
<StatusBarItem Grid.Column="0">
48-
<StackPanel Orientation="Horizontal">
49-
<Label Content="Version 0.0.0" x:Name="VersionLbl" VerticalAlignment="Center" Margin="0,3,0,0"/>
50-
<Separator Margin="8,0,0,0"/>
51-
<ui:HyperlinkButton NavigateUri="https://github.com/valnoxy/GoAwayEdge" VerticalContentAlignment="Bottom" Content="GitHub" Margin="3,0,0,0" Height="30"/>
52-
</StackPanel>
53-
</StatusBarItem>
49+
<StatusBarItem Grid.Column="0">
50+
<StackPanel Orientation="Horizontal">
51+
<Label Content="Version 0.0.0" x:Name="VersionLbl" VerticalAlignment="Center" Margin="0,3,0,0"/>
52+
<Separator Margin="8,0,0,0"/>
53+
<ui:HyperlinkButton NavigateUri="https://github.com/valnoxy/GoAwayEdge" VerticalContentAlignment="Bottom" Content="GitHub" Margin="3,0,0,0" Height="30"/>
54+
</StackPanel>
55+
</StatusBarItem>
5456

55-
<StatusBarItem Grid.Column="2">
56-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
57-
<ui:Button Icon="{ui:SymbolIcon ArrowLeft16}" Content="{DynamicResource Back}" Margin="0,0,5,0" Click="BackBtn_OnClick" x:Name="BackBtn" IsEnabled="false"/>
58-
<ui:Button Icon="{ui:SymbolIcon ArrowRight16}" Content="{DynamicResource Next}" Margin="0,0,5,0" Click="NextBtn_OnClick" x:Name="NextBtn" IsEnabled="false"/>
59-
</StackPanel>
60-
</StatusBarItem>
61-
</StatusBar>
57+
<StatusBarItem Grid.Column="2">
58+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
59+
<ui:Button Icon="{ui:SymbolIcon ArrowLeft16}" Content="{DynamicResource Back}" Margin="0,0,5,0" Click="BackBtn_OnClick" x:Name="BackBtn" IsEnabled="false"/>
60+
<ui:Button Icon="{ui:SymbolIcon ArrowRight16}" Content="{DynamicResource Next}" Margin="0,0,-2,0" Click="NextBtn_OnClick" x:Name="NextBtn" IsEnabled="false"/>
61+
</StackPanel>
62+
</StatusBarItem>
63+
</StatusBar>
6264

63-
<ui:TitleBar x:Name="Bar" Title="{DynamicResource Title}" Grid.Row="0" ShowMaximize="false">
64-
<ui:TitleBar.Icon>
65-
<ui:ImageIcon Source="pack://application:,,,/GoAwayEdge.ico"/>
66-
</ui:TitleBar.Icon>
67-
</ui:TitleBar>
65+
<ui:TitleBar x:Name="Bar" Title="{DynamicResource Title}" Grid.Row="0" ShowMaximize="false">
66+
<ui:TitleBar.Icon>
67+
<ui:ImageIcon Source="pack://application:,,,/GoAwayEdge.ico"/>
68+
</ui:TitleBar.Icon>
69+
</ui:TitleBar>
70+
</Grid>
71+
<ContentPresenter x:Name="RootContentDialogPresenter"/>
6872
</Grid>
6973
</ui:FluentWindow>

GoAwayEdge/UserInterface/Setup/Installer.xaml.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ public partial class Installer
1212
{
1313
internal static Installer? ContentWindow;
1414
public static License? LicensePage;
15+
public static Settings? SettingPage;
1516
private static Welcome? _welcomePage;
16-
private static Settings? _settingPage;
17+
private static RedirectOrRemove? _redirectOrRemovePage;
1718

1819
public Installer()
1920
{
@@ -43,7 +44,7 @@ public Installer()
4344
Configuration.InitialEnvironment();
4445

4546
_welcomePage = new Welcome();
46-
LicensePage = new License();
47+
_redirectOrRemovePage = new RedirectOrRemove();
4748
FrameWindow.Content = _welcomePage;
4849
ContentWindow = this;
4950
}
@@ -61,10 +62,10 @@ internal void NextBtn_OnClick(object sender, RoutedEventArgs e)
6162
FrameWindow.Content = new Installation();
6263
break;
6364
case License:
64-
NextBtn.IsEnabled = true;
65+
NextBtn.IsEnabled = false;
6566
BackBtn.IsEnabled = true;
66-
_settingPage = new Settings();
67-
FrameWindow.Content = _settingPage;
67+
FrameWindow.Content = _redirectOrRemovePage;
68+
SettingPage = new Settings();
6869
break;
6970
}
7071
}
@@ -73,10 +74,16 @@ private void BackBtn_OnClick(object sender, RoutedEventArgs e)
7374
{
7475
switch (FrameWindow.Content)
7576
{
77+
case RedirectOrRemove:
78+
NextBtn.IsEnabled = false;
79+
BackBtn.IsEnabled = true;
80+
LicensePage = new License();
81+
FrameWindow.Content = LicensePage;
82+
break;
7683
case Settings:
7784
NextBtn.IsEnabled = true;
7885
BackBtn.IsEnabled = true;
79-
FrameWindow.Content = LicensePage;
86+
FrameWindow.Content = _redirectOrRemovePage;
8087
break;
8188
case License:
8289
NextBtn.IsEnabled = false;

GoAwayEdge/UserInterface/Setup/Pages/License.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ScrollViewer>
1717
</ui:Card>
1818

19-
<RadioButton Content="{DynamicResource LicenseAccept}" Click="AcceptLicenseRb_Click"/>
19+
<RadioButton x:Name="AcceptLicenseRadioBtn" Content="{DynamicResource LicenseAccept}" Click="AcceptLicenseRb_Click"/>
2020
<RadioButton Content="{DynamicResource LicenseDecline}" IsChecked="true" Click="DeclineLicenseRb_Click"/>
2121
</StackPanel>
2222
</UserControl>

GoAwayEdge/UserInterface/Setup/Pages/License.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Windows;
2+
using GoAwayEdge.Common;
23

34
namespace GoAwayEdge.UserInterface.Setup.Pages
45
{
@@ -11,6 +12,12 @@ public License()
1112
{
1213
InitializeComponent();
1314

15+
if (Configuration.LicenseAccepted)
16+
{
17+
Installer.ContentWindow!.NextBtn.IsEnabled = true;
18+
AcceptLicenseRadioBtn.IsChecked = true;
19+
}
20+
1421
const string license = @"MIT License
1522
1623
Copyright (c) 2023-2024 valnoxy
@@ -40,10 +47,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4047
private void AcceptLicenseRb_Click(object sender, RoutedEventArgs e)
4148
{
4249
Installer.ContentWindow!.NextBtn.IsEnabled = true;
50+
Configuration.LicenseAccepted = true;
4351
}
4452
private void DeclineLicenseRb_Click(object sender, RoutedEventArgs e)
4553
{
4654
Installer.ContentWindow!.NextBtn.IsEnabled = false;
55+
Configuration.LicenseAccepted = false;
4756
}
4857
}
4958
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<UserControl x:Class="GoAwayEdge.UserInterface.Setup.Pages.RedirectOrRemove"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800">
9+
10+
<Grid>
11+
<Grid.ColumnDefinitions>
12+
<ColumnDefinition Width="300"/>
13+
<ColumnDefinition Width="*"/>
14+
</Grid.ColumnDefinitions>
15+
16+
<Image Grid.Column="0" Source="pack://application:,,,/Assets/SetupBannerIcon.png" Height="200"/>
17+
<StackPanel Grid.Column="1" VerticalAlignment="Center">
18+
<ui:TextBlock FontTypography="Subtitle" Text="Redirect or Remove?" FontWeight="Bold" Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
19+
<ui:TextBlock TextWrapping="Wrap" FontSize="14" Text="Do you want to redirect all calls from Edge to another browser, or completely remove Edge?" Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
20+
<ui:CardAction
21+
Margin="0,20,0,8"
22+
Click="InstallBtn_Click"
23+
Icon="{ui:SymbolIcon ArrowForward24}">
24+
<StackPanel>
25+
<TextBlock
26+
Margin="0,0,0,4"
27+
FontWeight="Medium"
28+
Text="Redirect everything" />
29+
<TextBlock
30+
FontSize="12"
31+
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
32+
Text="Redirect all calls from Edge to your favorite browser." />
33+
</StackPanel>
34+
</ui:CardAction>
35+
<ui:CardAction
36+
Margin="0,0,0,8"
37+
Click="UninstallBtn_Click"
38+
x:Name="UninstallBtn"
39+
Icon="{ui:SymbolIcon Recycle32}">
40+
<StackPanel>
41+
<TextBlock
42+
Margin="0,0,0,4"
43+
FontWeight="Medium"
44+
Text="{DynamicResource SettingsMSEdgeUninstallTitle}" />
45+
<TextBlock
46+
FontSize="12"
47+
x:Name="EdgeUninstallNote"
48+
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
49+
Text="{DynamicResource SettingsMSEdgeUninstallDescription}" />
50+
</StackPanel>
51+
</ui:CardAction>
52+
53+
</StackPanel>
54+
</Grid>
55+
</UserControl>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Windows;
2+
using Wpf.Ui;
3+
using Wpf.Ui.Extensions;
4+
5+
namespace GoAwayEdge.UserInterface.Setup.Pages
6+
{
7+
/// <summary>
8+
/// Interaktionslogik für RedirectOrRemove.xaml
9+
/// </summary>
10+
public partial class RedirectOrRemove
11+
{
12+
public RedirectOrRemove()
13+
{
14+
InitializeComponent();
15+
}
16+
17+
private void InstallBtn_Click(object sender, RoutedEventArgs e)
18+
{
19+
Installer.ContentWindow!.FrameWindow.Content = Installer.SettingPage;
20+
Installer.ContentWindow!.NextBtn.IsEnabled = true;
21+
}
22+
23+
private void UninstallBtn_Click(object sender, RoutedEventArgs e)
24+
{
25+
var contentDialogService = new ContentDialogService();
26+
contentDialogService.SetDialogHost(Installer.ContentWindow!.RootContentDialogPresenter);
27+
28+
contentDialogService.ShowSimpleDialogAsync(
29+
new SimpleContentDialogCreateOptions()
30+
{
31+
Title = "Warning",
32+
Content = "Removing Microsoft Edge can cause serious system issues, as it’s deeply integrated into Windows and essential for many features, including updates, help files, and some apps. Deleting it could result in instability or broken functionality.\n\nOnly proceed if you fully understand the risks and have a reliable backup or restore point in place.",
33+
PrimaryButtonText = "Remove Microsoft Edge",
34+
CloseButtonText = "Cancel"
35+
}
36+
);
37+
}
38+
}
39+
}

GoAwayEdge/UserInterface/Setup/Pages/Welcome.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public Welcome()
2626

2727
private void InstallBtn_Click(object sender, RoutedEventArgs e)
2828
{
29+
Installer.LicensePage = new License();
2930
Installer.ContentWindow!.FrameWindow.Content = Installer.LicensePage;
3031
Installer.ContentWindow!.BackBtn.IsEnabled = true;
3132
}

0 commit comments

Comments
 (0)