Skip to content

Commit ee1e70a

Browse files
authored
Merge pull request #16 from markjamesm/open-stream
- Started work on an open audio stream dialog.
2 parents 6d941bd + b8fa17e commit ee1e70a

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/view/Gui.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public void Start()
5757
{
5858
new MenuItem("_Open", "Open a music file", () => this.OpenFile()),
5959

60+
new MenuItem("_Open Stream", "Open a music stream", () => this.OpenStream()),
61+
6062
new MenuItem("_Quit", "Exit MusicSharp", () => Application.RequestStop()),
6163
}),
6264

@@ -208,5 +210,43 @@ private void OpenFile()
208210
this.player.Play(this.player.LastFileOpened);
209211
}
210212
}
211-
}
213+
214+
private void OpenStream()
215+
{
216+
var d = new Dialog("Open Stream", 50, 15);
217+
218+
// Type text here: ______
219+
var editLabel = new Label("Enter the url of the audio stream to load\n(MP3 only):")
220+
{
221+
X = 0,
222+
Y = 0,
223+
Width = Dim.Fill(),
224+
};
225+
226+
var streamURL = new TextField(string.Empty)
227+
{
228+
X = 3,
229+
Y = 4,
230+
Width = 42,
231+
};
232+
233+
var loadStream = new Button(12, 7, "Load Stream");
234+
loadStream.Clicked += () =>
235+
{
236+
Application.RequestStop();
237+
};
238+
239+
var cancelStream = new Button(29, 7, "Cancel");
240+
cancelStream.Clicked += () =>
241+
{
242+
Application.RequestStop();
243+
};
244+
245+
d.AddButton(loadStream);
246+
d.AddButton(cancelStream);
247+
d.Add(editLabel, streamURL);
248+
Application.Run(d);
249+
}
250+
251+
}
212252
}

0 commit comments

Comments
 (0)