Skip to content

Commit

Permalink
Updated Taskbar11
Browse files Browse the repository at this point in the history
- Improved and cleaned up code
- Added Toolbar
- Changed UI-layout
  • Loading branch information
jetspiking authored Jan 16, 2022
1 parent 8e97526 commit 0eee345
Show file tree
Hide file tree
Showing 24 changed files with 1,595 additions and 580 deletions.
Binary file modified Images/Taskbar11_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions Taskbar11/Taskbar11/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Data;
using System.Linq;
using System.Windows;
using System.Reflection;
using Microsoft.WindowsAPICodePack.Shell;

namespace Taskbar11
{
Expand All @@ -12,5 +14,63 @@ namespace Taskbar11
/// </summary>
public partial class App : Application
{
// IMPORTANT: Project Name Must Be _Your_ Project Name, Otherwise The Assembly Won't Be Able To Load!
private static String ProjectName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
private static String AssemblyPathPrefix = ProjectName+'.';
private const String DllExtension = ".dll";
private const String AssemblyNotFoundWarning = "ERROR: Assembly Not Found!";
private const String AssemblyLoaded = "Log: Loaded (Previously Unresolved) Embedded Assembly: ";

[STAThread]
public static void Main()
{
InitializeDependencies();
StartProgram();
}

/// <summary>
/// First load the neccessary assemblies.
/// </summary>
public static void InitializeDependencies()
{
AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}

/// <summary>
/// Called after loading the neccessary assemblies.
/// </summary>
public static void StartProgram()
{
var application = new App();
application.InitializeComponent();
application.Run();
}

/// <summary>
/// Called when an assembly was loaded.
/// </summary>
static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
{
Console.WriteLine(AssemblyLoaded+args.LoadedAssembly.FullName);
}

/// <summary>
/// Load the assembly Microsoft.WindowsAPICodePack.Shell.dll which is configured to be embedded in the target executable (Build Action: "Embedded Resource").
/// </summary>
/// <returns>Assembly from Taskbar11.Microsoft.WindowsAPICodePack.Shell.dll</returns>
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{

int charLocation = args.Name.IndexOf(',');
if (charLocation > 0)
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(AssemblyPathPrefix+args.Name.Substring(0,charLocation) + DllExtension))
{
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
return null;
}
}
}
18 changes: 18 additions & 0 deletions Taskbar11/Taskbar11/Controllers/ApplicationSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Taskbar11.Controllers
{
/// <summary>
/// Application Constants.
/// </summary>
public class ApplicationSettings
{
public const int ApplicationWidth = 700;
public const int ApplicationHeight = 500;
public const int ApplicationScrollerWidth = 600;
public const int ToolbarWidth = 75;
}
}
25 changes: 25 additions & 0 deletions Taskbar11/Taskbar11/Controllers/ApplicationUtilities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Taskbar11.Controllers
{
public static class ApplicationUtilities
{
private const String ProcessNameExplorer = "explorer";

/// <summary>
/// Forces the explorer.exe process to restart by killing it (the UI needs to reload to display the changes).
/// </summary>
public static void RestartExplorer()
{
Process p = new Process();
foreach (Process process in Process.GetProcesses())
if (process.ProcessName == ProcessNameExplorer)
process.Kill();
}

}
}
Loading

0 comments on commit 0eee345

Please sign in to comment.