Better seeking. Better interface

This commit is contained in:
2015-10-30 20:38:45 +01:00
parent 769f153e26
commit e80f9107c0
4 changed files with 220 additions and 66 deletions
+6 -3
View File
@@ -17,12 +17,12 @@ namespace MusicPlayer
public AudioState AState { get; set; } public AudioState AState { get; set; }
public BufferState BState { get; set; } public BufferState BState { get; set; }
public int Buffered { get { return Math.Min((int)((bufpos / (double)LengthBuffer) * 100), 100); } } public int Buffered { get { return Math.Min((int)((bufpos / (double)LengthBuffer) * 1000), 1000); } }
private long LengthBuffer { get; set; } private long LengthBuffer { get; set; }
private long bufpos = 0; private long bufpos = 0;
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 100), 100); } } public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
private long Length { get; set; } private long Length { get; set; }
private long playpos = 0; private long playpos = 0;
@@ -88,7 +88,7 @@ namespace MusicPlayer
if (position >= Buffered-1) if (position >= Buffered-1)
return; return;
seek = Length / 100 * position; seek = Length / 1000 * position;
AState = AudioState.SEEKING; AState = AudioState.SEEKING;
} }
@@ -100,6 +100,9 @@ namespace MusicPlayer
public void Pause() public void Pause()
{ {
if(CurrentSong == null)
AState = AudioState.STOPPED;
else
AState = AudioState.PAUSED; AState = AudioState.PAUSED;
} }
+127 -51
View File
@@ -35,6 +35,7 @@
this.AlbumListView = new System.Windows.Forms.ListView(); this.AlbumListView = new System.Windows.Forms.ListView();
this.ArtistListBox = new System.Windows.Forms.ListBox(); this.ArtistListBox = new System.Windows.Forms.ListBox();
this.MainPanel = new System.Windows.Forms.Panel(); this.MainPanel = new System.Windows.Forms.Panel();
this.PlaylistListLabel = new System.Windows.Forms.Label();
this.AlbumListLabel = new System.Windows.Forms.Label(); this.AlbumListLabel = new System.Windows.Forms.Label();
this.ArtistListLabel = new System.Windows.Forms.Label(); this.ArtistListLabel = new System.Windows.Forms.Label();
this.GenreListLabel = new System.Windows.Forms.Label(); this.GenreListLabel = new System.Windows.Forms.Label();
@@ -43,9 +44,14 @@
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ControlsPanel = new System.Windows.Forms.Panel(); this.ControlsPanel = new System.Windows.Forms.Panel();
this.CurrentSongLabel = new System.Windows.Forms.Label(); this.CurrentSongLabel = new System.Windows.Forms.Label();
this.SeperatorLabel = new System.Windows.Forms.Label(); this.SeperatorLabel = new System.Windows.Forms.Label();
@@ -58,18 +64,20 @@
this.PauseButton = new System.Windows.Forms.Button(); this.PauseButton = new System.Windows.Forms.Button();
this.PlayButton = new System.Windows.Forms.Button(); this.PlayButton = new System.Windows.Forms.Button();
this.UpdateTimer = new System.Windows.Forms.Timer(this.components); this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.PlaylistListLabel = new System.Windows.Forms.Label(); this.NotifyMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.NotifyMenuStripPlayingLabel = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.NotifyMenuStripPlayingSongLabel = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
this.MenuStrip.SuspendLayout(); this.MenuStrip.SuspendLayout();
this.ControlsPanel.SuspendLayout(); this.ControlsPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
this.NotifyMenuStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// SongsTableView // SongsTableView
@@ -150,6 +158,16 @@
this.MainPanel.Size = new System.Drawing.Size(784, 352); this.MainPanel.Size = new System.Drawing.Size(784, 352);
this.MainPanel.TabIndex = 5; this.MainPanel.TabIndex = 5;
// //
// PlaylistListLabel
//
this.PlaylistListLabel.AutoSize = true;
this.PlaylistListLabel.Location = new System.Drawing.Point(12, 8);
this.PlaylistListLabel.Name = "PlaylistListLabel";
this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13);
this.PlaylistListLabel.TabIndex = 7;
this.PlaylistListLabel.Text = "Playlist";
this.PlaylistListLabel.Visible = false;
//
// AlbumListLabel // AlbumListLabel
// //
this.AlbumListLabel.AutoSize = true; this.AlbumListLabel.AutoSize = true;
@@ -224,6 +242,18 @@
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Text = "Save";
// //
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(100, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// viewToolStripMenuItem // viewToolStripMenuItem
// //
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -233,6 +263,13 @@
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View"; this.viewToolStripMenuItem.Text = "View";
// //
// overviewToolStripMenuItem
//
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.overviewToolStripMenuItem.Text = "Overview";
this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
//
// playlistsToolStripMenuItem // playlistsToolStripMenuItem
// //
this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem"; this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem";
@@ -240,12 +277,26 @@
this.playlistsToolStripMenuItem.Text = "Playlists"; this.playlistsToolStripMenuItem.Text = "Playlists";
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click); this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
// //
// overviewToolStripMenuItem // playlistToolStripMenuItem
// //
this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem"; this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.saveToolStripMenuItem1,
this.overviewToolStripMenuItem.Text = "Overview"; this.loadToolStripMenuItem});
this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click); this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.playlistToolStripMenuItem.Text = "Playlist";
//
// saveToolStripMenuItem1
//
this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(100, 22);
this.saveToolStripMenuItem1.Text = "Save";
//
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.loadToolStripMenuItem.Text = "Load";
// //
// ControlsPanel // ControlsPanel
// //
@@ -308,10 +359,11 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.PositionTrackBar.Enabled = false; this.PositionTrackBar.Enabled = false;
this.PositionTrackBar.Location = new System.Drawing.Point(3, 3); this.PositionTrackBar.Location = new System.Drawing.Point(3, 3);
this.PositionTrackBar.Maximum = 100; this.PositionTrackBar.Maximum = 1000;
this.PositionTrackBar.Name = "PositionTrackBar"; this.PositionTrackBar.Name = "PositionTrackBar";
this.PositionTrackBar.Size = new System.Drawing.Size(778, 45); this.PositionTrackBar.Size = new System.Drawing.Size(778, 45);
this.PositionTrackBar.TabIndex = 7; this.PositionTrackBar.TabIndex = 7;
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
// //
// BufferLabel // BufferLabel
// //
@@ -333,6 +385,7 @@
// //
// StopButton // StopButton
// //
this.StopButton.Enabled = false;
this.StopButton.Location = new System.Drawing.Point(174, 51); this.StopButton.Location = new System.Drawing.Point(174, 51);
this.StopButton.Name = "StopButton"; this.StopButton.Name = "StopButton";
this.StopButton.Size = new System.Drawing.Size(75, 23); this.StopButton.Size = new System.Drawing.Size(75, 23);
@@ -343,6 +396,7 @@
// //
// PauseButton // PauseButton
// //
this.PauseButton.Enabled = false;
this.PauseButton.Location = new System.Drawing.Point(93, 51); this.PauseButton.Location = new System.Drawing.Point(93, 51);
this.PauseButton.Name = "PauseButton"; this.PauseButton.Name = "PauseButton";
this.PauseButton.Size = new System.Drawing.Size(75, 23); this.PauseButton.Size = new System.Drawing.Size(75, 23);
@@ -366,55 +420,69 @@
this.UpdateTimer.Interval = 150; this.UpdateTimer.Interval = 150;
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick); this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
// //
// notifyIcon1 // NotifyIcon
// //
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
this.notifyIcon1.Text = "notifyIcon1"; this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
this.notifyIcon1.Visible = true; this.NotifyIcon.Text = "NotifyIcon";
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); this.NotifyIcon.Visible = true;
this.NotifyIcon.Click += new System.EventHandler(this.NotifyIcon_Click);
// //
// PlaylistListLabel // NotifyMenuStrip
// //
this.PlaylistListLabel.AutoSize = true; this.NotifyMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.PlaylistListLabel.Location = new System.Drawing.Point(12, 8); this.NotifyMenuStripPlayingLabel,
this.PlaylistListLabel.Name = "PlaylistListLabel"; this.toolStripSeparator2,
this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13); this.NotifyMenuStripPlayButton,
this.PlaylistListLabel.TabIndex = 7; this.NotifyMenuStripPauseButton,
this.PlaylistListLabel.Text = "Playlist"; this.NotifyMenuStripStopButton});
this.PlaylistListLabel.Visible = false; this.NotifyMenuStrip.Name = "NotifyMenuStrip";
this.NotifyMenuStrip.Size = new System.Drawing.Size(119, 98);
// //
// playlistToolStripMenuItem // NotifyMenuStripPlayButton
// //
this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
this.saveToolStripMenuItem1, this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(152, 22);
this.loadToolStripMenuItem}); this.NotifyMenuStripPlayButton.Text = "Play";
this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem"; this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.playlistToolStripMenuItem.Text = "Playlist";
// //
// saveToolStripMenuItem1 // NotifyMenuStripPauseButton
// //
this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1"; this.NotifyMenuStripPauseButton.Enabled = false;
this.saveToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
this.saveToolStripMenuItem1.Text = "Save"; this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPauseButton.Text = "Pause";
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
// //
// loadToolStripMenuItem // NotifyMenuStripStopButton
// //
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; this.NotifyMenuStripStopButton.Enabled = false;
this.loadToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
this.loadToolStripMenuItem.Text = "Load"; this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripStopButton.Text = "Stop";
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
// //
// exitToolStripMenuItem // NotifyMenuStripPlayingLabel
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.NotifyMenuStripPlayingLabel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.NotifyMenuStripPlayingSongLabel});
this.exitToolStripMenuItem.Text = "Exit"; this.NotifyMenuStripPlayingLabel.Enabled = false;
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
// //
// toolStripSeparator1 // toolStripSeparator2
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6);
//
// NotifyMenuStripPlayingSongLabel
//
this.NotifyMenuStripPlayingSongLabel.Enabled = false;
this.NotifyMenuStripPlayingSongLabel.Name = "NotifyMenuStripPlayingSongLabel";
this.NotifyMenuStripPlayingSongLabel.Size = new System.Drawing.Size(152, 22);
this.NotifyMenuStripPlayingSongLabel.Text = "Stopped";
this.NotifyMenuStripPlayingSongLabel.Visible = false;
// //
// MainForm // MainForm
// //
@@ -439,6 +507,7 @@
this.ControlsPanel.ResumeLayout(false); this.ControlsPanel.ResumeLayout(false);
this.ControlsPanel.PerformLayout(); this.ControlsPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
this.NotifyMenuStrip.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -466,7 +535,7 @@
private System.Windows.Forms.TrackBar PositionTrackBar; private System.Windows.Forms.TrackBar PositionTrackBar;
private System.Windows.Forms.Label LabelTotalTime; private System.Windows.Forms.Label LabelTotalTime;
private System.Windows.Forms.Label LabelCurrentTime; private System.Windows.Forms.Label LabelCurrentTime;
private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.NotifyIcon NotifyIcon;
private System.Windows.Forms.Label CurrentSongLabel; private System.Windows.Forms.Label CurrentSongLabel;
private System.Windows.Forms.Label SeperatorLabel; private System.Windows.Forms.Label SeperatorLabel;
private System.Windows.Forms.Label AlbumListLabel; private System.Windows.Forms.Label AlbumListLabel;
@@ -481,6 +550,13 @@
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ContextMenuStrip NotifyMenuStrip;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPauseButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripStopButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingLabel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingSongLabel;
} }
} }
+78 -6
View File
@@ -29,8 +29,6 @@ namespace MusicPlayer
PositionTrackBar.Scroll += (s, e) => PositionTrackBar.Scroll += (s, e) =>
{ {
if (clicked)
return;
this.PositionTrackBar_ValueChanged(); this.PositionTrackBar_ValueChanged();
}; };
PositionTrackBar.MouseDown += (s, e) => PositionTrackBar.MouseDown += (s, e) =>
@@ -72,23 +70,77 @@ namespace MusicPlayer
private void UpdateTimer_Tick(object sender, EventArgs e) private void UpdateTimer_Tick(object sender, EventArgs e)
{ {
//Trackbar
if (main.audio.BState == AudioHandler.BufferState.DONE) if (main.audio.BState == AudioHandler.BufferState.DONE)
PositionTrackBar.Enabled = true; PositionTrackBar.Enabled = true;
else else
PositionTrackBar.Enabled = false; PositionTrackBar.Enabled = false;
BufferBar.Value = main.audio.Buffered;
if (!clicked) if (!clicked)
PositionTrackBar.Value = main.audio.Position; PositionTrackBar.Value = main.audio.Position;
//Buffer display
BufferBar.Value = main.audio.Buffered / 10;
//Time labels
if (!clicked)
LabelCurrentTime.Text = Main.SecondsToTimestamp(main.audio.CurrentTime); LabelCurrentTime.Text = Main.SecondsToTimestamp(main.audio.CurrentTime);
LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime); LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime);
//Current song label
if(main.audio.CurrentSong == null) if(main.audio.CurrentSong == null)
CurrentSongLabel.Text = "Not playing any songs"; CurrentSongLabel.Text = "Not playing any songs";
else else
CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name; CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name;
//Buttons and context menu
if(main.audio.AState == AudioHandler.AudioState.PLAYING)
{
PlayButton.Enabled = false;
NotifyMenuStripPlayButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Playing";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PlayButton.Enabled = true;
NotifyMenuStripPlayButton.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = false;
}
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
{
PauseButton.Enabled = false;
NotifyMenuStripPauseButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Paused";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PauseButton.Enabled = true;
NotifyMenuStripPauseButton.Enabled = true;
}
if (main.audio.AState == AudioHandler.AudioState.STOPPED)
{
StopButton.Enabled = false;
NotifyMenuStripStopButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Stopped";
NotifyMenuStripPlayingLabel.Enabled = false;
NotifyMenuStripPlayingSongLabel.Visible = false;
NotifyMenuStripPlayingSongLabel.Text = "Stopped";
}
else
{
StopButton.Enabled = true;
NotifyMenuStripStopButton.Enabled = true;
}
} }
private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e) private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e)
@@ -125,15 +177,20 @@ namespace MusicPlayer
private void PositionTrackBar_ValueChanged() private void PositionTrackBar_ValueChanged()
{ {
if(!clicked)
main.audio.Seek(PositionTrackBar.Value); main.audio.Seek(PositionTrackBar.Value);
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value/1000) * main.audio.CurrentSong.Seconds));
} }
private void notifyIcon1_Click(object sender, EventArgs e) private void NotifyIcon_Click(object sender, EventArgs e)
{ {
/*
if (p.Visible) if (p.Visible)
p.Visible = false; p.Visible = false;
else else
p.Visible = true; p.Visible = true;
*/
} }
private void overviewToolStripMenuItem_Click(object sender, EventArgs e) private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
@@ -175,5 +232,20 @@ namespace MusicPlayer
main.audio.AState = AudioHandler.AudioState.STOPPED; main.audio.AState = AudioHandler.AudioState.STOPPED;
System.Windows.Forms.Application.Exit(); System.Windows.Forms.Application.Exit();
} }
private void NotifyMenuStripPlayButton_Click(object sender, EventArgs e)
{
PlayButton_Click(sender, e);
}
private void NotifyMenuStripPauseButton_Click(object sender, EventArgs e)
{
PauseButton_Click(sender, e);
}
private void NotifyMenuStripStopButton_Click(object sender, EventArgs e)
{
StopButton_Click(sender, e);
}
} }
} }
+5 -2
View File
@@ -123,11 +123,14 @@
<metadata name="UpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="UpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>230, 22</value> <value>230, 22</value>
</metadata> </metadata>
<metadata name="notifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="NotifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>352, 22</value> <value>352, 22</value>
</metadata> </metadata>
<metadata name="NotifyMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>460, 22</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="notifyIcon1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="NotifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAEAgHAAAAEAIAAo5wAAFgAAACgAAACAAAAA4AAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAABAAEAgHAAAAEAIAAo5wAAFgAAACgAAACAAAAA4AAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA