diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2021-02-01 01:05:42 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2021-02-01 01:05:42 -0500 |
| commit | fe46c308ef3eb1be3c39eca680e9b01b6b749336 (patch) | |
| tree | 6aa34c80cb7cc82f7553c5a039fb2c800052ef8f | |
| parent | 5822baba1d687aab4b1ceafbad2382ae6b4703c3 (diff) | |
| download | erable-godot-fe46c308ef3eb1be3c39eca680e9b01b6b749336.tar.gz erable-godot-fe46c308ef3eb1be3c39eca680e9b01b6b749336.tar.bz2 erable-godot-fe46c308ef3eb1be3c39eca680e9b01b6b749336.zip | |
Added project files
| -rw-r--r-- | .gitignore | 8 | ||||
| -rw-r--r-- | Alee Audio Player.csproj | 17 | ||||
| -rw-r--r-- | App.axaml | 12 | ||||
| -rw-r--r-- | App.axaml.cs | 29 | ||||
| -rw-r--r-- | Assets/avalonia-logo.ico | bin | 0 -> 176111 bytes | |||
| -rw-r--r-- | Program.cs | 23 | ||||
| -rw-r--r-- | ViewLocator.cs | 32 | ||||
| -rw-r--r-- | ViewModels/MainWindowViewModel.cs | 11 | ||||
| -rw-r--r-- | ViewModels/ViewModelBase.cs | 11 | ||||
| -rw-r--r-- | Views/MainWindow.axaml | 17 | ||||
| -rw-r--r-- | Views/MainWindow.axaml.cs | 22 |
11 files changed, 182 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d007509 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.idea/
+.vscode/
+.vs/
+
+bin/
+obj/
+
+*.user
\ No newline at end of file diff --git a/Alee Audio Player.csproj b/Alee Audio Player.csproj new file mode 100644 index 0000000..92eef67 --- /dev/null +++ b/Alee Audio Player.csproj @@ -0,0 +1,17 @@ +<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net5.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <Folder Include="Models\" />
+ <AvaloniaResource Include="Assets\**" />
+ </ItemGroup>
+ <ItemGroup>
+ <PackageReference Include="Avalonia" Version="0.10.0" />
+ <PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
+ <PackageReference Include="Avalonia.Diagnostics" Version="0.10.0" />
+ <PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
+ </ItemGroup>
+</Project>
diff --git a/App.axaml b/App.axaml new file mode 100644 index 0000000..ddd8046 --- /dev/null +++ b/App.axaml @@ -0,0 +1,12 @@ +<Application xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:Alee_Audio_Player"
+ x:Class="Alee_Audio_Player.App">
+ <Application.DataTemplates>
+ <local:ViewLocator/>
+ </Application.DataTemplates>
+
+ <Application.Styles>
+ <FluentTheme Mode="Light"/>
+ </Application.Styles>
+</Application>
diff --git a/App.axaml.cs b/App.axaml.cs new file mode 100644 index 0000000..0ddebe2 --- /dev/null +++ b/App.axaml.cs @@ -0,0 +1,29 @@ +using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using Alee_Audio_Player.ViewModels;
+using Alee_Audio_Player.Views;
+
+namespace Alee_Audio_Player
+{
+ public 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/Assets/avalonia-logo.ico b/Assets/avalonia-logo.ico Binary files differnew file mode 100644 index 0000000..da8d49f --- /dev/null +++ b/Assets/avalonia-logo.ico diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..ef72448 --- /dev/null +++ b/Program.cs @@ -0,0 +1,23 @@ +using System;
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.ReactiveUI;
+
+namespace Alee_Audio_Player
+{
+ 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.
+ 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<App>()
+ .UsePlatformDetect()
+ .LogToTrace()
+ .UseReactiveUI();
+ }
+}
diff --git a/ViewLocator.cs b/ViewLocator.cs new file mode 100644 index 0000000..ded617c --- /dev/null +++ b/ViewLocator.cs @@ -0,0 +1,32 @@ +using System;
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using Alee_Audio_Player.ViewModels;
+
+namespace Alee_Audio_Player
+{
+ public class ViewLocator : IDataTemplate
+ {
+ public bool SupportsRecycling => false;
+
+ public IControl Build(object data)
+ {
+ var name = data.GetType().FullName!.Replace("ViewModel", "View");
+ var type = Type.GetType(name);
+
+ if (type != null)
+ {
+ return (Control)Activator.CreateInstance(type)!;
+ }
+ else
+ {
+ 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/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..e0d82ae --- /dev/null +++ b/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,11 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Alee_Audio_Player.ViewModels
+{
+ public class MainWindowViewModel : ViewModelBase
+ {
+ public string Greeting => "Welcome to Avalonia!";
+ }
+}
diff --git a/ViewModels/ViewModelBase.cs b/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..b28eeb1 --- /dev/null +++ b/ViewModels/ViewModelBase.cs @@ -0,0 +1,11 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using ReactiveUI;
+
+namespace Alee_Audio_Player.ViewModels
+{
+ public class ViewModelBase : ReactiveObject
+ {
+ }
+}
diff --git a/Views/MainWindow.axaml b/Views/MainWindow.axaml new file mode 100644 index 0000000..a3d8dfb --- /dev/null +++ b/Views/MainWindow.axaml @@ -0,0 +1,17 @@ +<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:Alee_Audio_Player.ViewModels"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ x:Class="Alee_Audio_Player.Views.MainWindow"
+ Icon="/Assets/avalonia-logo.ico"
+ Title="Alee_Audio_Player">
+
+ <Design.DataContext>
+ <vm:MainWindowViewModel/>
+ </Design.DataContext>
+
+ <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+
+</Window>
diff --git a/Views/MainWindow.axaml.cs b/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..81f1a2c --- /dev/null +++ b/Views/MainWindow.axaml.cs @@ -0,0 +1,22 @@ +using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace Alee_Audio_Player.Views
+{
+ public class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}
\ No newline at end of file |
