code_junkie

Opening a “known file type” into running instance of custom app - .NET

Nov 13th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // This should all be refactored to make it less tightly-coupled, obviously.
  2. class MyWindowsApplicationBase : WindowsFormsApplicationBase
  3. {
  4. internal MyWindowsApplicationBase() : base()
  5. {
  6. // This is a single instance application.
  7. this.IsSingleInstance = true;
  8.  
  9. // Set to the instance of your form to run.
  10. this.MainForm = new MyForm();
  11. }
  12. }
  13.  
  14. // This should all be refactored to make it less tightly-coupled, obviously.
  15. public static void Main(string args[])
  16. {
  17. // Process the args.
  18. <process args here>
  19.  
  20. // Create the application base.
  21. MyWindowsApplicationBase appBase = new MyWindowsApplicationBase();
  22.  
  23. // <1> Set the StartupNextInstance event handler.
  24. appBase.StartupNextInstance = <event handler code>;
  25.  
  26. // Show the main form of the app.
  27. appBase.Run(args);
  28. }
Add Comment
Please, Sign In to add comment