Advertisement
WindowsTV

WillNowOpenForm1

May 21st, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.AddIn;
  7. using Cup.Extensibility;
  8. using Cup.Extensibility.Library;
  9. using System.Windows.Forms;
  10.  
  11.  
  12. namespace CuPAddIn
  13. {
  14.     [AddIn("CuPAddIn")]
  15.     public class AddInBase : ICuPAddIn
  16.     {
  17.         private static bool started = false;
  18.         private static Form1 form;
  19.  
  20.         public void OnBoot() { }
  21.  
  22.         public void OnExit()
  23.         {
  24.            if (form != null)
  25.             {
  26.                 form.Close();
  27.                 form.Dispose();
  28.             }
  29.             started = false;
  30.         }
  31.  
  32.         public void OnStart()
  33.         {
  34.             if (started)
  35.             {
  36.                 form.ShowDialog();
  37.             }
  38.             else
  39.             {
  40.                 ApiPipeline.Hook();
  41.                 form = new Form1();
  42.                 started = true;
  43.             }
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement