From e81e3817c0a4b735da47e6c45529c6f88ed4d52f Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 8 Feb 2021 21:27:18 -0500 Subject: Moved playback to backend; Menu; Size now matches --- Erable/ViewModels/MainWindowViewModel.cs | 33 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'Erable/ViewModels/MainWindowViewModel.cs') diff --git a/Erable/ViewModels/MainWindowViewModel.cs b/Erable/ViewModels/MainWindowViewModel.cs index ab41886..899b49c 100644 --- a/Erable/ViewModels/MainWindowViewModel.cs +++ b/Erable/ViewModels/MainWindowViewModel.cs @@ -1,40 +1,26 @@ -using System.Threading; +using System; +using System.Threading; using Avalonia.Controls; using Erable.Views; -using Gst; +using Sirop.Backend; namespace Erable.ViewModels { public class MainWindowViewModel : ViewModelBase { - public string Greeting => "Welcome to Erable Audio Player!"; public void PlayFunction() { - Thread t = new (AudioPlay); + Thread t = new (Playback.PlayAudio); t.Start(); } - - static void AudioPlay() - { - Application.Init(); - // 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 StopFunction() + { } - - public async void BrowseFunction() + public void BrowseFunction() { var dialog = new OpenFileDialog(); // dialog.Title @@ -61,6 +47,11 @@ namespace Erable.ViewModels { MessageBox.Show(new MainWindow(), "Hello world", "Test Title", MessageBox.MessageBoxButtons.Ok); } + + public void Quit() + { + Environment.Exit(0); + } } } -- cgit v1.2.3