Bunch of screensavers in Windows
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

71 righe
2.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6. namespace GameOfLife
  7. {
  8. static class Program
  9. {
  10. /// <summary>
  11. /// The main entry point for the application.
  12. /// </summary>
  13. [STAThread]
  14. static void Main(string[] args)
  15. {
  16. Application.SetHighDpiMode(HighDpiMode.SystemAware);
  17. Application.EnableVisualStyles();
  18. Application.SetCompatibleTextRenderingDefault(false);
  19. if (args.Length > 0)
  20. {
  21. string firstArgument = args[0].ToLower().Trim();
  22. string secondArgument = null;
  23. // Handle cases where arguments are separated by colon.
  24. // Examples: /c:1234567 or /P:1234567
  25. if (firstArgument.Length > 2)
  26. {
  27. secondArgument = firstArgument.Substring(3).Trim();
  28. firstArgument = firstArgument.Substring(0, 2);
  29. }
  30. else if (args.Length > 1)
  31. secondArgument = args[1];
  32. if (firstArgument == "/c") // Configuration mode
  33. {
  34. // TODO
  35. }
  36. else if (firstArgument == "/p") // Preview mode
  37. {
  38. // TODO
  39. }
  40. else if (firstArgument == "/s") // Full-screen mode
  41. {
  42. ShowScreenSaver();
  43. Application.Run();
  44. }
  45. else // Undefined argument
  46. {
  47. MessageBox.Show("Sorry, but the command line argument \"" + firstArgument +
  48. "\" is not valid.", "ScreenSaver",
  49. MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  50. }
  51. }
  52. else // No arguments - treat like /c
  53. {
  54. // TODO
  55. }
  56. }
  57. static void ShowScreenSaver()
  58. {
  59. foreach (Screen screen in Screen.AllScreens) {
  60. MainForm form = new MainForm(screen.Bounds);
  61. form.Show();
  62. }
  63. }
  64. }
  65. }