Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions src/view/Tui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MusicSharp
{
using System;
using System.Collections.Generic;
using Terminal.Gui;

Expand Down Expand Up @@ -54,37 +55,37 @@ public void Start()
// Create the menubar.
var menu = new MenuBar(new MenuBarItem[]
{
new MenuBarItem("_File", new MenuItem[]
{
new MenuItem("_Open", "Open a music file", () => this.OpenFile()),
new MenuBarItem("_File", new MenuItem[]
{
new MenuItem("_Open", "Open a music file", () => this.OpenFile()),

new MenuItem("Open S_tream", "Open a music stream", () => this.OpenStream()),
new MenuItem("Open S_tream", "Open a music stream", () => this.OpenStream()),

new MenuItem("_Quit", "Exit MusicSharp", () => Application.RequestStop()),
}),
new MenuItem("_Quit", "Exit MusicSharp", () => Application.RequestStop()),
}),

new MenuBarItem("_Playlists", new MenuItem[]
{
new MenuItem("Open Pla_ylist", string.Empty, () =>
new MenuBarItem("_Playlists", new MenuItem[]
{
MessageBox.Query("Notice", "\nFeature not yet implemented.\n ", "Close");
new MenuItem("Open Pla_ylist", string.Empty, () =>
{
MessageBox.Query("Notice", "\nFeature not yet implemented.\n ", "Close");
}),
}),
}),

new MenuBarItem("_Help", new MenuItem[]
{
new MenuItem("_About MusicSharp", string.Empty, () =>
new MenuBarItem("_Help", new MenuItem[]
{
MessageBox.Query("Music Sharp 0.6.6", "\nMusic Sharp is a lightweight CLI\n music player written in C#.\n\nDeveloped by Mark-James McDougall\nand licensed under the GPL v3.\n ", "Close");
new MenuItem("_About MusicSharp", string.Empty, () =>
{
MessageBox.Query("Music Sharp 0.6.6", "\nMusic Sharp is a lightweight CLI\n music player written in C#.\n\nDeveloped by Mark-James McDougall\nand licensed under the GPL v3.\n ", "Close");
}),
}),
}),
});

statusBar = new StatusBar(new StatusItem[]
{
new StatusItem(Key.F1, "~F1~ Open file", () => this.OpenFile()),
new StatusItem(Key.F2, "~F2~ Open stream", () => this.OpenStream()),
new StatusItem(Key.F3, "~F3~ Quit", () => Application.RequestStop()),
new StatusItem(Key.F1, "~F1~ Open file", () => this.OpenFile()),
new StatusItem(Key.F2, "~F2~ Open stream", () => this.OpenStream()),
new StatusItem(Key.F3, "~F3~ Quit", () => Application.RequestStop()),
});

// Create the playback controls frame.
Expand Down Expand Up @@ -216,6 +217,8 @@ private void OpenFile()
{
var d = new OpenDialog("Open", "Open an audio file") { AllowsMultipleSelection = false };

d.DirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

// This will filter the dialog on basis of the allowed file types in the array.
d.AllowedFileTypes = new string[] { ".mp3", ".wav", ".flac" };
Application.Run(d);
Expand Down