OSDN Git Service

イベントごとに通知の方法を選択できるようにする
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 20 Mar 2017 10:54:49 +0000 (19:54 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 2 Apr 2017 14:18:10 +0000 (23:18 +0900)
KancolleSniffer/Config.cs
KancolleSniffer/ConfigDialog.Designer.cs
KancolleSniffer/ConfigDialog.cs
KancolleSniffer/KancolleSniffer.csproj
KancolleSniffer/MainForm.cs
KancolleSniffer/NotificationConfigDialog.Designer.cs [new file with mode: 0644]
KancolleSniffer/NotificationConfigDialog.cs [new file with mode: 0644]
KancolleSniffer/NotificationConfigDialog.resx [new file with mode: 0644]

index 83b6425..bb215e8 100644 (file)
@@ -90,25 +90,31 @@ namespace KancolleSniffer
             "hirou.mp3"\r
         };\r
 \r
-        public readonly string[] SoundNames =\r
+        public string this[string name]\r
         {\r
-            "遠征終了", "入渠終了", "建造完了", "艦娘数超過", "装備数超過",\r
-            "大破警告", "泊地修理20分経過", "泊地修理進行", "泊地修理完了", "疲労回復"\r
-        };\r
+            get { return Files[Config.NotificationIndex[name]]; }\r
+            set { Files[Config.NotificationIndex[name]] = value; }\r
+        }\r
+    }\r
 \r
-        private readonly Dictionary<string, int> _names = new Dictionary<string, int>();\r
+    [Flags]\r
+    public enum NotificationType\r
+    {\r
+        FlashWindow = 1,\r
+        ShowBaloonTip = 1 << 1,\r
+        PlaySound = 1 << 2,\r
+        All = (1 << 3) - 1\r
+    }\r
 \r
-        public SoundConfig()\r
-        {\r
-            var idx = 0;\r
-            foreach (var name in SoundNames)\r
-                _names[name] = idx++;\r
-        }\r
+    public class NotificationConfig\r
+    {\r
+        public NotificationType[] Settings =\r
+            Config.NotificationNames.Select(x => NotificationType.All).ToArray();\r
 \r
-        public string this[string name]\r
+        public NotificationType this[string name]\r
         {\r
-            get { return Files[_names[name]]; }\r
-            set { Files[_names[name]] = value; }\r
+            get { return Settings[Config.NotificationIndex[name]]; }\r
+            set { Settings[Config.NotificationIndex[name]] = value; }\r
         }\r
     }\r
 \r
@@ -124,6 +130,7 @@ namespace KancolleSniffer
         public bool FlashWindow { get; set; } = true;\r
         public bool ShowBaloonTip { get; set; }\r
         public bool PlaySound { get; set; } = true;\r
+        public NotificationConfig Notifications { get; set; } = new NotificationConfig();\r
         public int MarginShips { get; set; } = 4;\r
         public int MarginEquips { get; set; } = 10;\r
         public List<int> NotifyConditions { get; set; }\r
@@ -138,6 +145,15 @@ namespace KancolleSniffer
         public LogConfig Log { get; set; } = new LogConfig();\r
         public KancolleDbConfig KancolleDb { get; set; } = new KancolleDbConfig();\r
 \r
