-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
74 lines (71 loc) · 2.71 KB
/
App.xaml.cs
File metadata and controls
74 lines (71 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// GLow screensaver
// Copyright(C) Stéphane VANPOPERYNGHE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or(at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
using System;
using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace GLow_Screensaver
{
/// <summary>
/// The application.
/// </summary>
public partial class App : System.Windows.Application
{
/// <summary>
/// The startup of the application. This method will get the command line arguments and will adapt the action
/// in function of them.
/// </summary>
/// <param name="sender">The objet sending the event.</param>
/// <param name="e">Argument for this event.</param>
private void Application_Startup(object sender, StartupEventArgs e)
{
// Get the parameters
string firstArg = null;
string secondArg = null;
if (e.Args.Length >= 1) firstArg = e.Args[0];
if (e.Args.Length >= 2) secondArg = e.Args[1];
// Display the preview
if ((firstArg != null) && (firstArg.ToUpper() == "/P") && (secondArg != null))
{
IntPtr previewWndHandle = new IntPtr(long.Parse(secondArg));
MainWindow _window = new MainWindow(previewWndHandle) { IsPreview = true };
}
// Display the screensaver
else if ((firstArg == null) || (firstArg.ToUpper() == "/S"))
{
// Display the screensaver on each screen
foreach (Screen screen in Screen.AllScreens)
{
MainWindow window = new MainWindow(screen.WorkingArea) { IsPreview = false };
window.Show();
}
}
// Show the settings dialog
else if ((firstArg.ToUpper() == "/C") || ((firstArg.ToUpper().StartsWith("/C:"))))
{
new SettingsDialog().ShowDialog();
}
// Just quit the application
else
{
App.Current.Shutdown();
}
}
}
}