Exemple #1
0
        //
        //
        // Main.
        //
        //
        static void Main(string[] args)
        {
            ArchiverApp app   = new ArchiverApp();
            ServerAgent agent = AppUtils.ConnectToServer(app, "Archiver.am");

            if (agent != null)
            {
                //
                // Open logfile.
                //
                try
                {
                    LogFile = new StreamWriter(new FileStream("IM.log", FileMode.Create, FileAccess.Write));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to create IM.log: " + e.Message);
                    return;
                }

                //
                // Event dispatch loop.
                //
                Console.WriteLine("Archiver sample started.  Press Control-C to quit.");
                while (true)
                {
                    agent.WaitHandle.WaitOne();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(agent.ProcessEvent));
                }
            }
        }
Exemple #2
0
        //
        //
        //
        //      Main.
        //
        //
        //
        static void Main(string[] args)
        {
            LoggingNoticeApp app   = new LoggingNoticeApp();
            ServerAgent      agent = AppUtils.ConnectToServer(app, "LoggingNotice.am");

            if (agent != null)
            {
                //
                // Main loop.
                //
                Console.WriteLine("LoggingNotice sample is running.  Press Control-C to quit.");
                while (true)
                {
                    agent.WaitHandle.WaitOne();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(agent.ProcessEvent));
                }
            }
        }