+        public static readonly string[] NotificationNames =\r
+        {\r
+            "遠征終了", "入渠終了", "建造完了", "艦娘数超過", "装備数超過",\r
+            "大破警告", "泊地修理20分経過", "泊地修理進行", "泊地修理完了", "疲労回復"\r
+        };\r
+\r
+        public static readonly Dictionary<string, int> NotificationIndex =\r
+            NotificationNames.Select((name, i) => new {name, i}).ToDictionary(entry => entry.name, entry => entry.i);\r
+\r
         public Config()\r
         {\r
             _configFileName = Path.Combine(_baseDir, "config.xml");\r
index 5abdfe7..1aba86d 100644 (file)
@@ -121,6 +121,7 @@ namespace KancolleSniffer
             this.toolTipError = new System.Windows.Forms.ToolTip(this.components);\r
             this.folderBrowserDialogOutputDir = new System.Windows.Forms.FolderBrowserDialog();\r
             this.openDebugLogDialog = new System.Windows.Forms.OpenFileDialog();\r
+            this.buttonDetailedSettings = new System.Windows.Forms.Button();\r
             this.tabControl.SuspendLayout();\r
             this.tabPageShow.SuspendLayout();\r
             this.tabPageNotification.SuspendLayout();\r
@@ -230,6 +231,7 @@ namespace KancolleSniffer
             // \r
             // tabPageNotification\r
             // \r
+            this.tabPageNotification.Controls.Add(this.buttonDetailedSettings);\r
             this.tabPageNotification.Controls.Add(this.label6);\r
             this.tabPageNotification.Controls.Add(this.checkBoxCond49);\r
             this.tabPageNotification.Controls.Add(this.checkBoxCond40);\r
@@ -349,9 +351,9 @@ namespace KancolleSniffer
             this.checkBoxSound.AutoSize = true;\r
             this.checkBoxSound.Location = new System.Drawing.Point(11, 53);\r
             this.checkBoxSound.Name = "checkBoxSound";\r
-            this.checkBoxSound.Size = new System.Drawing.Size(113, 16);\r
+            this.checkBoxSound.Size = new System.Drawing.Size(94, 16);\r
             this.checkBoxSound.TabIndex = 16;\r
-            this.checkBoxSound.Text = "サウンドを再生する";\r
+            this.checkBoxSound.Text = "サウンドを再生";\r
             this.checkBoxSound.UseVisualStyleBackColor = true;\r
             // \r
             // checkBoxBalloon\r
@@ -359,9 +361,9 @@ namespace KancolleSniffer
             this.checkBoxBalloon.AutoSize = true;\r
             this.checkBoxBalloon.Location = new System.Drawing.Point(11, 32);\r
             this.checkBoxBalloon.Name = "checkBoxBalloon";\r
-            this.checkBoxBalloon.Size = new System.Drawing.Size(172, 16);\r
+            this.checkBoxBalloon.Size = new System.Drawing.Size(153, 16);\r
             this.checkBoxBalloon.TabIndex = 15;\r
-            this.checkBoxBalloon.Text = "通知領域にバルーンを表示する";\r
+            this.checkBoxBalloon.Text = "通知領域にバルーンを表示";\r
             this.checkBoxBalloon.UseVisualStyleBackColor = true;\r
             // \r
             // checkBoxFlash\r
@@ -369,9 +371,9 @@ namespace KancolleSniffer
             this.checkBoxFlash.AutoSize = true;\r
             this.checkBoxFlash.Location = new System.Drawing.Point(11, 11);\r
             this.checkBoxFlash.Name = "checkBoxFlash";\r
-            this.checkBoxFlash.Size = new System.Drawing.Size(127, 16);\r
+            this.checkBoxFlash.Size = new System.Drawing.Size(100, 16);\r
             this.checkBoxFlash.TabIndex = 14;\r
-            this.checkBoxFlash.Text = "ウィンドウを点滅させる";\r
+            this.checkBoxFlash.Text = "ウィンドウを点滅";\r
             this.checkBoxFlash.UseVisualStyleBackColor = true;\r
             // \r
             // tabPageAchievement\r
@@ -955,6 +957,16 @@ namespace KancolleSniffer
             this.openDebugLogDialog.CheckFileExists = false;\r
             this.openDebugLogDialog.Title = "ログファイルの選択";\r
             // \r
+            // buttonDetailedSettings\r
+            // \r
+            this.buttonDetailedSettings.Location = new System.Drawing.Point(170, 11);\r
+            this.buttonDetailedSettings.Name = "buttonDetailedSettings";\r
+            this.buttonDetailedSettings.Size = new System.Drawing.Size(75, 23);\r
+            this.buttonDetailedSettings.TabIndex = 26;\r
+            this.buttonDetailedSettings.Text = "詳細設定...";\r
+            this.buttonDetailedSettings.UseVisualStyleBackColor = true;\r
+            this.buttonDetailedSettings.Click += new System.EventHandler(this.buttonDetailedSettings_Click);\r
+            // \r
             // ConfigDialog\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
@@ -1085,5 +1097,6 @@ namespace KancolleSniffer
         private System.Windows.Forms.ComboBox comboBoxZoom;\r
         private System.Windows.Forms.Label label14;\r
         private System.Windows.Forms.Label label15;\r
+        private System.Windows.Forms.Button buttonDetailedSettings;\r
     }\r
 }
