Skip to content

Commit

Permalink
Changed sound effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYFDroid committed Nov 10, 2019
1 parent 8104ac8 commit 344b3e2
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 8 deletions.
20 changes: 14 additions & 6 deletions Watch/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (getTotalTime() != 0)
{

askSound.Play();
if (MessageBox.Show("是否覆盖当前的计时?", "打开计时", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; }

}
Expand All @@ -440,10 +440,12 @@ private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (getTotalTime() == 0)
{
errorSound.Play();
MessageBox.Show("计时尚未开始,因此不能保存计时", "保存计时");
return;
}
saveTime(saveFileDialog1.FileName);
successSound.Play();
MessageBox.Show("保存成功");

}
Expand All @@ -454,11 +456,13 @@ private void 重置ToolStripMenuItem_Click(object sender, EventArgs e)
{
bool tmp = this.TopMost;
this.TopMost = false;
if (MessageBox.Show("是否重置计时?", "是否重置计时", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
askSound.Play();
if (MessageBox.Show("是否重置计时?", "是否重置计时", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Delete(tempFilename);
timers.Clear();
toolStripMenuItem3.Enabled = true;
successSound.Play();
}
this.TopMost = tmp;
}
Expand All @@ -473,6 +477,7 @@ private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
bool tmp = this.TopMost;
this.TopMost = false;
MessageBox.Show("该计时器通过保存每次开始和停止的时间来实现在不启用程序的情况下持续计时,因此计时器启动之后,即使程序关闭、电脑关机,也能继续准确计时,计时过程中请不要修改系统时间。临时计时文件保存在程序目录下的" + tempFilename + "中\r\n可以保存和打开已有的计时器记录,包括已完成计时的以及正在计时的\r\n\r\n怀表版计时器和普通版计时器存档通用", "非易失性计时器帮助");

this.TopMost = tmp;
}

Expand Down Expand Up @@ -562,7 +567,7 @@ private void mnuRecordTimeComment_Click(object sender, EventArgs e)
this.TopMost = false;
bool paused = IsPaused;
bool haveTime = timers.Count > 0;
if (!haveTime) { MessageBox.Show("尚未开始计时"); return; }
if (!haveTime) { errorSound.Play(); ; MessageBox.Show("尚未开始计时"); return; }

if (!paused)
{
Expand Down Expand Up @@ -600,7 +605,7 @@ private void mnuShowReport_Click(object sender, EventArgs e)

bool tmp = this.TopMost;
this.TopMost = false;
if (timers.Count == 0) { MessageBox.Show("尚未开始计时"); this.TopMost = tmp; return; }
if (timers.Count == 0) { errorSound.Play(); MessageBox.Show("尚未开始计时"); this.TopMost = tmp; return; }
FormLongMsg flm = new FormLongMsg(this);
flm.txtTimeTable.Text = makeTimeTable();
flm.txtTimeTable.ReadOnly = true;
Expand Down Expand Up @@ -817,8 +822,11 @@ private void toolStripMenuItem14_MouseEnter(object sender, EventArgs e)

}

SoundPlayer enterSound = new SoundPlayer(Properties.Resources.enter);
SoundPlayer clickSound = new SoundPlayer(Properties.Resources.click);
SoundPlayer enterSound = new SoundPlayer(Properties.Resources.enter3);
SoundPlayer clickSound = new SoundPlayer(Properties.Resources.click3);
SoundPlayer askSound = new SoundPlayer(Properties.Resources.ask);
SoundPlayer successSound = new SoundPlayer(Properties.Resources.success);
SoundPlayer errorSound = new SoundPlayer(Properties.Resources.error);

private void toolStripMenuItem10_MouseEnter(object sender, EventArgs e)
{
Expand Down
1 change: 1 addition & 0 deletions Watch/InputBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Watch/InputBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Data;
using System.Drawing;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
Expand All @@ -27,6 +28,7 @@ private void InputBox_Load(object sender, EventArgs e)

}

SoundPlayer successSound = new SoundPlayer(Properties.Resources.success);

public DialogResult GetInput(out string str) {
DialogResult dr = this.ShowDialog();
Expand Down Expand Up @@ -54,12 +56,19 @@ private void textBox1_TextChanged(object sender, EventArgs e)
if (textBox1.Text.Contains("\r") || textBox1.Text.Contains("\n")) {
textBox1.Text = textBox1.Text.Replace("\r", "").Replace("\n", "");
DialogResult = DialogResult.OK;
successSound.Play();
}
}

private void InputBox_FormClosing(object sender, FormClosingEventArgs e)
{
frmOwner.TopMost = ownerTopMost;

}

private void button1_Click(object sender, EventArgs e)
{
successSound.Play();
}
}
}
49 changes: 47 additions & 2 deletions Watch/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Watch/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ask" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ask.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btn_choro" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Design\btn_choro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down Expand Up @@ -151,6 +154,9 @@
<data name="click2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Design\audio\click2.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="click3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\click3.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="clockface" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\clockface.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand All @@ -160,6 +166,12 @@
<data name="enter1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Design\audio\enter1.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="enter3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\enter3.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\error.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="handhour" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\handhour.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand All @@ -184,4 +196,7 @@
<data name="millisecond" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\millisecond.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="success" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\success.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Binary file added Watch/Resources/ask.wav
Binary file not shown.
Binary file added Watch/Resources/click3.wav
Binary file not shown.
Binary file added Watch/Resources/enter3.wav
Binary file not shown.
Binary file added Watch/Resources/error.wav
Binary file not shown.
Binary file added Watch/Resources/success.wav
Binary file not shown.
5 changes: 5 additions & 0 deletions Watch/Watch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@
<None Include="Resources\handsec_shadow.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\error.wav" />
<None Include="Resources\success.wav" />
<None Include="Resources\ask.wav" />
<None Include="Resources\enter3.wav" />
<None Include="Resources\click3.wav" />
<None Include="Design\btn_record.png" />
<None Include="Design\audio\enter.wav" />
<None Include="Design\audio\click.wav" />
Expand Down

0 comments on commit 344b3e2

Please sign in to comment.