I have an operation via While
that i want to Freeze:
do
{
ManualResetEvent.Reset(); // Here i want to wait
// Here i am doing my stuff...
}
while (some boolean value);
}
My ManualResetEvent
:
private static ManualResetEvent _manualResetEvent;
public static ManualResetEvent ManualResetEvent
{
get { return _manualResetEvent; }
set { _manualResetEvent = value; }
}
ManualResetEvent = new ManualResetEvent(false);
In some point in my code via Button
i just want to freeze my operation:
private void btnPause_Click(object sender, RoutedEventArgs e)
{
ManualResetEvent.WaitOne();
}
Is this the right way to do that ?