1 // Copyright (C) 2014 Kazuhiro Fujieda <fujieda@users.sourceforge.jp>
\r
3 // This program is part of KancolleSniffer.
\r
5 // KancolleSniffer is free software: you can redistribute it and/or modify
\r
6 // it under the terms of the GNU General Public License as published by
\r
7 // the Free Software Foundation, either version 3 of the License, or
\r
8 // (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, see <http://www.gnu.org/licenses/>.
\r
20 using System.Windows.Forms;
\r
22 namespace KancolleSniffer
\r
24 public partial class ConfigDialog : Form
\r
26 public ConfigDialog()
\r
28 InitializeComponent();
\r
31 private void ConfigDialog_Load(object sender, EventArgs e)
\r
33 var config = (Config)Tag;
\r
35 checkBoxTopMost.Checked = config.TopMost;
\r
36 checkBoxFlash.Checked = config.FlashWindow;
\r
37 checkBoxBalloon.Checked = config.ShowBaloonTip;
\r
38 groupBoxSound.Enabled = checkBoxSound.Checked = config.PlaySound;
\r
39 numericUpDownMarginShips.Value = config.MarginShips;
\r
41 numericUpDownSoundVolume.Value = config.SoundVolume;
\r
42 textBoxMissionSoundFile.Text = config.MissionSoundFile;
\r
43 textBoxNDockSoundFile.Text = config.NDockSoundFile;
\r
44 textBoxKDockSoundFile.Text = config.KDockSoundFile;
\r
45 textBoxMaxShipsSoundFile.Text = config.MaxShipsSoundFile;
\r
48 private void buttonOk_Click(object sender, EventArgs e)
\r
50 var config = (Config)Tag;
\r
52 config.TopMost = checkBoxTopMost.Checked;
\r
53 config.FlashWindow = checkBoxFlash.Checked;
\r
54 config.ShowBaloonTip = checkBoxBalloon.Checked;
\r
55 config.PlaySound = checkBoxSound.Checked;
\r
56 config.MarginShips = (int)numericUpDownMarginShips.Value;
\r
58 config.SoundVolume = (int)numericUpDownSoundVolume.Value;
\r
59 config.MissionSoundFile = textBoxMissionSoundFile.Text;
\r
60 config.NDockSoundFile = textBoxNDockSoundFile.Text;
\r
61 config.KDockSoundFile = textBoxKDockSoundFile.Text;
\r
62 config.MaxShipsSoundFile = textBoxMaxShipsSoundFile.Text;
\r
65 private void checkBoxSound_CheckedChanged(object sender, EventArgs e)
\r
67 groupBoxSound.Enabled = checkBoxSound.Checked;
\r
70 private void buttonMissionOpenFile_Click(object sender, EventArgs e)
\r
72 ChooseSoundFile(textBoxMissionSoundFile);
\r
75 private void buttonNDockOpenFile_Click(object sender, EventArgs e)
\r
77 ChooseSoundFile(textBoxNDockSoundFile);
\r
80 private void buttonKDockOpenFile_Click(object sender, EventArgs e)
\r
82 ChooseSoundFile(textBoxKDockSoundFile);
\r
85 private void buttonMaxShipsOpenFile_Click(object sender, EventArgs e)
\r
87 ChooseSoundFile(textBoxMaxShipsSoundFile);
\r
90 private void ChooseSoundFile(TextBox textBox)
\r
92 openFileDialog.FileName = textBox.Text;
\r
93 openFileDialog.InitialDirectory = Path.GetDirectoryName(textBox.Text) ?? "";
\r
94 if (openFileDialog.ShowDialog() == DialogResult.OK)
\r
95 textBox.Text = openFileDialog.FileName;
\r