14 changed files with 93 additions and 56 deletions
@ -1,14 +1,15 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace Previewer |
|||
{ |
|||
public class App : Application |
|||
{ |
|||
public override void Initialize() |
|||
protected override void OnStartup(StartupEventArgs e) |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
// 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 |
|||
{ |
|||
public class ExitEventArgs : EventArgs |
|||
{ |
|||
public int ApplicationExitCode { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
// 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 |
|||
{ |
|||
public class StartupEventArgs : EventArgs |
|||
{ |
|||
private string[] _args; |
|||
|
|||
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