PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/Examples/014 - Verifying repository asynchronously.linq

#
Unknown | 28 lines | 26 code | 2 blank | 0 comment | 0 complexity | 50f3b927d35d2fad560adf868cde524f MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. <Query Kind="Program">
  2. <Reference Relative="..\Mercurial.Net\bin\Debug\Mercurial.NET.dll">C:\dev\vs.net\Mercurial.Net\Mercurial.Net\bin\Debug\Mercurial.NET.dll</Reference>
  3. <Namespace>Mercurial</Namespace>
  4. </Query>
  5. // *****************************************************
  6. // *
  7. // * This example shows how to verify the integrity
  8. // * of the repository, asynchronously.
  9. // *
  10. // ***********************
  11. void Main()
  12. {
  13. var repoPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), ".."));
  14. var repo = new Repository(repoPath);
  15. var evt = new ManualResetEvent(false);
  16. var ar = repo.BeginExecute(new VerifyCommand(), c =>
  17. {
  18. Debug.WriteLine(((VerifyCommand)c.AsyncState).RawStandardOutput);
  19. evt.Set();
  20. });
  21. Debug.WriteLine("waiting...");
  22. repo.EndExecute(ar);
  23. Debug.WriteLine("finished executing");
  24. evt.WaitOne();
  25. Debug.WriteLine("event signalled");
  26. }