csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
using System;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using Avalonia.DesignerSupport;
|
|
using Avalonia.Markup.Xaml;
|
|
|
|
namespace Avalonia.Designer.HostApp
|
|
{
|
|
class Program
|
|
{
|
|
#if NET462
|
|
private static string s_appDir;
|
|
|
|
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
|
{
|
|
string assemblyPath = Path.Combine(s_appDir, new AssemblyName(args.Name).Name + ".dll");
|
|
if (File.Exists(assemblyPath) == false) return null;
|
|
return Assembly.LoadFile(assemblyPath);
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
s_appDir = Directory.GetCurrentDirectory();
|
|
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
|
foreach (var dll in Directory.GetFiles(s_appDir, "*.dll"))
|
|
{
|
|
try
|
|
{
|
|
Console.WriteLine("Loading " + dll);
|
|
Assembly.LoadFile(dll);
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
}
|
|
Exec(args);
|
|
}
|
|
|
|
static void Exec(string[] args)
|
|
#else
|
|
public static void Main(string[] args)
|
|
#endif
|
|
{
|
|
AvaloniaLocator.CurrentMutable.Bind<AvaloniaXamlLoader.IRuntimeXamlLoader>()
|
|
.ToConstant(new DesignXamlLoader());
|
|
Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(args);
|
|
}
|
|
}
|
|
}
|
|
|