App.xaml.cs
上传用户:liuqi822
上传日期:2022-03-21
资源大小:88k
文件大小:1k
源码类别:

屏幕保护

开发平台:

Visual C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Windows;
  7. using System.Globalization;
  8. using System.Runtime.InteropServices;
  9. namespace Screensaver1
  10. {
  11.     /// <summary>
  12.     /// Interaction logic for App.xaml
  13.     /// </summary>
  14.     public partial class App : Application
  15.     {
  16.         private void Application_Startup(object sender, StartupEventArgs e)
  17.         {
  18.             if (e.Args.Length > 0)
  19.             {
  20.                 string mode = e.Args[0].ToLower(CultureInfo.InvariantCulture);
  21.                 if (mode.StartsWith("/c"))
  22.                 {
  23.                     ShowConfiguration();
  24.                     return;
  25.                 }
  26.                 else if (mode.StartsWith("/p"))
  27.                 {
  28.                     ShowPreview();
  29.                     return;
  30.                 }
  31.             }
  32.             ShowScreensaver();
  33.         }
  34.         private void ShowScreensaver()
  35.         {
  36.             ScreensaverWindow screensaver = new ScreensaverWindow();
  37.             screensaver.Show();
  38.         }
  39.         private void ShowPreview()
  40.         {
  41.             Application.Current.Shutdown();
  42.         }
  43.         private void ShowConfiguration()
  44.         {
  45.             SettingsWindow settings = new SettingsWindow();
  46.             settings.Show();
  47.         }
  48.     }
  49. }