[go: up one dir, main page]

Menu

[5b1ca9]: / Form1.cs  Maximize  Restore  History

Download this file

124 lines (112 with data), 4.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/***********************************************************************************
This file is part of Clock Alert.
Clock Alert is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as published by
the Free Software Foundation.
Clock Alert is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clock Alert. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Clock_Alert
{
public partial class Form1 : Form
{
private bool isPlaying;
private int selectedSound;
public Form1()
{
InitializeComponent();
isPlaying = false;
}
/// <summary>
/// Loads the stored settings from disk into the form.
/// </summary>
private void loadSettings()
{
checkBox1.Checked = Properties.Settings.Default.StartWhenWindowsStarts;
//checkBox2.Checked = Properties.Settings.Default.ClickToTalk;
selectedSound = Properties.Settings.Default.CurrentSound;
int currentSound = Properties.Settings.Default.CurrentSound;
if (currentSound == 1)
{
radioButton1.Checked = true;
}
else if (currentSound == 2)
{
radioButton2.Checked = true;
}
else if (currentSound == 3)
{
radioButton3.Checked = true;
}
else if (currentSound == 4)
{
radioButton4.Checked = true;
}
}
/// <summary>
/// Saves the settings to the disk.
/// </summary>
private void saveSettings()
{
Properties.Settings.Default.ClickToTalk = checkBox2.Checked;
//Properties.Settings.Default.StartWhenWindowsStarts = checkBox1.Checked;
if (radioButton1.Checked)
Properties.Settings.Default.CurrentSound = 1;
else if (radioButton2.Checked)
Properties.Settings.Default.CurrentSound = 2;
else if (radioButton3.Checked)
Properties.Settings.Default.CurrentSound = 3;
else if (radioButton4.Checked)
Properties.Settings.Default.CurrentSound = 4;
Properties.Settings.Default.Save();
}
private void Form1_Load(object sender, EventArgs e)
{
loadSettings();
}
private void button1_Click(object sender, EventArgs e)
{
AudioPlayer player;
this.Enabled=false;
this.Cursor = Cursors.WaitCursor;
if (radioButton1.Checked)
{
player = new AudioPlayer(Properties.Resources.sound);
player.play();
}
else if (radioButton2.Checked)
{
player = new AudioPlayer(Properties.Resources.sound2);
player.play();
}
else if (radioButton3.Checked)
{
player = new AudioPlayer(Properties.Resources.sound3);
player.play();
}
else if (radioButton4.Checked)
{
player = new AudioPlayer(Properties.Resources.sound4);
player.play();
}
this.Enabled = true;
this.Cursor = Cursors.Default;
}
private void button2_Click(object sender, EventArgs e)
{
saveSettings();
Application.Restart();
}
}
}