Ejemplo n.º 1
0
        /// <summary>
        /// Makes async request to checker with random line
        /// </summary>
        /// <param name="checker">FileLinesCheckerBase</param>
        private static void AsyncRequest(Object @object)
        {
            FileLinesCheckerBase checker = @object as FileLinesCheckerBase;

            checker.ContainsAsync(GetSomeLine(),
                                  ShowSuccessResultFromAsync, ShowFailureResultFromAsync);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Call to FileLinesCheckerBase.Cancel
        /// </summary>
        /// <param name="object">FileLinesCheckerBase as object</param>
        private static void CancelChecker(Object @object)
        {
            FileLinesCheckerBase checker = @object as FileLinesCheckerBase;

            Console.WriteLine("Cancel call!");
            checker.Cancel();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Call to FileLinesCheckerBase.Reset
        /// </summary>
        /// <param name="object">FileLinesCheckerBase as object</param>
        private static void ResetChecker(Object @object)
        {
            FileLinesCheckerBase checker = @object as FileLinesCheckerBase;

            Console.WriteLine("Reset call!");
            checker.Reset();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Makes sync request to checker with random line
        /// </summary>
        /// <param name="checker">FileLinesCheckerBase</param>
        private static void SyncRequest(Object @object)
        {
            FileLinesCheckerBase checker = @object as FileLinesCheckerBase;

            try
            {
                Console.WriteLine("  Sync done: Thread={0}, Result={1}",
                                  Thread.CurrentThread.ManagedThreadId,
                                  checker.Contains(GetSomeLine()));
            }
            catch (Exception exception)
            {
                Console.WriteLine("  Sync fail: Thread={0}, Exception={1}",
                                  Thread.CurrentThread.ManagedThreadId,
                                  exception.Message);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Call to FileLinesCheckerBase.Cancel from new thread
 /// </summary>
 /// <param name="checker">FileLinesCheckerBase</param>
 private static void CancelAsync(FileLinesCheckerBase checker)
 {
     ThreadPool.QueueUserWorkItem(CancelChecker, checker);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Makes sync request to checker with random line from new thread
 /// </summary>
 /// <param name="checker">FileLinesCheckerBase</param>
 private static void AsyncSyncRequest(FileLinesCheckerBase checker)
 {
     ThreadPool.QueueUserWorkItem(SyncRequest, checker);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Call to FileLinesCheckerBase.Reset from new thread
 /// </summary>
 /// <param name="checker"></param>
 private static void ResetAsync(FileLinesCheckerBase checker)
 {
     ThreadPool.QueueUserWorkItem(ResetChecker, checker);
 }