Browse Source

Add xml comments

pull/2442/head
Benedikt Schroeder 7 years ago
parent
commit
d25fba75e5
  1. 47
      src/Avalonia.Controls/Application.cs
  2. 6
      src/Avalonia.Controls/ExitEventArgs.cs
  3. 9
      src/Avalonia.Controls/IApplicationLifecycle.cs
  4. 6
      src/Avalonia.Controls/StartupEventArgs.cs

47
src/Avalonia.Controls/Application.cs

@ -206,15 +206,25 @@ namespace Avalonia
/// </summary>
public virtual void Initialize() { }
/// <summary>
/// Runs the application's main loop.
/// This will return when the <see cref="Avalonia.ShutdownMode"/> condition is met
/// or <see cref="Shutdown()"/> was called.
/// </summary>
/// <returns>The application's exit code that is passed on the operating system.</returns>
public int Run()
{
return Run(new CancellationTokenSource());
}
/// <summary>
/// Runs the application's main loop until the <see cref="ICloseable"/> is closed.
/// Runs the application's main loop.
/// This will return when the <see cref="Avalonia.ShutdownMode"/> condition is met
/// or <see cref="Shutdown()"/> was called.
/// This also returns when <see cref="ICloseable"/> is closed.
/// </summary>
/// <param name="closable">The closable to track</param>
/// <param name="closable">The closable to track.</param>
/// <returns>The application's exit code that is passed on the operating system.</returns>
public int Run(ICloseable closable)
{
closable.Closed += (s, e) => _mainLoopCancellationTokenSource?.Cancel();
@ -223,9 +233,13 @@ namespace Avalonia
}
/// <summary>
/// Runs the application's main loop until some condition occurs that is specified by ExitMode.
/// Runs the application's main loop.
/// This will return when the <see cref="Avalonia.ShutdownMode"/> condition is met
/// or <see cref="Shutdown()"/> was called.
/// </summary>
/// <param name="mainWindow">The main window</param>
/// <param name="mainWindow">The window that is used as <see cref="MainWindow"/>
/// when the <see cref="MainWindow"/> isn't already set.</param>
/// <returns>The application's exit code that is passed on the operating system.</returns>
public int Run(Window mainWindow)
{
if (mainWindow == null)
@ -248,11 +262,14 @@ namespace Avalonia
return Run(new CancellationTokenSource());
}
/// <summary>
/// Runs the application's main loop until the <see cref="CancellationToken"/> is canceled.
/// Runs the application's main loop.
/// This will return when the <see cref="Avalonia.ShutdownMode"/> condition is met
/// or <see cref="Shutdown()"/> was called.
/// This also returns when the <see cref="CancellationToken"/> is canceled.
/// </summary>
/// <param name="token">The token to track</param>
/// <returns>The application's exit code that is passed on the operating system.</returns>
/// <param name="token">The token to track.</param>
public int Run(CancellationToken token)
{
return Run(CancellationTokenSource.CreateLinkedTokenSource(token));
@ -284,24 +301,26 @@ namespace Avalonia
return _exitCode;
}
/// <summary>
/// Raises the <see cref="Startup"/> event.
/// </summary>
/// <param name="e">A <see cref="StartupEventArgs"/> that contains the event data.</param>
protected virtual void OnStartup(StartupEventArgs e)
{
Startup?.Invoke(this, e);
}
/// <summary>
/// Raises the <see cref="Exit"/> event.
/// </summary>
/// <param name="e">A <see cref="ExitEventArgs"/> that contains the event data.</param>
protected virtual void OnExit(ExitEventArgs e)
{
Exit?.Invoke(this, e);
}
/// <inheritdoc/>
public void Shutdown()
{
Shutdown(0);
}
/// <inheritdoc/>
public void Shutdown(int exitCode)
public void Shutdown(int exitCode = 0)
{
if (IsShuttingDown)
{

6
src/Avalonia.Styling/Controls/ExitEventArgs.cs → src/Avalonia.Controls/ExitEventArgs.cs

@ -5,8 +5,14 @@ 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; }
}
}

9
src/Avalonia.Controls/IApplicationLifecycle.cs

@ -18,14 +18,9 @@ namespace Avalonia.Controls
event EventHandler<ExitEventArgs> Exit;
/// <summary>
/// Shuts down an application that returns the specified exit code to the operating system.
/// </summary>
void Shutdown();
/// <summary>
/// Shuts down an application that returns the specified exit code to the operating system.
/// Shuts down the application and sets the exit code that is returned to the operating system when the application exits.
/// </summary>
/// <param name="exitCode">An integer exit code for an application. The default exit code is 0.</param>
void Shutdown(int exitCode);
void Shutdown(int exitCode = 0);
}
}

6
src/Avalonia.Styling/Controls/StartupEventArgs.cs → src/Avalonia.Controls/StartupEventArgs.cs

@ -7,10 +7,16 @@ 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 command line arguments that were passed to the application.
/// </summary>
public IReadOnlyList<string> Args => _args ?? (_args = GetArgs());
private static string[] GetArgs()
Loading…
Cancel
Save