public override void Disconnect()
        {
            var client =
                new TraceEventHandlerClient
                    (
                    Configuration.ServiceHost,
                    Configuration.Port,
                    Configuration.Uri
                    );

            if (EventDelegate != null)
            {
                client.EventHandled -= EventDelegate;
            }
            else
            {
                throw new Exception("EventDelegate is null and cannot be dettached!");
            }
            base.Disconnect();
        }
        public override void Connect()
        {
            base.Connect();

            var client =
                new TraceEventHandlerClient
                    (
                    Configuration.ServiceHost,
                    Configuration.Port,
                    Configuration.Uri
                    );

            if (EventDelegate != null)
            {
                client.EventHandled += EventDelegate;
            }
            else
            {
                throw new Exception("EventDelegate is null and cannot be assigned!");
            }
        }
예제 #3
0
        private static void Main(string[] args)
        {
            try
            {
                Console.Write("Press any key to test the client");
                Console.ReadKey();

                var tracingClient = new TraceEventHandlerClient("localhost", "9020", "TraceEventHandlerWrapper.rem");

                tracingClient.HandleEvent(new TraceEvent
                                              {
                                                  Category = EventCategory.Debugging,
                                                  Context = "Context",
                                                  ContextIdentifier = new ContextIdentifier
                                                                          {
                                                                              AuthenticationTokenId = 0,
                                                                              ContextGuid = Guid.NewGuid(),
                                                                              ContextHolderId = 1,
                                                                              ExternalId = "456454",
                                                                              ExternalReference = "ERef1",
                                                                              ExternalParentId = "EParentId",
                                                                              InternalId = 56,
                                                                              InternalParentId = 57
                                                                          },
                                                  EventId = new Random().Next(500000),
                                                  EventIdText = null,
                                                  Handled = false,
                                                  LifeCycleType = ApplicationLifeCycleType.Runtime,
                                                  Message = "This is a test message sent through the remoting channel",
                                                  Type = TraceEventType.Information
                                              });
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
            }
            Console.Write("Press any key to exit");
            Console.ReadKey();
        }