aboutsummaryrefslogtreecommitdiff
path: root/Erable
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2021-02-01 22:13:46 -0500
committerAndrew Lee <alee14498@protonmail.com>2021-02-01 22:13:46 -0500
commitc7428fab1c38d29bcc50ee263678504e34d01318 (patch)
treebf5c4a63afc1513d361c6b18fd6c6cf3f0aaaa27 /Erable
parentd5f8e3f543e138b43fca95ed058345b9ab446d2f (diff)
downloaderable-godot-c7428fab1c38d29bcc50ee263678504e34d01318.tar.gz
erable-godot-c7428fab1c38d29bcc50ee263678504e34d01318.tar.bz2
erable-godot-c7428fab1c38d29bcc50ee263678504e34d01318.zip
Moved project files
Diffstat (limited to 'Erable')
-rw-r--r--Erable/App.axaml12
-rw-r--r--Erable/App.axaml.cs29
-rw-r--r--Erable/Assets/avalonia-logo.icobin0 -> 176111 bytes
-rw-r--r--Erable/Erable.csproj19
-rw-r--r--Erable/Program.cs23
-rw-r--r--Erable/ViewLocator.cs32
-rw-r--r--Erable/ViewModels/MainWindowViewModel.cs36
-rw-r--r--Erable/ViewModels/ViewModelBase.cs11
-rw-r--r--Erable/Views/MainWindow.axaml20
-rw-r--r--Erable/Views/MainWindow.axaml.cs22
10 files changed, 204 insertions, 0 deletions
diff --git a/Erable/App.axaml b/Erable/App.axaml
new file mode 100644
index 0000000..992dbfb
--- /dev/null
+++ b/Erable/App.axaml
@@ -0,0 +1,12 @@
+<Application xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:Erable"
+ x:Class="Erable.App">
+ <Application.DataTemplates>
+ <local:ViewLocator/>
+ </Application.DataTemplates>
+
+ <Application.Styles>
+ <FluentTheme Mode="Dark"/>
+ </Application.Styles>
+</Application>
diff --git a/Erable/App.axaml.cs b/Erable/App.axaml.cs
new file mode 100644
index 0000000..addd072
--- /dev/null
+++ b/Erable/App.axaml.cs
@@ -0,0 +1,29 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using Erable.ViewModels;
+using Erable.Views;
+
+namespace Erable
+{
+ 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/Erable/Assets/avalonia-logo.ico b/Erable/Assets/avalonia-logo.ico
new file mode 100644
index 0000000..da8d49f
--- /dev/null
+++ b/Erable/Assets/avalonia-logo.ico
Binary files differ
diff --git a/Erable/Erable.csproj b/Erable/Erable.csproj
new file mode 100644
index 0000000..b10f530
--- /dev/null
+++ b/Erable/Erable.csproj
@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>WinExe</OutputType>
+ <TargetFramework>net5.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ <RootNamespace>Erable</RootNamespace>
+ </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" />
+ <PackageReference Include="gstreamer-sharp-netcore" Version="0.0.8" />
+ </ItemGroup>
+</Project>
diff --git a/Erable/Program.cs b/Erable/Program.cs
new file mode 100644
index 0000000..312bbb4
--- /dev/null
+++ b/Erable/Program.cs
@@ -0,0 +1,23 @@
+using System;
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.ReactiveUI;
+
+namespace Erable
+{
+ 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/Erable/ViewLocator.cs b/Erable/ViewLocator.cs
new file mode 100644
index 0000000..0a6eb01
--- /dev/null
+++ b/Erable/ViewLocator.cs
@@ -0,0 +1,32 @@
+using System;
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using Erable.ViewModels;
+
+namespace Erable
+{
+ 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/Erable/ViewModels/MainWindowViewModel.cs b/Erable/ViewModels/MainWindowViewModel.cs
new file mode 100644
index 0000000..0c51fbd
--- /dev/null
+++ b/Erable/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Avalonia.Controls;
+using Gst;
+
+namespace Erable.ViewModels
+{
+ public class MainWindowViewModel : ViewModelBase
+ {
+ public string Greeting => "Welcome to Erable Audio Player!";
+
+ public void PlayFunction(string[] args)
+ {
+ Application.Init(ref args);
+ // Build the pipeline
+ var pipeline = Parse.Launch("playbin uri=file:///home/andrew/Music/4616-werq-by-kevin-macleod.mp3");
+
+ // Start playing
+ pipeline.SetState(State.Playing);
+
+ // Wait until error or EOS
+ var bus = pipeline.Bus;
+ var msg = bus.TimedPopFiltered (Constants.CLOCK_TIME_NONE, MessageType.Eos | MessageType.Error);
+
+ // Free resources
+ //pipeline.SetState (State.Null);
+ }
+
+ public void BrowseFunction()
+ {
+ //OpenFileDialog dialog = new OpenFileDialog();
+ //dialog.Filters.Add(new FileDialogFilter() {Name = "Audio Files", Extensions = {"mp3"}});
+ }
+ }
+}
diff --git a/Erable/ViewModels/ViewModelBase.cs b/Erable/ViewModels/ViewModelBase.cs
new file mode 100644
index 0000000..6ab8d21
--- /dev/null
+++ b/Erable/ViewModels/ViewModelBase.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ReactiveUI;
+
+namespace Erable.ViewModels
+{
+ public class ViewModelBase : ReactiveObject
+ {
+ }
+}
diff --git a/Erable/Views/MainWindow.axaml b/Erable/Views/MainWindow.axaml
new file mode 100644
index 0000000..6bb4cd1
--- /dev/null
+++ b/Erable/Views/MainWindow.axaml
@@ -0,0 +1,20 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:Erable.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="Erable.Views.MainWindow"
+ Icon="/Assets/avalonia-logo.ico"
+ Title="Erable">
+
+ <Design.DataContext>
+ <vm:MainWindowViewModel/>
+ </Design.DataContext>
+ <StackPanel>
+ <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+ <Button Name="PlayButton" Width="80" Command="{Binding PlayFunction}" >Play</Button>
+ <Button Name="StopButton" Width="80" >Stop</Button>
+ <Button Name="BrowseButton" Width="80" Command="{Binding BrowseFunction }" >Browse</Button>
+ </StackPanel>
+</Window>
diff --git a/Erable/Views/MainWindow.axaml.cs b/Erable/Views/MainWindow.axaml.cs
new file mode 100644
index 0000000..814bc0f
--- /dev/null
+++ b/Erable/Views/MainWindow.axaml.cs
@@ -0,0 +1,22 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace Erable.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