Files
mirror-processhacker/1.x/trunk/ProcessHacker/Components/TimerProperties.cs
T
wj32 5027592ce9 * reverted the entire logging thing. sorry dmex, it's just not good enough.
* EnumProcessModulesEx only works on Vista and above, and we already get WOW64 modules

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2327 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-11-01 01:35:54 +00:00

58 lines
1.6 KiB
C#

using System;
using System.Windows.Forms;
using ProcessHacker.Common;
using ProcessHacker.Native.Objects;
using ProcessHacker.Native.Security;
namespace ProcessHacker.Components
{
public partial class TimerProperties : UserControl
{
private TimerHandle _timerHandle;
public TimerProperties(TimerHandle timerHandle)
{
InitializeComponent();
_timerHandle = timerHandle;
_timerHandle.Reference();
this.UpdateInfo();
}
private void UpdateInfo()
{
try
{
var basicInfo = _timerHandle.GetBasicInformation();
labelSignaled.Text = basicInfo.TimerState.ToString();
labelTimeRemaining.Text = (new TimeSpan(-basicInfo.RemainingTime)).ToString();
}
catch (Exception ex)
{
labelSignaled.Text = "(" + ex.Message + ")";
labelTimeRemaining.Text = "(" + ex.Message + ")";
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
try
{
_timerHandle.ChangeAccess(TimerAccess.QueryState | TimerAccess.ModifyState);
_timerHandle.Cancel();
}
catch (Exception ex)
{
PhUtils.ShowException("Unable to cancel the timer", ex);
}
}
private void timerUpdate_Tick(object sender, EventArgs e)
{
this.UpdateInfo();
}
}
}