PersistentWindows/Ninjacrab.PersistentWindows.Solution/Ninjacrab.PersistentWindows.Common/Models/ApplicationDisplayMetrics.cs

37 lines
1.5 KiB
C#

using System;
using Ninjacrab.PersistentWindows.Common.WinApiBridge;
using ManagedWinapi.Windows;
namespace Ninjacrab.PersistentWindows.Common.Models
{
public class ApplicationDisplayMetrics
{
public IntPtr HWnd { get; set; }
public uint ProcessId { get; set; }
public string ApplicationName { get; set; }
public WindowPlacement WindowPlacement { get; set; }
public RECT ScreenPosition { get; set; }
public string Key
{
// in release mode, ApplicatioName is "" to reduce runtime
get { return string.Format("{0}-{1}", HWnd.ToInt64(), ApplicationName); }
}
public bool EqualPlacement(ApplicationDisplayMetrics other)
{
/*
return this.WindowPlacement.NormalPosition.Left == other.WindowPlacement.NormalPosition.Left
&& this.WindowPlacement.NormalPosition.Top == other.WindowPlacement.NormalPosition.Top
&& this.WindowPlacement.NormalPosition.Width == other.WindowPlacement.NormalPosition.Width
&& this.WindowPlacement.NormalPosition.Height == other.WindowPlacement.NormalPosition.Height;
*/
return this.WindowPlacement.NormalPosition.Equals(other.WindowPlacement.NormalPosition);
}
public override string ToString()
{
return string.Format("{0}.{1} {2}", ProcessId, HWnd.ToInt64(), ApplicationName);
}
}
}