static void Main(string[] args)
        {
            // create an instance of our process engine
            BusinessModule process = new BusinessModule();

            // create an instance of our execution delegate
            ExecuteBackgroundDelegate asynchExec = new ExecuteBackgroundDelegate(process.ExecuteBackground);

            // execute this asynchronously
            asynchExec.BeginInvoke(null, null);

            Console.Write("Press any key to quit...");
            Console.Read();

            // tell process to stop
            process.StopMonitoring();
            Console.Write(Environment.NewLine + "Quiting.");

            // wait up to 100 iterations for the process to stop
            int i = 0;

            while (i++ < 100 && !process.Stopped)
            {
                Console.Write(".");
            }

            if (process.Stopped)
            {
                Console.WriteLine(Environment.NewLine + "Process successfully shutdown.");
            }
            else
            {
                Console.WriteLine(Environment.NewLine + "Process failed to successfully shutdown.");
            }
        }
Esempio n. 2
0
 static extern void InitManagedDelegates(RunDelegate run, ExecuteDelegate execute, ExecuteBackgroundDelegate executeBackground, ReloadDelegate reload, ListDelegate list);
Esempio n. 3
0
 static extern void InitManagedDelegates(RunDelegate run, ExecuteDelegate execute, ExecuteBackgroundDelegate executeBackground, ReloadDelegate reload, ListDelegate list);