Example #1
0
        public void CancelTest()
        {
            var exception = (Exception)null;
            var triggered = 0;

            using (var @event = new FbRemoteEvent(Connection.ConnectionString))
            {
                @event.RemoteEventError += (sender, e) =>
                {
                    exception = e.Error;
                };
                @event.RemoteEventCounts += (sender, e) =>
                {
                    triggered++;
                };
                @event.Open();
                @event.QueueEvents("test");
                using (var cmd = Connection.CreateCommand())
                {
                    cmd.CommandText = "execute block as begin post_event 'test'; end";
                    cmd.ExecuteNonQuery();
                    Thread.Sleep(2000);
                }
                @event.CancelEvents();
                using (var cmd = Connection.CreateCommand())
                {
                    cmd.CommandText = "execute block as begin post_event 'test'; end";
                    cmd.ExecuteNonQuery();
                    Thread.Sleep(2000);
                }
                Assert.IsNull(exception);
                Assert.AreEqual(1, triggered);
            }
        }
 public override void StopListenEvents()
 {
     if (ConfigDb.ListenEvents)
     {
         if (remoteEvent != null)
         {
             try
             {
                 remoteEvent.CancelEvents();
             }
             catch
             {
             }
             remoteEvent = null;
         }
         conn.Close();
         base.StopListenEvents();
     }
 }
Example #3
0
 private void CancelTracking()
 {
     revent.CancelEvents();
     fctSQL.AppendText($@"{Environment.NewLine}{StaticFunctionsClass.DateTimeNowStr()} Event tracking stopped...{Environment.NewLine}");
 }