Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
53X Again 5!
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor authored and Taiizor committed Apr 11, 2021
1 parent a0fc8c2 commit ee67b12
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 87 deletions.
123 changes: 123 additions & 0 deletions src/Taskbar/Enum/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
namespace Taskbar.Enum
{
/// <summary>
///
/// </summary>
public class Enums
{
#region Enums
/// <summary>
///
/// </summary>
public enum LocationType
{
/// <summary>
///
/// </summary>
Unknown = -1,
/// <summary>
///
/// </summary>
Left,
/// <summary>
///
/// </summary>
Top,
/// <summary>
///
/// </summary>
Right,
/// <summary>
///
/// </summary>
Bot
}

/// <summary>
///
/// </summary>
public enum EdgeType : uint
{
/// <summary>
///
/// </summary>
Left = 0,
/// <summary>
///
/// </summary>
Top = 1,
/// <summary>
///
/// </summary>
Right = 2,
/// <summary>
///
/// </summary>
Bottom = 3
}

/// <summary>
///
/// </summary>
public enum MessageType : uint
{
/// <summary>
///
/// </summary>
New = 0x00000000,
/// <summary>
///
/// </summary>
Remove = 0x00000001,
/// <summary>
///
/// </summary>
QueryPos = 0x00000002,
/// <summary>
///
/// </summary>
SetPos = 0x00000003,
/// <summary>
///
/// </summary>
GetState = 0x00000004,
/// <summary>
///
/// </summary>
GetTaskbarPos = 0x00000005,
/// <summary>
///
/// </summary>
Activate = 0x00000006,
/// <summary>
///
/// </summary>
GetAutoHideBar = 0x00000007,
/// <summary>
///
/// </summary>
SetAutoHideBar = 0x00000008,
/// <summary>
///
/// </summary>
WindowPosChanged = 0x00000009,
/// <summary>
///
/// </summary>
SetState = 0x0000000A,
}

public enum StateType
{
/// <summary>
///
/// </summary>
Hide = 0x01,
/// <summary>
///
/// </summary>
Show = 0x02
}
#endregion
}
}
107 changes: 105 additions & 2 deletions src/Taskbar/Taskbar.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#region Imports

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Taskbar.Enum;

#endregion

Expand All @@ -19,11 +25,108 @@ namespace Taskbar

public class Taskbar
{
public const string Author = "Taiizor";
/// <summary>
///
/// </summary>
private const string Exception = "It only works on the Windows platform.";
/// <summary>
///
/// </summary>
private const string OnlyWindows = "It only works on the Windows platform.";

public void Detect()
/// <summary>
///
/// </summary>
public class Simple
{
/// <summary>
///
/// </summary>
/// <param name="Screen"></param>
/// <returns></returns>
private static Enums.LocationType Detect(Screen Screen)
{
if (Screen.WorkingArea.Width == Screen.Bounds.Width)
{
if (Screen.WorkingArea.Top > 0)
{
return Enums.LocationType.Top;
}
else
{
return Enums.LocationType.Bot;
}
}
else
{
if (Screen.WorkingArea.Left > 0)
{
return Enums.LocationType.Left;
}
else
{
return Enums.LocationType.Right;
}
}
}

/// <summary>
///
/// </summary>
public static Enums.LocationType SingleDetect
{
get
{
try
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Detect(Screen.PrimaryScreen);
}
else
{
throw new Exception(OnlyWindows);
}
}
catch
{
throw new Exception(Exception);
}
}
}

/// <summary>
///
/// </summary>
public static Dictionary<int, Enums.LocationType> MultiDetect
{
get
{
try
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Dictionary<int, Enums.LocationType> Type = new();
int Count = 0;

foreach (Screen Screen in Screen.AllScreens)
{
Type.Add(Count++, Detect(Screen));
}

return Type;
}
else
{
throw new Exception(OnlyWindows);
}
}
catch
{
throw new Exception(Exception);
}
}
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/Taskbar/Taskbar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Changes are detailed at https://github.com/Soferity/Taskbar/releases</PackageRel
</PackageReference>
</ItemGroup>

<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
Expand Down
101 changes: 16 additions & 85 deletions src/Taskbar_CR/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ee67b12

Please sign in to comment.