\ No newline at end of file
index 5c2fd5c..77517c4 100644 (file)
@@ -26,7 +26,12 @@ namespace KancolleSniffer
     {\r
         private readonly Config _config;\r
         private readonly MainForm _main;\r
-        private readonly Dictionary<string, string> _soundSetting = new Dictionary<string, string>();\r
+        private readonly NotificationConfigDialog _notificationConfigDialog;\r
+\r
+        private readonly Dictionary<string, NotificationType> _notificationSettings =\r
+            new Dictionary<string, NotificationType>();\r
+\r
+        private readonly Dictionary<string, string> _soundSettings = new Dictionary<string, string>();\r
         private const string Home = "http://kancollesniffer.osdn.jp/";\r
 \r
         public ConfigDialog(Config config, MainForm main)\r
@@ -35,8 +40,16 @@ namespace KancolleSniffer
             _config = config;\r
             _main = main;\r
             // ReSharper disable once CoVariantArrayConversion\r
-            listBoxSoundFile.Items.AddRange(_config.Sounds.SoundNames);\r
+            listBoxSoundFile.Items.AddRange(Config.NotificationNames);\r
             numericUpDownMaterialLogInterval.Maximum = 1440;\r
+\r
+            _notificationConfigDialog = new NotificationConfigDialog(_notificationSettings,\r
+                new Dictionary<NotificationType, CheckBox>\r
+                {\r
+                    {NotificationType.FlashWindow, checkBoxFlash},\r
+                    {NotificationType.ShowBaloonTip, checkBoxBalloon},\r
+                    {NotificationType.PlaySound, checkBoxSound}\r
+                });\r
         }\r
 \r
         private void ConfigDialog_Load(object sender, EventArgs e)\r
@@ -49,13 +62,17 @@ namespace KancolleSniffer
             checkBoxTopMost.Checked = _config.TopMost;\r
             checkBoxHideOnMinimized.Checked = _config.HideOnMinimized;\r
             comboBoxZoom.SelectedItem = _config.Zoom + "%";\r
+\r
             checkBoxFlash.Checked = _config.FlashWindow;\r
             checkBoxBalloon.Checked = _config.ShowBaloonTip;\r
             checkBoxSound.Checked = _config.PlaySound;\r
+            foreach (var name in Config.NotificationNames)\r
+                _notificationSettings[name] = _config.Notifications[name];\r
             numericUpDownMarginShips.Value = _config.MarginShips;\r
             numericUpDownMarginEquips.Value = _config.MarginEquips;\r
             checkBoxCond40.Checked = _config.NotifyConditions.Contains(40);\r
             checkBoxCond49.Checked = _config.NotifyConditions.Contains(49);\r
+\r
             checkBoxReset02.Checked = _config.ResetHours.Contains(2);\r
             checkBoxReset14.Checked = _config.ResetHours.Contains(14);\r
             radioButtonResultRankAlways.Checked = _config.AlwaysShowResultRank;\r
@@ -63,8 +80,8 @@ namespace KancolleSniffer
             checkBoxPresetAkashi.Checked = _config.UsePresetAkashi;\r
 \r
             numericUpDownSoundVolume.Value = _config.Sounds.Volume;\r
-            foreach (var name in _config.Sounds.SoundNames)\r
-                _soundSetting[name] = _config.Sounds[name];\r
+            foreach (var name in Config.NotificationNames)\r
+                _soundSettings[name] = _config.Sounds[name];\r
             listBoxSoundFile.SelectedIndex = -1;\r
             listBoxSoundFile.SelectedIndex = 0;\r
 \r
@@ -146,6 +163,8 @@ namespace KancolleSniffer
             _config.FlashWindow = checkBoxFlash.Checked;\r
             _config.ShowBaloonTip = checkBoxBalloon.Checked;\r
             _config.PlaySound = checkBoxSound.Checked;\r
+            foreach (var name in Config.NotificationNames)\r
+                _config.Notifications[name] = _notificationSettings[name];\r
             _config.MarginShips = (int)numericUpDownMarginShips.Value;\r
             _config.MarginEquips = (int)numericUpDownMarginEquips.Value;\r
 \r
