Exemplo n.º 1
0
 public static void Terminate()
 {
     foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
     {
         try
         {
             foreach (Type t in asm.GetTypes())
             {
                 IProgramTerminated init = t.GetCustomAttribute <IProgramTerminated>();
                 if (init != null)
                 {
                     MethodInfo mi = t.GetMethod("Terminate", BindingFlags.Static | BindingFlags.NonPublic);
                     if (mi != null)
                     {
                         mi.Invoke(null, null);
                     }
                 }
             }
         }
         catch (Exception)
         {
             //eat it
         }
     }
 }
Exemplo n.º 2
0
 public void Terminate()
 {
     foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
     {
         try
         {
             foreach (Type t in asm.GetTypes())
             {
                 Interfaces.IProgramTerminated terminated = t.GetCustomAttribute <Interfaces.IProgramTerminated>();
                 if (terminated != null)
                 {
                     MethodInfo mi = t.GetMethod("Terminate", BindingFlags.NonPublic | BindingFlags.Static);
                     if (mi != null)
                     {
                         mi.Invoke(null, null);
                     }
                 }
             }
         } catch (Exception)
         {
         }
     }
     Application.Exit();
 }