commit d0924ef5e7fb1c3271eb391c25db1e9ccbcc60b8 Author: hinuiiik Date: Thu Jul 13 12:45:22 2023 -0400 . diff --git a/AutumnLauncher.sln b/AutumnLauncher.sln new file mode 100644 index 0000000..09cfbc8 --- /dev/null +++ b/AutumnLauncher.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutumnLauncher", "AutumnLauncher\AutumnLauncher.csproj", "{9A7C9986-943E-48C6-B0F3-96A0BBA925D1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9A7C9986-943E-48C6-B0F3-96A0BBA925D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A7C9986-943E-48C6-B0F3-96A0BBA925D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A7C9986-943E-48C6-B0F3-96A0BBA925D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A7C9986-943E-48C6-B0F3-96A0BBA925D1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/AutumnLauncher/App.axaml b/AutumnLauncher/App.axaml new file mode 100644 index 0000000..3bdb216 --- /dev/null +++ b/AutumnLauncher/App.axaml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/AutumnLauncher/App.axaml.cs b/AutumnLauncher/App.axaml.cs new file mode 100644 index 0000000..29f9636 --- /dev/null +++ b/AutumnLauncher/App.axaml.cs @@ -0,0 +1,28 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using AutumnLauncher.ViewModels; +using AutumnLauncher.Views; + +namespace AutumnLauncher; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow + { + DataContext = new MainWindowViewModel(), + }; + } + + base.OnFrameworkInitializationCompleted(); + } +} \ No newline at end of file diff --git a/AutumnLauncher/Assets/avalonia-logo.ico b/AutumnLauncher/Assets/avalonia-logo.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/AutumnLauncher/Assets/avalonia-logo.ico differ diff --git a/AutumnLauncher/AutumnLauncher.csproj b/AutumnLauncher/AutumnLauncher.csproj new file mode 100644 index 0000000..b37075d --- /dev/null +++ b/AutumnLauncher/AutumnLauncher.csproj @@ -0,0 +1,26 @@ + + + WinExe + net7.0 + enable + true + app.manifest + true + + + + + + + + + + + + + + + + + + diff --git a/AutumnLauncher/Program.cs b/AutumnLauncher/Program.cs new file mode 100644 index 0000000..dae8d7c --- /dev/null +++ b/AutumnLauncher/Program.cs @@ -0,0 +1,23 @@ +using Avalonia; +using Avalonia.ReactiveUI; +using System; + +namespace AutumnLauncher; + +class Program +{ + // Initialization code. Don't use any Avalonia, third-party APIs or any + // SynchronizationContext-reliant code before AppMain is called: things aren't initialized + // yet and stuff might break. + [STAThread] + public static void Main(string[] args) => BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); + + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .WithInterFont() + .LogToTrace() + .UseReactiveUI(); +} \ No newline at end of file diff --git a/AutumnLauncher/ViewLocator.cs b/AutumnLauncher/ViewLocator.cs new file mode 100644 index 0000000..2985eb7 --- /dev/null +++ b/AutumnLauncher/ViewLocator.cs @@ -0,0 +1,27 @@ +using System; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using AutumnLauncher.ViewModels; + +namespace AutumnLauncher; + +public class ViewLocator : IDataTemplate +{ + public Control Build(object data) + { + var name = data.GetType().FullName!.Replace("ViewModel", "View"); + var type = Type.GetType(name); + + if (type != null) + { + return (Control)Activator.CreateInstance(type)!; + } + + return new TextBlock { Text = "Not Found: " + name }; + } + + public bool Match(object data) + { + return data is ViewModelBase; + } +} \ No newline at end of file diff --git a/AutumnLauncher/ViewModels/MainWindowViewModel.cs b/AutumnLauncher/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..2592d1c --- /dev/null +++ b/AutumnLauncher/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,6 @@ +namespace AutumnLauncher.ViewModels; + +public class MainWindowViewModel : ViewModelBase +{ + public string Greeting => "Welcome to Avalonia!"; +} \ No newline at end of file diff --git a/AutumnLauncher/ViewModels/ViewModelBase.cs b/AutumnLauncher/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..d5a1041 --- /dev/null +++ b/AutumnLauncher/ViewModels/ViewModelBase.cs @@ -0,0 +1,7 @@ +using ReactiveUI; + +namespace AutumnLauncher.ViewModels; + +public class ViewModelBase : ReactiveObject +{ +} \ No newline at end of file diff --git a/AutumnLauncher/Views/MainWindow.axaml b/AutumnLauncher/Views/MainWindow.axaml new file mode 100644 index 0000000..1bf7f82 --- /dev/null +++ b/AutumnLauncher/Views/MainWindow.axaml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/AutumnLauncher/Views/MainWindow.axaml.cs b/AutumnLauncher/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..0949d13 --- /dev/null +++ b/AutumnLauncher/Views/MainWindow.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace AutumnLauncher.Views; + +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/AutumnLauncher/app.manifest b/AutumnLauncher/app.manifest new file mode 100644 index 0000000..e547540 --- /dev/null +++ b/AutumnLauncher/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + +