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
21 using System.Windows.Forms;
\r
23 namespace KancolleSniffer
\r
25 public partial class ConfigDialog : Form
\r
27 private readonly DebugDialog _debugDialog = new DebugDialog();
\r
28 private readonly Config _config;
\r
29 private readonly MainForm _main;
\r
31 public ConfigDialog(Config config, MainForm main)
\r
33 InitializeComponent();
\r
38 private void ConfigDialog_Load(object sender, EventArgs e)
\r
40 checkBoxTopMost.Checked = _config.TopMost;
\r
41 checkBoxFlash.Checked = _config.FlashWindow;
\r
42 checkBoxBalloon.Checked = _config.ShowBaloonTip;
\r
43 groupBoxSound.Enabled = checkBoxSound.Checked = _config.PlaySound;
\r
44 numericUpDownMarginShips.Value = _config.MarginShips;
\r
46 checkBoxReset02.Checked = _config.ResetHours.Any(x => x == 2);
\r
47 checkBoxReset14.Checked = _config.ResetHours.Any(x => x == 14);
\r
49 numericUpDownSoundVolume.Value = _config.SoundVolume;
\r
50 textBoxMissionSoundFile.Text = _config.MissionSoundFile;
\r
51 textBoxNDockSoundFile.Text = _config.NDockSoundFile;
\r
52 textBoxKDockSoundFile.Text = _config.KDockSoundFile;
\r
53 textBoxMaxShipsSoundFile.Text = _config.MaxShipsSoundFile;
\r
54 textBoxDamagedShipSoundFile.Text = _config.DamagedShipSoundFile;
\r
56 _debugDialog.Logging = _config.Logging;
\r
57 _debugDialog.LogFile = _config.LogFile;
\r
60 private void buttonOk_Click(object sender, EventArgs e)
\r
62 _config.TopMost = checkBoxTopMost.Checked;
\r
63 _config.FlashWindow = checkBoxFlash.Checked;
\r
64 _config.ShowBaloonTip = checkBoxBalloon.Checked;
\r
65 _config.PlaySound = checkBoxSound.Checked;
\r
66 _config.MarginShips = (int)numericUpDownMarginShips.Value;
\r
68 _config.ResetHours.Clear();
\r
69 if (checkBoxReset02.Checked)
\r
70 _config.ResetHours.Add(2);
\r
71 if (checkBoxReset14.Checked)
\r
72 _config.ResetHours.Add(14);
\r
74 _config.SoundVolume = (int)numericUpDownSoundVolume.Value;
\r
75 _config.MissionSoundFile = textBoxMissionSoundFile.Text;
\r
76 _config.NDockSoundFile = textBoxNDockSoundFile.Text;
\r
77 _config.KDockSoundFile = textBoxKDockSoundFile.Text;
\r
78 _config.MaxShipsSoundFile = textBoxMaxShipsSoundFile.Text;
\r
79 _config.DamagedShipSoundFile = textBoxDamagedShipSoundFile.Text;
\r
81 _config.Logging = _debugDialog.Logging;
\r
82 _config.LogFile = _debugDialog.LogFile;
\r
85 private void checkBoxSound_CheckedChanged(object sender, EventArgs e)
\r
87 groupBoxSound.Enabled = checkBoxSound.Checked;
\r
90 private void buttonMissionOpenFile_Click(object sender, EventArgs e)
\r
92 ChooseSoundFile(textBoxMissionSoundFile);
\r
95 private void buttonNDockOpenFile_Click(object sender, EventArgs e)
\r
97 ChooseSoundFile(textBoxNDockSoundFile);
\r
100 private void buttonKDockOpenFile_Click(object sender, EventArgs e)
\r
102 ChooseSoundFile(textBoxKDockSoundFile);
\r
105 private void buttonMaxShipsOpenFile_Click(object sender, EventArgs e)
\r
107 ChooseSoundFile(textBoxMaxShipsSoundFile);
\r
110 private void buttonDamagedShipOpenFile_Click(object sender, EventArgs e)
\r
112 ChooseSoundFile(textBoxDamagedShipSoundFile);
\r
115 private void ChooseSoundFile(TextBox textBox)
\r
117 openFileDialog.FileName = textBox.Text;
\r
118 openFileDialog.InitialDirectory = Path.GetDirectoryName(textBox.Text) ?? "";
\r
119 if (openFileDialog.ShowDialog() == DialogResult.OK)
\r
120 textBox.Text = openFileDialog.FileName;
\r
123 private void DebugToolStripMenuItem_Click(object sender, EventArgs e)
\r
125 _debugDialog.ShowDialog(this);
\r
128 private void buttonResetAchievement_Click(object sender, EventArgs e)
\r
130 _main.ResetAchievemnt();
\r