OSDN Git Service

通知の予告の有無をチェックボックスで設定できるようにする
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Thu, 25 Jan 2018 11:43:16 +0000 (20:43 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 27 Jan 2018 11:47:12 +0000 (20:47 +0900)
KancolleSniffer/Config.cs
KancolleSniffer/MainForm.cs
KancolleSniffer/NotificationConfigDialog.Designer.cs
KancolleSniffer/NotificationConfigDialog.cs

index f5f9473..1262a78 100644 (file)
@@ -124,7 +124,8 @@ namespace KancolleSniffer
         Pushbullet = 1 << 3,\r
         Push = 1 << 4,\r
         Repeat = 1 << 5,\r
-        Cont = 1 << 6\r
+        Cont = 1 << 6,\r
+        Preliminary = 1 << 7\r
     }\r
 \r
 \r
index 2da7baa..a5c75ab 100644 (file)
@@ -906,7 +906,9 @@ namespace KancolleSniffer
 \r
         private void SetPreNotification(string key, int fleet, string subject)\r
         {\r
-            _notificationManager.Enqueue(key, fleet, subject, 0, true);\r
+            var spec = _config.Notifications[_notificationManager.KeyToName(key)];\r
+            if ((spec.Flags & NotificationType.Preliminary) != 0)\r
+                _notificationManager.Enqueue(key, fleet, subject, 0, true);\r
         }\r
 \r
         private void UpdateRepairList()\r
index 3343d90..a04702f 100644 (file)
@@ -40,6 +40,7 @@
             this.checkBoxCont = new System.Windows.Forms.CheckBox();\r
             this.textBoxPreliminary = new System.Windows.Forms.TextBox();\r
             this.labelPreliminary = new System.Windows.Forms.Label();\r
+            this.checkBoxPreliminary = new System.Windows.Forms.CheckBox();\r
             this.SuspendLayout();\r
             // \r
             // listBoxNotifications\r
             // checkBoxRepeat\r
             // \r
             this.checkBoxRepeat.AutoSize = true;\r
-            this.checkBoxRepeat.Location = new System.Drawing.Point(117, 133);\r
+            this.checkBoxRepeat.Location = new System.Drawing.Point(12, 133);\r
             this.checkBoxRepeat.Name = "checkBoxRepeat";\r
             this.checkBoxRepeat.Size = new System.Drawing.Size(58, 16);\r
             this.checkBoxRepeat.TabIndex = 8;\r
             // \r
             // textBoxRepeat\r
             // \r
-            this.textBoxRepeat.Location = new System.Drawing.Point(172, 131);\r
+            this.textBoxRepeat.Location = new System.Drawing.Point(67, 131);\r
             this.textBoxRepeat.Name = "textBoxRepeat";\r
             this.textBoxRepeat.Size = new System.Drawing.Size(26, 19);\r
             this.textBoxRepeat.TabIndex = 9;\r
             // labelRepeat\r
             // \r
             this.labelRepeat.AutoSize = true;\r
-            this.labelRepeat.Location = new System.Drawing.Point(199, 134);\r
+            this.labelRepeat.Location = new System.Drawing.Point(96, 134);\r
             this.labelRepeat.Name = "labelRepeat";\r
             this.labelRepeat.Size = new System.Drawing.Size(29, 12);\r
             this.labelRepeat.TabIndex = 10;\r
             // checkBoxCont\r
             // \r
             this.checkBoxCont.AutoSize = true;\r
-            this.checkBoxCont.Location = new System.Drawing.Point(228, 133);\r
+            this.checkBoxCont.Location = new System.Drawing.Point(67, 155);\r
             this.checkBoxCont.Name = "checkBoxCont";\r
             this.checkBoxCont.Size = new System.Drawing.Size(48, 16);\r
             this.checkBoxCont.TabIndex = 11;\r
             // \r
             // textBoxPreliminary\r
             // \r
-            this.textBoxPreliminary.Location = new System.Drawing.Point(21, 131);\r
+            this.textBoxPreliminary.Location = new System.Drawing.Point(180, 131);\r
             this.textBoxPreliminary.Name = "textBoxPreliminary";\r
             this.textBoxPreliminary.Size = new System.Drawing.Size(26, 19);\r
             this.textBoxPreliminary.TabIndex = 12;\r
             // labelPreliminary\r
             // \r
             this.labelPreliminary.AutoSize = true;\r
-            this.labelPreliminary.Location = new System.Drawing.Point(49, 134);\r
+            this.labelPreliminary.Location = new System.Drawing.Point(208, 134);\r
             this.labelPreliminary.Name = "labelPreliminary";\r
-            this.labelPreliminary.Size = new System.Drawing.Size(62, 12);\r
+            this.labelPreliminary.Size = new System.Drawing.Size(29, 12);\r
             this.labelPreliminary.TabIndex = 13;\r
-            this.labelPreliminary.Text = "秒前に予告";\r
+            this.labelPreliminary.Text = "秒前";\r
+            // \r
+            // checkBoxPreliminary\r
+            // \r
+            this.checkBoxPreliminary.AutoSize = true;\r
+            this.checkBoxPreliminary.Location = new System.Drawing.Point(134, 133);\r
+            this.checkBoxPreliminary.Name = "checkBoxPreliminary";\r
+            this.checkBoxPreliminary.Size = new System.Drawing.Size(48, 16);\r
+            this.checkBoxPreliminary.TabIndex = 14;\r
+            this.checkBoxPreliminary.Text = "予告";\r
+            this.checkBoxPreliminary.UseVisualStyleBackColor = true;\r
+            this.checkBoxPreliminary.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);\r
             // \r
             // NotificationConfigDialog\r
             // \r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
             this.CancelButton = this.buttonClose;\r
             this.ClientSize = new System.Drawing.Size(288, 195);\r
