📄 form1.cs
字号:
#region fox23
/*
* All rights reserved by Freesc Huang
* http://fox23.cnblogs.com
* hjd.click [AT] gmail.com
*/
#endregion
#region Using Directories
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.WindowsMobile.Forms;
#endregion
namespace wmpTest
{
public partial class Form1 : Form
{
private const UInt32 WM_CLOSE = 16;
private String arguments;
private String title;
private String fileName;
private WMPlayer player;
// private Boolean startTag;
public Form1()
{
InitializeComponent();
// startTag = false;
}
private void menuStop_Click(object sender, EventArgs e)
{
OpenFileDialog OFD = new OpenFileDialog();
OFD.Filter = "wma files|*.wma|mp3 files|*.mp3";
OFD.InitialDirectory = @"\Storage Card";
if (DialogResult.OK == OFD.ShowDialog())
{
fileName = OFD.FileName;
arguments = "\"" + fileName + "\" /fullscreen";
lb_NowPlaying.Text = System.IO.Path.GetFileName(fileName);
}
}
private void menuPlay_Click(object sender, EventArgs e)
{
if (player != null)
{
player.StopWMP();
this.Clear();
menuPlay.Text = "Start";
this.TopMost = false;
this.Text = this.title;
player = null;
}
else if (lb_NowPlaying.Text != "")
{
this.TopMost = true;
// arguments = @"""\Storage Card\yesterday.wma"" /fullscreen";
player = new WMPlayer(arguments);
player.StartWMP();
this.title = this.Text;
this.Text = "Playing...";
lb_AlbumName.Text = player.PlayingTrack;
lb_Style.Text = "Style: " + player.Style;
lb_Artist.Text = "Artist: " + player.Artist;
lb_AlbumName.Text = "Album: " + player.Album;
lb_BRate.Text = "Bitrate: " + player.BitRate;
menuPlay.Text = "Stop";
}
else
{
//TODO:
//to optimize this code :)
}
}
private void Clear()
{
lb_Style.Text = "";
lb_NowPlaying.Text = "";
lb_Artist.Text = "";
lb_AlbumName.Text = "";
lb_BRate.Text = "";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -