Skip to content

Commit

Permalink
Added variable to only display restart popup for fixes that require a…
Browse files Browse the repository at this point in the history
… restart (or explorer restart) to take effect.
  • Loading branch information
99natmar99 committed Dec 13, 2021
1 parent 42a9dde commit 60a9c4a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Windows 11 Fixer/Windows 11 Fixer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
{
var n_installs = 0;
String id_install = " ";
bool restartRequired = false;

//Taskbar Fixes
//Taskbar Location
Expand All @@ -92,14 +93,17 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
if (Size_Small.IsChecked == true)
{
Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", "TaskbarSi", "00000000", RegistryValueKind.DWord);
restartRequired = true;
}
else if (Size_Medium.IsChecked == true)
{
Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", "TaskbarSi", "00000001", RegistryValueKind.DWord);
restartRequired = true;
}
else if (Size_Large.IsChecked == true)
{
Registry.SetValue("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", "TaskbarSi", "00000002", RegistryValueKind.DWord);
restartRequired = true;
}

//Widgets Button
Expand Down Expand Up @@ -134,13 +138,15 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
if (Context_Win10.IsChecked == true)
{
Registry.SetValue("HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\\InprocServer32", "", "");
restartRequired = true;
}
else if (Context_Win11.IsChecked == true)
{
ProcessStartInfo contextdel = new ProcessStartInfo("WT.exe");
contextdel.UseShellExecute = true;
contextdel.Arguments = "REG DELETE \"HKCU\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" /f";
Process.Start(contextdel);
restartRequired = true;
}

//Take Ownership
Expand Down Expand Up @@ -237,20 +243,23 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
Pinfo.UseShellExecute = true;
Pinfo.Arguments = "REG ADD \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons\" /v 29 /t REG_SZ /d \"%windir%\\blank.ico\" /f";
Process.Start(Pinfo);
restartRequired = true;
}
else if (Shortcut_Normal.IsChecked == true)
{
ProcessStartInfo Pinfo1 = new ProcessStartInfo("WT.exe");
Pinfo1.UseShellExecute = true;
Pinfo1.Arguments = "REG ADD \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons\" /v 29 /t REG_SZ /d \"%windir%\\System32\\shell32.dll,-30\" /f";
Process.Start(Pinfo1);
restartRequired = true;
}
else if (Shortcut_Large.IsChecked == true)
{
ProcessStartInfo Pinfo2 = new ProcessStartInfo("WT.exe");
Pinfo2.UseShellExecute = true;
Pinfo2.Arguments = "REG ADD \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons\" /v 29 /t REG_SZ /d \"%windir%\\System32\\shell32.dll,-16769\" /f";
Process.Start(Pinfo2);
restartRequired = true;
}

//Install Internet Browser
Expand Down Expand Up @@ -454,13 +463,15 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
searchadd.UseShellExecute = true;
searchadd.Arguments = "REG ADD \"HKCU\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer\" /v DisableSearchBoxSuggestions /t REG_DWORD /d \"00000001\" /f";
Process.Start(searchadd);
restartRequired = true;
}
else if (WSearch_Allow.IsChecked == true)
{
ProcessStartInfo searchdel = new ProcessStartInfo("WT.exe");
searchdel.UseShellExecute = true;
searchdel.Arguments = "REG DELETE \"HKCU\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer\" /f";
Process.Start(searchdel);
restartRequired = true;
}

//Uninstall Cortana
Expand All @@ -479,13 +490,15 @@ private void Button_Click_3(object sender, RoutedEventArgs e)
widgetsService.UseShellExecute = true;
widgetsService.Arguments = "REG ADD \"HKLM\\Software\\Policies\\Microsoft\\Dsh\" /v AllowNewsAndInterests /t REG_DWORD /d \"00000000\" /f";
Process.Start(widgetsService);
restartRequired = true;
}
else if (WService_Enable.IsChecked == true)
{
ProcessStartInfo widgetsService = new ProcessStartInfo("WT.exe");
widgetsService.UseShellExecute = true;
widgetsService.Arguments = "REG ADD \"HKLM\\Software\\Policies\\Microsoft\\Dsh\" /v AllowNewsAndInterests /t REG_DWORD /d \"00000001\" /f";
Process.Start(widgetsService);
restartRequired = true;
}

//Install Software
Expand Down Expand Up @@ -563,8 +576,11 @@ private void Button_Click_3(object sender, RoutedEventArgs e)

if (!isWindowOpen)
{
Restart_Popup newwindow = new Restart_Popup();
newwindow.Show();
if (restartRequired == true)
{
Restart_Popup newwindow = new Restart_Popup();
newwindow.Show();
}
}

//Clear Values
Expand Down

0 comments on commit 60a9c4a

Please sign in to comment.