Example #1
0
        /// <summary>
        /// In this demo, the Box class is wired up to the Microsoft.Win32.SystemEvents.DisplaySettingsChanged
        /// event, which is invoked when the display settings are changed.
        /// </summary>
        private static void DynamicEventsDemo()
        {
            Box box = new Box { Name = "Chips", Volume = 2.0m };
            EventHookup.HookupToSystemEvents(box);

            Console.WriteLine("Change the display properties please.");
            Console.ReadLine();

            EventHookup.UnhookFromSystemEvents(box);
        }
Example #2
0
 /// <summary>
 /// In this demo, the dynamic logger framework is used to invoke
 /// the log method of the Box class through a dynamic delegate.
 /// </summary>
 private static void DynamicDelegatesDemo()
 {
     Box box = new Box { Name = "Chips", Volume = 2.0m };
     DynamicLogger.Log(Console.Out, box);
 }