本文整理汇总了C#中Media.Play方法的典型用法代码示例。如果您正苦于以下问题:C# Media.Play方法的具体用法?C# Media.Play怎么用?C# Media.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media.Play方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FrmMain_Load
//.........这里部分代码省略.........
var startHoverName = ini.Read("StartButton", "Hover");
var startDownName = ini.Read("StartButton", "Down");
var startDisabledName = ini.Read("StartButton", "Disabled");
var startNormalPath = Path.Combine(assemblyName, startNormalName);
var startHoverPath = Path.Combine(assemblyName, startHoverName);
var startDownPath = Path.Combine(assemblyName, startDownName);
var startDisabledPath = Path.Combine(assemblyName, startDisabledName);
var patchWidth = ini.ReadInt32("PatchNotes", "Width");
var patchHeight = ini.ReadInt32("PatchNotes", "Height");
var patchX = ini.ReadInt32("PatchNotes", "X");
var patchY = ini.ReadInt32("PatchNotes", "Y");
var patchUrl = ini.Read("PatchNotes", "Url");
var statusX = ini.ReadInt32("Status", "X");
var statusY = ini.ReadInt32("Status", "Y");
var packagesUrl = ini.Read("Packages", "Url").Trim();
var packagesList = ini.Read("Packages", "List").Trim();
if (!packagesUrl.EndsWith("/"))
packagesUrl += "/";
exeName = ini.Read("Client", "Exe");
exeParameters = ini.Read("Client", "Parameters");
var bgm = ini.Read("Features", "Bgm");
// Check images
foreach (var check in new string[] { windowImageName, closeNormalName, startNormalName })
{
if (!File.Exists(Path.Combine(assemblyName, check)))
{
MessageBox.Show(string.Format(Lang.ImageNotFound, check), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
// Check optional images
foreach (var check in new string[] { closeHoverName, closeDownName, startHoverName, startDownName, startDisabledName })
{
if (string.IsNullOrWhiteSpace(check))
continue;
if (!File.Exists(Path.Combine(assemblyName, check)))
{
MessageBox.Show(string.Format(Lang.ImageNotFound, check), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
}
// Set window
BackgroundImage = new Bitmap(windowImagePath);
Width = BackgroundImage.Width;
Height = BackgroundImage.Height;
// Set patch notes
WebPatchNotes.Width = patchWidth;
WebPatchNotes.Height = patchHeight;
WebPatchNotes.Left = patchX;
WebPatchNotes.Top = patchY;
WebPatchNotes.Navigate(patchUrl);
// Set close button
BtnClose.ImageNormal = new Bitmap(closeNormalPath);
BtnClose.Width = BtnClose.ImageNormal.Width;
BtnClose.Height = BtnClose.ImageNormal.Height;
BtnClose.Left = closeX;
BtnClose.Top = closeY;
if (!string.IsNullOrWhiteSpace(closeHoverName)) BtnClose.ImageHover = new Bitmap(closeHoverPath);
if (!string.IsNullOrWhiteSpace(closeDownName)) BtnClose.ImageDown = new Bitmap(closeDownPath);
// Set start button
BtnStart.ImageNormal = new Bitmap(startNormalPath);
BtnStart.Width = BtnStart.ImageNormal.Width;
BtnStart.Height = BtnStart.ImageNormal.Height;
BtnStart.Left = startX;
BtnStart.Top = startY;
if (!string.IsNullOrWhiteSpace(startHoverName)) BtnStart.ImageHover = new Bitmap(startHoverPath);
if (!string.IsNullOrWhiteSpace(startDownName)) BtnStart.ImageDown = new Bitmap(startDownPath);
if (!string.IsNullOrWhiteSpace(startDisabledName)) BtnStart.ImageDisabled = new Bitmap(startDisabledPath);
BtnStart.Enabled = false;
// Set status
LblStatus.BackColor = Color.Transparent;
LblStatus.Left = statusX;
LblStatus.Top = statusY;
LblStatus.Text = "";
// Patch
LblStatus.Text = Lang.CheckingDownloads;
// Use a task so it doesn't block
Task.Factory.StartNew(() => DownloadPackages(packagesUrl, packagesList));
if (File.Exists(bgm))
{
var media = new Media();
media.Play(bgm, this);
}
}