Example #1
0
        private static async void TestWithAsync()
        {
            var config = new TimingComponentConfiguration
            {
                ServiceName           = "Rick's Service",
                IntervalInMillseconds = 2000,
                Perform = async() =>
                {
                    Console.WriteLine("Fired");
                    var t = new TestAsync();
                    await t.RunAsync();
                }
            };

            var timing = new TimingComponent.TimingComponent(config, new ConsoleLogger());

            timing.Start();
            Console.ReadLine();
        }
Example #2
0
        public void TestWithoutAsync()
        {
            var config = new TimingComponentConfiguration
            {
                ServiceName           = "Rick's Service",
                IntervalInMillseconds = 2000,
                Perform = () =>
                {
                    Console.WriteLine("Fired");
                    var t = new Test();
                    t.Run();
                }
            };

            var timing = new TimingComponent(config, new ConsoleLogger());

            timing.Start();
            Thread.Sleep(5000);
            timing.Stop();
        }