@@ -166,8 +185,8 @@ namespace KancolleSniffer
             _config.UsePresetAkashi = checkBoxPresetAkashi.Checked;\r
 \r
             _config.Sounds.Volume = (int)numericUpDownSoundVolume.Value;\r
-            foreach (var name in _config.Sounds.SoundNames)\r
-                _config.Sounds[name] = _soundSetting[name];\r
+            foreach (var name in Config.NotificationNames)\r
+                _config.Sounds[name] = _soundSettings[name];\r
         }\r
 \r
         private bool ValidatePorts(out int listen, out int outbound, out int server)\r
@@ -216,14 +235,14 @@ namespace KancolleSniffer
 \r
         private void textBoxSoundFile_TextChanged(object sender, EventArgs e)\r
         {\r
-            _soundSetting[(string)listBoxSoundFile.SelectedItem] = textBoxSoundFile.Text;\r
+            _soundSettings[(string)listBoxSoundFile.SelectedItem] = textBoxSoundFile.Text;\r
         }\r
 \r
         private void listBoxSoundFile_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
             if (listBoxSoundFile.SelectedItem == null)\r
                 return;\r
-            textBoxSoundFile.Text = _soundSetting[(string)listBoxSoundFile.SelectedItem];\r
+            textBoxSoundFile.Text = _soundSettings[(string)listBoxSoundFile.SelectedItem];\r
             textBoxSoundFile.Select(textBoxSoundFile.Text.Length, 0);\r
         }\r
 \r
@@ -239,7 +258,7 @@ namespace KancolleSniffer
 \r
         private void buttonPlay_Click(object sender, EventArgs e)\r
         {\r
-            _main.PlaySound(_soundSetting[(string)listBoxSoundFile.SelectedItem], (int)numericUpDownSoundVolume.Value);\r
+            _main.PlaySound(_soundSettings[(string)listBoxSoundFile.SelectedItem], (int)numericUpDownSoundVolume.Value);\r
         }\r
 \r
         private void buttonResetAchievement_Click(object sender, EventArgs e)\r
@@ -307,5 +326,10 @@ namespace KancolleSniffer
             _main.SetPlayLog(textBoxDebugLog.Text);\r
             DialogResult = DialogResult.Cancel;\r
         }\r
+\r
+        private void buttonDetailedSettings_Click(object sender, EventArgs e)\r
+        {\r
+            _notificationConfigDialog.ShowDialog(this);\r
+        }\r
     }\r
 }
\ No newline at end of file
index 10f9ec3..07d2577 100644 (file)
     <Compile Include="MaterialInfo.cs" />\r
     <Compile Include="MiscTextInfo.cs" />\r
     <Compile Include="MissingData.cs" />\r
+    <Compile Include="NotificationConfigDialog.cs">\r
+      <SubType>Form</SubType>\r
+    </Compile>\r
+    <Compile Include="NotificationConfigDialog.Designer.cs">\r
+      <DependentUpon>NotificationConfigDialog.cs</DependentUpon>\r
+    </Compile>\r
     <Compile Include="PresetDeck.cs" />\r
     <Compile Include="ShipLabels.cs" />\r
     <Compile Include="ListForm.cs">\r
     <EmbeddedResource Include="MainForm.resx">\r
       <DependentUpon>MainForm.cs</DependentUpon>\r
     </EmbeddedResource>\r
+    <EmbeddedResource Include="NotificationConfigDialog.resx">\r
+      <DependentUpon>NotificationConfigDialog.cs</DependentUpon>\r
+    </EmbeddedResource>\r
     <EmbeddedResource Include="Properties\Resources.resx">\r
       <Generator>ResXFileCodeGenerator</Generator>\r
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r
index 3b4c511..ad3e041 100644 (file)
@@ -431,7 +431,7 @@ namespace KancolleSniffer
             if (item.RingShips)\r
             {\r
                 var message = $"残り{_sniffer.Item.MaxShips - _sniffer.Item.NowShips:D}隻";\r
-                _noticeQueue.Enqueue("艦娘が多すぎます", message, _config.Sounds["艦娘数超過"]);\r
+                _noticeQueue.Enqueue("艦娘が多すぎます", message, "艦娘数超過");\r
                 item.RingShips = false;\r
             }\r
         }\r
