Skip to content

Commit

Permalink
Initial drop of the taskbar cleaner
Browse files Browse the repository at this point in the history
I built this as a quick and dirty way to remove the buttons, so this was
never in source control to begin with, hence the big dump of initial
code.
  • Loading branch information
nachmore committed Oct 2, 2014
1 parent 81eccfe commit 9c5e176
Show file tree
Hide file tree
Showing 16 changed files with 2,031 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Win10TaskbarCleaner.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win10TaskbarCleaner", "Win10TaskbarCleaner\Win10TaskbarCleaner.csproj", "{C6C170EE-124A-45D8-B246-FB18B5908FC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C6C170EE-124A-45D8-B246-FB18B5908FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6C170EE-124A-45D8-B246-FB18B5908FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6C170EE-124A-45D8-B246-FB18B5908FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6C170EE-124A-45D8-B246-FB18B5908FC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions src/Win10TaskbarCleaner/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
8 changes: 8 additions & 0 deletions src/Win10TaskbarCleaner/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application x:Class="Win10TaskbarCleaner.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions src/Win10TaskbarCleaner/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Win10TaskbarCleaner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
12 changes: 12 additions & 0 deletions src/Win10TaskbarCleaner/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window x:Class="Win10TaskbarCleaner.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Window_Loaded" WindowState="Normal" ResizeMode="NoResize"
Title="Windows 10 Task Bar Cleaner (for Technical Preview) v0.1 alpha for Enterprising Individuals Pro" Height="350" Width="525" Icon="PropertyIcon.ico">
<Grid>
<TextBlock TextWrapping="Wrap" Margin="10,10,10,191">Windows 10 TP ships with 2 irremovable buttons on the TaskBar - Search and "Task View" (i.e. Win+Tab in a button). Until an option to remove the buttons lands in the OS you can use this utility to remove the buttons. Click Install below and you should be done!<LineBreak/><LineBreak/>Note: The TaskBar likes to readjust its controls every now and then so you may occasionally see your controls jump back and forth.</TextBlock>
<TextBlock Margin="10,288,431,10"><Hyperlink NavigateUri="https://github.com/nachmore/Win10TaskbarCleaner" RequestNavigate="Hyperlink_RequestNavigate">Project Site</Hyperlink></TextBlock>
<Button Name="btnInstall" Margin="154,174,154,75" Click="btnInstall_Click"></Button>
<Button Content="Try it out" Name="btnCleanNow" Margin="376,267,27,10" Click="btnCleanNow_Click"></Button>
</Grid>
</Window>
103 changes: 103 additions & 0 deletions src/Win10TaskbarCleaner/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Win10TaskbarCleaner
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private const string REG_APPNAME = "Win10TasbarCleaner";

private bool _installed = false;
RegistryKey _regRun = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

public MainWindow()
{
InitializeComponent();

var args = Environment.GetCommandLineArgs();

if (args.Count() > 1 && args[1].Contains("justrun"))
{
Hide();
}
}

private void StartHiding()
{
WorkScheduler sched = new WorkScheduler();
sched.Schedule(5000, TaskbarCleaner.HideButtons);

Hide();
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
_installed = IsInstalled();

UpdateButton();
}

private void UpdateButton()
{
btnInstall.Content = (_installed ? "Uninstall" : "Install & Close");
}

private bool IsInstalled()
{
return (_regRun.GetValue(REG_APPNAME) != null);
}

private void btnInstall_Click(object sender, RoutedEventArgs e)
{
if (_installed)
Uninstall();
else
InstallAndClose();
}

private void Uninstall()
{
_regRun.DeleteValue(REG_APPNAME);

_installed = false;
UpdateButton();
}

private void InstallAndClose()
{
_regRun.SetValue(REG_APPNAME, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName + " /justrun");

_installed = true;

StartHiding();
}

private void btnCleanNow_Click(object sender, RoutedEventArgs e)
{
TaskbarCleaner.HideButtons();
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}
Loading

0 comments on commit 9c5e176

Please sign in to comment.