36 lines
943 B
C#
36 lines
943 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using VDash.Utilities;
|
|
|
|
namespace VDash.Overlay.Actions
|
|
{
|
|
public class RestoreWindowAction : IOverlayAction
|
|
{
|
|
|
|
public bool Enabled { get; set; }
|
|
|
|
public void PreformAction(IOverlay intOverlay)
|
|
{
|
|
if (!Enabled) { return; }
|
|
if (!intOverlay.GetType().IsAssignableFrom(typeof(WindowOverlay)))
|
|
{
|
|
Console.WriteLine("This action cannot be performed on a non-WindowOverlay overlay.");
|
|
return;
|
|
}
|
|
|
|
WindowOverlay overlay = (WindowOverlay)intOverlay;
|
|
IntPtr handle = overlay.Selector.GetWindowHandle();
|
|
PreformAction(handle);
|
|
}
|
|
|
|
public void PreformAction(IntPtr handle)
|
|
{
|
|
User32.ShowWindow(handle, User32.ShowWindowCommands.Restore);
|
|
}
|
|
}
|
|
}
|
|
|