@@ -444,7 +444,7 @@ namespace KancolleSniffer
             if (item.RingEquips)\r
             {\r
                 var message = $"残り{_sniffer.Item.MaxEquips - _sniffer.Item.NowEquips:D}個";\r
-                _noticeQueue.Enqueue("装備が多すぎます", message, _config.Sounds["装備数超過"]);\r
+                _noticeQueue.Enqueue("装備が多すぎます", message, "装備数超過");\r
                 item.RingEquips = false;\r
             }\r
         }\r
@@ -509,8 +509,7 @@ namespace KancolleSniffer
         private void NotifyDamagedShip()\r
         {\r
             if (_sniffer.BadlyDamagedShips.Any())\r
-                _noticeQueue.Enqueue("大破した艦娘がいます", string.Join(" ", _sniffer.BadlyDamagedShips),\r
-                    _config.Sounds["大破警告"]);\r
+                _noticeQueue.Enqueue("大破した艦娘がいます", string.Join(" ", _sniffer.BadlyDamagedShips), "大破警告");\r
         }\r
 \r
         private void NotifyAkashiTimer()\r
@@ -523,7 +522,7 @@ namespace KancolleSniffer
                 return;\r
             if (msgs[0].Proceeded == "20分経過しました。")\r
             {\r
-                _noticeQueue.Enqueue("泊地修理", msgs[0].Proceeded, _config.Sounds["泊地修理20分経過"]);\r
+                _noticeQueue.Enqueue("泊地修理", msgs[0].Proceeded, "泊地修理20分経過");\r
                 msgs[0].Proceeded = "";\r
                 // 修理完了がいるかもしれないので続ける\r
             }\r
@@ -531,9 +530,9 @@ namespace KancolleSniffer
             for (var i = 0; i < fn.Length; i++)\r
             {\r
                 if (msgs[i].Proceeded != "")\r
-                    _noticeQueue.Enqueue("泊地修理 " + fn[i], "修理進行:" + msgs[i].Proceeded, _config.Sounds["泊地修理進行"]);\r
+                    _noticeQueue.Enqueue("泊地修理 " + fn[i], "修理進行:" + msgs[i].Proceeded, "泊地修理進行");\r
                 if (msgs[i].Completed != "")\r
-                    _noticeQueue.Enqueue("泊地修理 " + fn[i], "修理完了:" + msgs[i].Completed, _config.Sounds["泊地修理完了"]);\r
+                    _noticeQueue.Enqueue("泊地修理 " + fn[i], "修理完了:" + msgs[i].Completed, "泊地修理完了");\r
             }\r
         }\r
 \r
@@ -644,7 +643,7 @@ namespace KancolleSniffer
                 entry.label.Text = entry.Timer.ToString(_missionFinishTimeMode);\r
                 if (!entry.Timer.NeedRing)\r
                     continue;\r
-                _noticeQueue.Enqueue("遠征が終わりました", entry.Name, _config.Sounds["遠征終了"]);\r
+                _noticeQueue.Enqueue("遠征が終わりました", entry.Name, "遠征終了");\r
                 entry.Timer.NeedRing = false;\r
             }\r
             for (var i = 0; i < _sniffer.NDock.Length; i++)\r
@@ -654,7 +653,7 @@ namespace KancolleSniffer
                 _shipLabels.SetNDockTimer(i, entry.Timer, _ndockFinishTimeMode);\r
                 if (!entry.Timer.NeedRing)\r
                     continue;\r
-                _noticeQueue.Enqueue("入渠が終わりました", entry.Name, _config.Sounds["入渠終了"]);\r
+                _noticeQueue.Enqueue("入渠が終わりました", entry.Name, "入渠終了");\r
                 entry.Timer.NeedRing = false;\r
             }\r
             var kdock = new[] {labelConstruct1, labelConstruct2, labelConstruct3, labelConstruct4};\r
@@ -667,7 +666,7 @@ namespace KancolleSniffer
                 kdock[i].Text = timer.EndTime == DateTime.MinValue ? "" : timer.Rest.ToString(@"hh\:mm\:ss");\r
                 if (!timer.NeedRing)\r
                     continue;\r
-                _noticeQueue.Enqueue("建造が終わりました", $"第{i + 1:D}ドック", _config.Sounds["建造完了"]);\r
+                _noticeQueue.Enqueue("建造が終わりました", $"第{i + 1:D}ドック", "建造完了");\r
                 timer.NeedRing = false;\r
             }\r
             UpdateCondTimers();\r
@@ -718,7 +717,7 @@ namespace KancolleSniffer
             {\r
                 if (!_config.NotifyConditions.Contains(notice[i]))\r
                     return;\r
-                _noticeQueue.Enqueue("疲労が回復しました", fn[i] + " cond" + notice[i].ToString("D"), _config.Sounds["疲労回復"]);\r
+                _noticeQueue.Enqueue("疲労が回復しました", fn[i] + " cond" + notice[i].ToString("D"), "疲労回復");\r
             }\r
         }\r
 \r
@@ -806,28 +805,28 @@ namespace KancolleSniffer
                 _ring(notice.Item1, notice.Item2, notice.Item3);\r
             }\r
 \r
-            public void Enqueue(string title, string message, string soundFile)\r
+            public void Enqueue(string title, string message, string name)\r
             {\r
                 if (_timer.Enabled)\r
                 {\r
-                    _queue.Enqueue(new Tuple<string, string, string>(title, message, soundFile));\r
+                    _queue.Enqueue(new Tuple<string, string, string>(title, message, name));\r
                 }\r
                 else\r
                 {\r
-                    _ring(title, message, soundFile);\r
+                    _ring(title, message, name);\r
                     _timer.Start();\r
                 }\r
             }\r
         }\r
 \r
-        private void Ring(string baloonTitle, string baloonMessage, string soundFile)\r
+        private void Ring(string baloonTitle, string baloonMessage, string name)\r
         {\r
-            if (_config.FlashWindow)\r
+            if (_config.FlashWindow && (_config.Notifications[name] & NotificationType.FlashWindow) != 0)\r
                 Win32API.FlashWindow(Handle);\r
-            if (_config.ShowBaloonTip)\r
+            if (_config.ShowBaloonTip && (_config.Notifications[name] & NotificationType.ShowBaloonTip) != 0)\r
                 notifyIconMain.ShowBalloonTip(20000, baloonTitle, baloonMessage, ToolTipIcon.Info);\r
-            if (_config.PlaySound)\r
-                PlaySound(soundFile, _config.Sounds.Volume);\r
+            if (_config.PlaySound && (_config.Notifications[name] & NotificationType.PlaySound) != 0)\r
+                PlaySound(_config.Sounds[name], _config.Sounds.Volume);\r
         }\r
 \r
         [DllImport("winmm.dll")]\r
