mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
58 lines
1.6 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|