committed by
GitHub
11 changed files with 259 additions and 113 deletions
@ -0,0 +1,18 @@ |
|||||
|
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
|
||||
|
using System; |
||||
|
|
||||
|
namespace Avalonia.Controls |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Contains the arguments for the <see cref="IApplicationLifecycle.Exit"/> event.
|
||||
|
/// </summary>
|
||||
|
public class ExitEventArgs : EventArgs |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets or sets the exit code that an application returns to the operating system when the application exits.
|
||||
|
/// </summary>
|
||||
|
public int ApplicationExitCode { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,26 +1,26 @@ |
|||||
// Copyright (c) The Avalonia Project. All rights reserved.
|
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
|
||||
namespace Avalonia |
namespace Avalonia.Controls |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Enum for ExitMode
|
/// Describes the possible values for <see cref="Application.ShutdownMode"/>.
|
||||
/// </summary>
|
/// </summary>
|
||||
public enum ExitMode |
public enum ShutdownMode |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Indicates an implicit call to Application.Exit when the last window closes.
|
/// Indicates an implicit call to Application.Shutdown when the last window closes.
|
||||
/// </summary>
|
/// </summary>
|
||||
OnLastWindowClose, |
OnLastWindowClose, |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// Indicates an implicit call to Application.Exit when the main window closes.
|
/// Indicates an implicit call to Application.Shutdown when the main window closes.
|
||||
/// </summary>
|
/// </summary>
|
||||
OnMainWindowClose, |
OnMainWindowClose, |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// Indicates that the application only exits on an explicit call to Application.Exit.
|
/// Indicates that the application only exits on an explicit call to Application.Shutdown.
|
||||
/// </summary>
|
/// </summary>
|
||||
OnExplicitExit |
OnExplicitShutdown |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
|
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace Avalonia.Controls |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Contains the arguments for the <see cref="IApplicationLifecycle.Startup"/> event.
|
||||
|
/// </summary>
|
||||
|
public class StartupEventArgs : EventArgs |
||||
|
{ |
||||
|
private string[] _args; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the command line arguments that were passed to the application.
|
||||
|
/// </summary>
|
||||
|
public IReadOnlyList<string> Args => _args ?? (_args = GetArgs()); |
||||
|
|
||||
|
private static string[] GetArgs() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
var args = Environment.GetCommandLineArgs(); |
||||
|
|
||||
|
return args.Length > 1 ? args.Skip(1).ToArray() : new string[0]; |
||||
|
} |
||||
|
catch (NotSupportedException) |
||||
|
{ |
||||
|
return new string[0]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue