Пример #1
0
        public static void Main(string[] args)
        {
            INode node = NodeFactory.Default;

            node.Loger.Type = LogType.ALL;
            node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL));
            node.Open();
            EventSubscriber henry = node.Register <EventSubscriber>("henry");

            henry.Register <User>(OnUser);
            henry.Register <Employee>(OnEmployees);

            node.SubscriberRegisted = (n, s) =>
            {
                if (s.Name == "ken")
                {
                    // System.Threading.ThreadPool.QueueUserWorkItem(ToKen, henry);
                }
            };

            while (true)
            {
                //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                //foreach (ISubscriber item in node.GetLocalSubscriber())
                //    sb.Append(item.ToString() + ',');
                //foreach (ISubscriber item in node.GetRemoteSubscriber())
                //    sb.Append(item.ToString() + ',');
                //node.Loger.Process(LogType.INFO, sb.ToString());
                // Console.WriteLine(mCount);
                System.Threading.Thread.Sleep(1000);
            }
            Console.Read();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            INode node = NodeFactory.Default;

            node.Loger.Type = LogType.ALL;
            node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL));
            node.Open();
            EventSubscriber ken = node.Register <EventSubscriber>("ken");

            ken.Register <User>(OnUser);
            ken.Register <Employee>(OnEmployees);
            node.SubscriberRegisted = (n, s) =>
            {
                if (s.Name == "henry")
                {
                    ken.Publish("henry", Employee.GetEmployee());
                }
            };

            while (true)
            {
                Console.WriteLine(mCount);
                System.Threading.Thread.Sleep(1000);
            }
            Console.Read();
        }
Пример #3
0
 public DMonitoCenter(INode node, int timeout = 10000)
 {
     TimeOut = timeout;
     mLockEventSubscriber = node.Register <EventSubscriber>(SMART_DLOCKCENTER);
     mLockEventSubscriber.Register <Protocols.EnterKey>(OnEnter);
     mLockEventSubscriber.Register <Protocols.FreeKey>(OnFree);
     Node = node;
 }
Пример #4
0
 public DMonitoCenter(int timeout = 10000)
 {
     Node    = SmartRoute.NodeFactory.Default;
     TimeOut = timeout;
     mLockEventSubscriber = Node.Register <EventSubscriber>(SMART_DLOCKCENTER);
     mLockEventSubscriber.Register <Protocols.EnterKey>(OnEnter);
     mLockEventSubscriber.Register <Protocols.FreeKey>(OnFree);
 }
Пример #5
0
        public static void Main(string[] args)
        {
            INode node = NodeFactory.Default;

            node.Loger.Type = LogType.ALL;
            node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL));
            node.Open();
            EventSubscriber henry = node.Register <EventSubscriber>("henry");

            henry.Register <User>(OnUser);
            henry.Register <Employee>(OnEmployees);
            Console.Read();
        }
Пример #6
0
        public static void Main(string[] args)
        {
            INode node = NodeFactory.Default;

            node.Loger.Type = LogType.ALL;
            node.AddLogHandler(new SmartRoute.ConsoleLogHandler(LogType.ALL));
            node.Open();
            EventSubscriber henry = node.Register <EventSubscriber>("henry");

            henry.Register <User>(OnUser);
            henry.Register <Employee>(OnEmployees);
            while (true)
            {
                Console.WriteLine("{0}/s|{1}", mCount - mLastCount, mCount);
                mLastCount = mCount;
                System.Threading.Thread.Sleep(1000);
            }
            Console.Read();
        }
Пример #7
0
 public void Start()
 {
     mEventSubscriber = Node.Register <EventSubscriber>(NBR_SERVER_TAG);
     mEventSubscriber.Register <Request>(OnRequest);
 }