Files
dmex b02427417c PH1.x: fixed build
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2014-02-25 23:14:38 +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();
}
}
}