diff --git a/KancolleSniffer/NotificationConfigDialog.Designer.cs b/KancolleSniffer/NotificationConfigDialog.Designer.cs
new file mode 100644 (file)
index 0000000..88fe811
--- /dev/null
@@ -0,0 +1,121 @@
+namespace KancolleSniffer\r
+{\r
+    partial class NotificationConfigDialog\r
+    {\r
+        /// <summary>\r
+        /// Required designer variable.\r
+        /// </summary>\r
+        private System.ComponentModel.IContainer components = null;\r
+\r
+        /// <summary>\r
+        /// Clean up any resources being used.\r
+        /// </summary>\r
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+        protected override void Dispose(bool disposing)\r
+        {\r
+            if (disposing && (components != null))\r
+            {\r
+                components.Dispose();\r
+            }\r
+            base.Dispose(disposing);\r
+        }\r
+\r
+        #region Windows Form Designer generated code\r
+\r
+        /// <summary>\r
+        /// Required method for Designer support - do not modify\r
+        /// the contents of this method with the code editor.\r
+        /// </summary>\r
+        private void InitializeComponent()\r
+        {\r
+            this.listBoxNotifications = new System.Windows.Forms.ListBox();\r
+            this.checkBoxFlashWindow = new System.Windows.Forms.CheckBox();\r
+            this.checkBoxShowBaloonTip = new System.Windows.Forms.CheckBox();\r
+            this.checkBoxPlaySound = new System.Windows.Forms.CheckBox();\r
+            this.buttonClose = new System.Windows.Forms.Button();\r
+            this.SuspendLayout();\r
+            // \r
+            // listBoxNotifications\r
+            // \r
+            this.listBoxNotifications.FormattingEnabled = true;\r
+            this.listBoxNotifications.ItemHeight = 12;\r
+            this.listBoxNotifications.Location = new System.Drawing.Point(12, 12);\r
+            this.listBoxNotifications.Name = "listBoxNotifications";\r
+            this.listBoxNotifications.Size = new System.Drawing.Size(204, 88);\r
+            this.listBoxNotifications.TabIndex = 0;\r
+            this.listBoxNotifications.SelectedIndexChanged += new System.EventHandler(this.listBoxNotifications_SelectedIndexChanged);\r
+            // \r
+            // checkBoxFlashWindow\r
+            // \r
+            this.checkBoxFlashWindow.AutoSize = true;\r
+            this.checkBoxFlashWindow.Location = new System.Drawing.Point(12, 106);\r
+            this.checkBoxFlashWindow.Name = "checkBoxFlashWindow";\r
+            this.checkBoxFlashWindow.Size = new System.Drawing.Size(67, 16);\r
+            this.checkBoxFlashWindow.TabIndex = 1;\r
+            this.checkBoxFlashWindow.Text = "ウィンドウ";\r
+            this.checkBoxFlashWindow.UseVisualStyleBackColor = true;\r
+            this.checkBoxFlashWindow.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);\r
+            // \r
+            // checkBoxShowBaloonTip\r
+            // \r
+            this.checkBoxShowBaloonTip.AutoSize = true;\r
+            this.checkBoxShowBaloonTip.Location = new System.Drawing.Point(81, 106);\r
+            this.checkBoxShowBaloonTip.Name = "checkBoxShowBaloonTip";\r
+            this.checkBoxShowBaloonTip.Size = new System.Drawing.Size(72, 16);\r
+            this.checkBoxShowBaloonTip.TabIndex = 2;\r
+            this.checkBoxShowBaloonTip.Text = "通知領域";\r
+            this.checkBoxShowBaloonTip.UseVisualStyleBackColor = true;\r
+            // \r
+            // checkBoxPlaySound\r
+            // \r
+            this.checkBoxPlaySound.AutoSize = true;\r
+            this.checkBoxPlaySound.Location = new System.Drawing.Point(155, 106);\r
+            this.checkBoxPlaySound.Name = "checkBoxPlaySound";\r
+            this.checkBoxPlaySound.Size = new System.Drawing.Size(61, 16);\r
+            this.checkBoxPlaySound.TabIndex = 3;\r
+            this.checkBoxPlaySound.Text = "サウンド";\r
+            this.checkBoxPlaySound.UseVisualStyleBackColor = true;\r
+            // \r
+            // buttonClose\r
+            // \r
+            this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;\r
+            this.buttonClose.Location = new System.Drawing.Point(141, 134);\r
+            this.buttonClose.Name = "buttonClose";\r
+            this.buttonClose.Size = new System.Drawing.Size(75, 23);\r
+            this.buttonClose.TabIndex = 6;\r
+            this.buttonClose.Text = "閉じる";\r
+            this.buttonClose.UseVisualStyleBackColor = true;\r
+            // \r
+            // NotificationConfigDialog\r
+            // \r
+            this.AcceptButton = this.buttonClose;\r
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+            this.CancelButton = this.buttonClose;\r
+            this.ClientSize = new System.Drawing.Size(228, 166);\r
+            this.Controls.Add(this.buttonClose);\r
+            this.Controls.Add(this.checkBoxPlaySound);\r
+            this.Controls.Add(this.checkBoxShowBaloonTip);\r
+            this.Controls.Add(this.checkBoxFlashWindow);\r
+            this.Controls.Add(this.listBoxNotifications);\r
+            this.MaximizeBox = false;\r
+            this.MinimizeBox = false;\r
+            this.Name = "NotificationConfigDialog";\r
+            this.ShowIcon = false;\r
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
+            this.Text = "イベントごとの通知方法の設定";\r
+            this.Load += new System.EventHandler(this.NotificationConfigDialog_Load);\r
+            this.ResumeLayout(false);\r
+            this.PerformLayout();\r
+\r
+        }\r
+\r
+        #endregion\r
+\r
+        private System.Windows.Forms.ListBox listBoxNotifications;\r
+        private System.Windows.Forms.CheckBox checkBoxFlashWindow;\r
+        private System.Windows.Forms.CheckBox checkBoxShowBaloonTip;\r
+        private System.Windows.Forms.CheckBox checkBoxPlaySound;\r
+        private System.Windows.Forms.Button buttonClose;\r
+    }\r
+}
\ No newline at end of file
diff --git a/KancolleSniffer/NotificationConfigDialog.cs b/KancolleSniffer/NotificationConfigDialog.cs
new file mode 100644 (file)
index 0000000..95cda12
--- /dev/null
@@ -0,0 +1,59 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Windows.Forms;\r
+\r
+namespace KancolleSniffer\r
+{\r
+    public partial class NotificationConfigDialog : Form\r
+    {\r
+        private readonly Dictionary<string, NotificationType> _notifications;\r
+        private readonly Dictionary<NotificationType, CheckBox> _configCheckBoxs;\r
+\r
+        public NotificationConfigDialog(Dictionary<string, NotificationType> notifications, Dictionary<NotificationType, CheckBox> checkBoxs)\r
+        {\r
+            InitializeComponent();\r
+            _notifications = notifications;\r
+            _configCheckBoxs = checkBoxs;\r
+\r
+            checkBoxFlashWindow.Tag = NotificationType.FlashWindow;\r
+            checkBoxShowBaloonTip.Tag = NotificationType.ShowBaloonTip;\r
+            checkBoxPlaySound.Tag = NotificationType.PlaySound;\r
+\r
+            // ReSharper disable once CoVariantArrayConversion\r
+            listBoxNotifications.Items.AddRange(Config.NotificationNames);\r
+        }\r
+\r
+        private void listBoxNotifications_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            if (listBoxNotifications.SelectedItem == null)\r
+                return;\r
+            var notification = _notifications[(string)listBoxNotifications.SelectedItem];\r
+            checkBoxFlashWindow.Checked = (notification & NotificationType.FlashWindow) != 0;\r
+            checkBoxShowBaloonTip.Checked = (notification & NotificationType.ShowBaloonTip) != 0;\r
+            checkBoxPlaySound.Checked = (notification & NotificationType.PlaySound) != 0;\r
+        }\r
+\r
+        private void checkBox_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            var checkBox = (CheckBox)sender;\r
+            if (checkBox.Checked)\r
+            {\r
+                _notifications[(string)listBoxNotifications.SelectedItem] |= (NotificationType)checkBox.Tag;\r
+            }\r
+            else\r
+            {\r
+                _notifications[(string)listBoxNotifications.SelectedItem] &= ~(NotificationType)checkBox.Tag;\r
+            }\r
+        }\r
+\r
+        private void NotificationConfigDialog_Load(object sender, EventArgs e)\r
+        {\r
+            checkBoxFlashWindow.Enabled = _configCheckBoxs[NotificationType.FlashWindow].Checked;\r
+            checkBoxShowBaloonTip.Enabled = _configCheckBoxs[NotificationType.ShowBaloonTip].Checked;\r
+            checkBoxPlaySound.Enabled = _configCheckBoxs[NotificationType.PlaySound].Checked;\r
+\r
+            if (listBoxNotifications.SelectedIndex == -1)\r
+                listBoxNotifications.SelectedIndex = 0;\r
+        }\r
+    }\r
+}\r
diff --git a/KancolleSniffer/NotificationConfigDialog.resx b/KancolleSniffer/NotificationConfigDialog.resx
new file mode 100644 (file)
index 0000000..29dcb1b
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 2.0\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">2.0</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+        <comment>This is a comment</comment>\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used for serialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="metadata">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="assembly">\r
+            <xsd:complexType>\r
+              <xsd:attribute name="alias" type="xsd:string" />\r
+              <xsd:attribute name="name" type="xsd:string" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>2.0</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+</root>
\ No newline at end of file