-            this.Controls.Add(this.labelPreliminary);\r
             this.Controls.Add(this.textBoxPreliminary);\r
+            this.Controls.Add(this.checkBoxPreliminary);\r
+            this.Controls.Add(this.labelPreliminary);\r
             this.Controls.Add(this.checkBoxCont);\r
             this.Controls.Add(this.labelRepeat);\r
             this.Controls.Add(this.textBoxRepeat);\r
         private System.Windows.Forms.CheckBox checkBoxCont;\r
         private System.Windows.Forms.TextBox textBoxPreliminary;\r
         private System.Windows.Forms.Label labelPreliminary;\r
+        private System.Windows.Forms.CheckBox checkBoxPreliminary;\r
     }\r
 }
\ No newline at end of file
index 7025d65..a4b10e9 100644 (file)
@@ -24,6 +24,7 @@ namespace KancolleSniffer
             checkBoxPush.Tag = NotificationType.Push;\r
             checkBoxRepeat.Tag = NotificationType.Repeat;\r
             checkBoxCont.Tag = NotificationType.Cont;\r
+            checkBoxPreliminary.Tag = NotificationType.Preliminary;\r
 \r
             // ReSharper disable once CoVariantArrayConversion\r
             listBoxNotifications.Items.AddRange(Config.NotificationNames);\r
@@ -39,15 +40,17 @@ namespace KancolleSniffer
                 case "艦娘数超過":\r
                 case "装備数超過":\r
                 case "大破警告":\r
-                    textBoxPreliminary.Visible = labelPreliminary.Visible = textBoxRepeat.Visible =\r
-                        labelRepeat.Visible = checkBoxRepeat.Visible = checkBoxCont.Visible = false;\r
+                    textBoxPreliminary.Visible = labelPreliminary.Visible = checkBoxPreliminary.Visible =\r
+                        textBoxRepeat.Visible = labelRepeat.Visible = checkBoxRepeat.Visible =\r
+                            checkBoxCont.Visible = false;\r
                     break;\r
                 default:\r
                     textBoxRepeat.Visible = labelRepeat.Visible = checkBoxRepeat.Visible = true;\r
                     checkBoxRepeat.Enabled = _configCheckBoxs[NotificationType.Repeat].Checked;\r
                     textBoxRepeat.Text = notification.RepeatInterval.ToString();\r
                     checkBoxCont.Visible = IsContAvailable;\r
-                    textBoxPreliminary.Visible = labelPreliminary.Visible = IspreliminaryAvailable;\r
+                    textBoxPreliminary.Visible =\r
+                        labelPreliminary.Visible = checkBoxPreliminary.Visible = IspreliminaryAvailable;\r
                     textBoxPreliminary.Text = notification.PreliminaryPeriod.ToString();\r
                     break;\r
             }\r
@@ -57,8 +60,10 @@ namespace KancolleSniffer
             checkBoxPush.Checked = (notification.Flags & NotificationType.Push) != 0;\r
             checkBoxRepeat.Checked = (notification.Flags & NotificationType.Repeat) != 0;\r
             _tooltip.SetToolTip(checkBoxCont,\r
-                !IsContAvailable ? "" : notification.Name == "遠征終了" ? "再度遠征に出すまでリピートする。" : "再度入渠させるまでリピートする。");\r
+                !IsContAvailable ? "" :\r
+                notification.Name == "遠征終了" ? "再度遠征に出すまでリピートする。" : "再度入渠させるまでリピートする。");\r
             checkBoxCont.Checked = (notification.Flags & NotificationType.Cont) != 0;\r
+            checkBoxPreliminary.Checked = (notification.Flags & NotificationType.Preliminary) != 0;\r
         }\r
 \r
         private void checkBox_CheckedChanged(object sender, EventArgs e)\r
@@ -72,6 +77,8 @@ namespace KancolleSniffer
                 textBoxRepeat.Enabled = labelRepeat.Enabled = checkBoxCont.Enabled =\r
                     _configCheckBoxs[NotificationType.Repeat].Checked && checkBox.Checked;\r
             }\r
+            if (type == NotificationType.Preliminary)\r
+                textBoxPreliminary.Enabled = labelPreliminary.Enabled = checkBox.Checked;\r
         }\r
 \r
         private bool IsContAvailable =>\r
@@ -94,6 +101,7 @@ namespace KancolleSniffer
             checkBoxRepeat.Enabled = _configCheckBoxs[NotificationType.Repeat].Checked;\r
             textBoxRepeat.Enabled = labelRepeat.Enabled = checkBoxCont.Enabled =\r
                 checkBoxRepeat.Enabled && checkBoxRepeat.Checked;\r
+            textBoxPreliminary.Enabled = checkBoxPreliminary.Checked;\r
 \r
             if (listBoxNotifications.SelectedIndex == -1)\r
                 listBoxNotifications.SelectedIndex = 0;\r