OSDN Git Service

ウィンドウを最前面に表示できるようにする
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Sat, 11 Jan 2014 04:06:14 +0000 (13:06 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Sat, 11 Jan 2014 04:06:14 +0000 (13:06 +0900)
KancolleSniffer/Config.cs
KancolleSniffer/ConfigDialog.Designer.cs
KancolleSniffer/ConfigDialog.cs
KancolleSniffer/MainForm.cs

index a5b1b48..c441631 100644 (file)
@@ -25,6 +25,7 @@ namespace KancolleSniffer
     {\r
         private readonly string _configFileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "config.json");\r
 \r
+        public bool TopMost { get; set; }\r
         public bool FlashWindow { get; set; }\r
         public bool ShowBaloonTip { get; set; }\r
         public bool PlaySound { get; set; }\r
index 8fb70eb..5d7e863 100644 (file)
@@ -70,10 +70,13 @@ namespace KancolleSniffer
             this.buttonOk = new System.Windows.Forms.Button();\r
             this.buttonCancel = new System.Windows.Forms.Button();\r
             this.openFileDialog = new System.Windows.Forms.OpenFileDialog();\r
+            this.groupBoxShow = new System.Windows.Forms.GroupBox();\r
+            this.checkBoxTopMost = new System.Windows.Forms.CheckBox();\r
             this.groupBoxNotification.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginShips)).BeginInit();\r
             this.groupBoxSound.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSoundVolume)).BeginInit();\r
+            this.groupBoxShow.SuspendLayout();\r
             this.SuspendLayout();\r
             // \r
             // groupBoxNotification\r
@@ -84,17 +87,16 @@ namespace KancolleSniffer
             this.groupBoxNotification.Controls.Add(this.checkBoxSound);\r
             this.groupBoxNotification.Controls.Add(this.checkBoxBalloon);\r
             this.groupBoxNotification.Controls.Add(this.checkBoxFlash);\r
-            this.groupBoxNotification.Location = new System.Drawing.Point(12, 12);\r
+            this.groupBoxNotification.Location = new System.Drawing.Point(12, 58);\r
             this.groupBoxNotification.Name = "groupBoxNotification";\r
-            this.groupBoxNotification.Padding = new System.Windows.Forms.Padding(8);\r
-            this.groupBoxNotification.Size = new System.Drawing.Size(248, 119);\r
+            this.groupBoxNotification.Size = new System.Drawing.Size(240, 108);\r
             this.groupBoxNotification.TabIndex = 0;\r
             this.groupBoxNotification.TabStop = false;\r
             this.groupBoxNotification.Text = "通知";\r
             // \r
             // numericUpDownMarginShips\r
             // \r
-            this.numericUpDownMarginShips.Location = new System.Drawing.Point(125, 89);\r
+            this.numericUpDownMarginShips.Location = new System.Drawing.Point(120, 82);\r
             this.numericUpDownMarginShips.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);\r
             this.numericUpDownMarginShips.Maximum = new decimal(new int[] {\r
             99,\r
@@ -109,7 +111,7 @@ namespace KancolleSniffer
             // label2\r
             // \r
             this.label2.AutoSize = true;\r
-            this.label2.Location = new System.Drawing.Point(161, 91);\r
+            this.label2.Location = new System.Drawing.Point(156, 84);\r
             this.label2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);\r
             this.label2.Name = "label2";\r
             this.label2.Size = new System.Drawing.Size(70, 12);\r
@@ -119,7 +121,7 @@ namespace KancolleSniffer
             // label1\r
             // \r
             this.label1.AutoSize = true;\r
-            this.label1.Location = new System.Drawing.Point(11, 91);\r
+            this.label1.Location = new System.Drawing.Point(4, 84);\r
             this.label1.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);\r
             this.label1.Name = "label1";\r
             this.label1.Size = new System.Drawing.Size(116, 12);\r
@@ -129,7 +131,7 @@ namespace KancolleSniffer
             // checkBoxSound\r
             // \r
             this.checkBoxSound.AutoSize = true;\r
-            this.checkBoxSound.Location = new System.Drawing.Point(11, 67);\r
+            this.checkBoxSound.Location = new System.Drawing.Point(6, 62);\r
             this.checkBoxSound.Name = "checkBoxSound";\r
             this.checkBoxSound.Size = new System.Drawing.Size(113, 16);\r
             this.checkBoxSound.TabIndex = 2;\r
@@ -140,7 +142,7 @@ namespace KancolleSniffer
             // checkBoxBalloon\r
             // \r
             this.checkBoxBalloon.AutoSize = true;\r
-            this.checkBoxBalloon.Location = new System.Drawing.Point(11, 45);\r
+            this.checkBoxBalloon.Location = new System.Drawing.Point(6, 40);\r
             this.checkBoxBalloon.Name = "checkBoxBalloon";\r
             this.checkBoxBalloon.Size = new System.Drawing.Size(172, 16);\r
             this.checkBoxBalloon.TabIndex = 1;\r
@@ -150,7 +152,7 @@ namespace KancolleSniffer
             // checkBoxFlash\r
             // \r
             this.checkBoxFlash.AutoSize = true;\r
-            this.checkBoxFlash.Location = new System.Drawing.Point(11, 23);\r
+            this.checkBoxFlash.Location = new System.Drawing.Point(6, 18);\r
             this.checkBoxFlash.Name = "checkBoxFlash";\r
             this.checkBoxFlash.Size = new System.Drawing.Size(127, 16);\r
             this.checkBoxFlash.TabIndex = 0;\r
@@ -173,18 +175,16 @@ namespace KancolleSniffer
             this.groupBoxSound.Controls.Add(this.buttonMissionOpenFile);\r
             this.groupBoxSound.Controls.Add(this.textBoxMissionSoundFile);\r
             this.groupBoxSound.Controls.Add(this.label4);\r
-            this.groupBoxSound.Location = new System.Drawing.Point(12, 146);\r
-            this.groupBoxSound.Margin = new System.Windows.Forms.Padding(3, 12, 3, 12);\r
+            this.groupBoxSound.Location = new System.Drawing.Point(12, 172);\r
             this.groupBoxSound.Name = "groupBoxSound";\r
-            this.groupBoxSound.Padding = new System.Windows.Forms.Padding(8);\r
-            this.groupBoxSound.Size = new System.Drawing.Size(248, 155);\r
+            this.groupBoxSound.Size = new System.Drawing.Size(240, 155);\r
             this.groupBoxSound.TabIndex = 1;\r
             this.groupBoxSound.TabStop = false;\r
             this.groupBoxSound.Text = "サウンド";\r
             // \r
             // numericUpDownSoundVolume\r
             // \r
-            this.numericUpDownSoundVolume.Location = new System.Drawing.Point(46, 23);\r
+            this.numericUpDownSoundVolume.Location = new System.Drawing.Point(41, 16);\r
             this.numericUpDownSoundVolume.Name = "numericUpDownSoundVolume";\r
             this.numericUpDownSoundVolume.Size = new System.Drawing.Size(44, 19);\r
             this.numericUpDownSoundVolume.TabIndex = 1;\r
@@ -193,7 +193,8 @@ namespace KancolleSniffer
             // label3\r
             // \r
             this.label3.AutoSize = true;\r
-            this.label3.Location = new System.Drawing.Point(11, 25);\r
+            this.label3.Location = new System.Drawing.Point(6, 18);\r
+            this.label3.Margin = new System.Windows.Forms.Padding(3);\r
             this.label3.Name = "label3";\r
             this.label3.Size = new System.Drawing.Size(29, 12);\r
             this.label3.TabIndex = 0;\r
@@ -201,7 +202,7 @@ namespace KancolleSniffer
             // \r
             // buttonMaxShipsOpenFile\r
             // \r
-            this.buttonMaxShipsOpenFile.Location = new System.Drawing.Point(196, 121);\r
+            this.buttonMaxShipsOpenFile.Location = new System.Drawing.Point(191, 114);\r
             this.buttonMaxShipsOpenFile.Name = "buttonMaxShipsOpenFile";\r
             this.buttonMaxShipsOpenFile.Size = new System.Drawing.Size(41, 23);\r
             this.buttonMaxShipsOpenFile.TabIndex = 13;\r
@@ -211,7 +212,7 @@ namespace KancolleSniffer
             // \r
             // textBoxMaxShipsSoundFile\r
             // \r
-            this.textBoxMaxShipsSoundFile.Location = new System.Drawing.Point(46, 123);\r
+            this.textBoxMaxShipsSoundFile.Location = new System.Drawing.Point(41, 116);\r
             this.textBoxMaxShipsSoundFile.Name = "textBoxMaxShipsSoundFile";\r
             this.textBoxMaxShipsSoundFile.Size = new System.Drawing.Size(144, 19);\r
             this.textBoxMaxShipsSoundFile.TabIndex = 12;\r
@@ -219,7 +220,7 @@ namespace KancolleSniffer
             // label7\r
             // \r
             this.label7.AutoSize = true;\r
-            this.label7.Location = new System.Drawing.Point(11, 126);\r
+            this.label7.Location = new System.Drawing.Point(6, 119);\r
             this.label7.Name = "label7";\r
             this.label7.Size = new System.Drawing.Size(29, 12);\r
             this.label7.TabIndex = 11;\r
@@ -227,7 +228,7 @@ namespace KancolleSniffer
             // \r
             // buttonKDockOpenFile\r
             // \r
-            this.buttonKDockOpenFile.Location = new System.Drawing.Point(196, 96);\r
+            this.buttonKDockOpenFile.Location = new System.Drawing.Point(191, 89);\r
             this.buttonKDockOpenFile.Name = "buttonKDockOpenFile";\r
             this.buttonKDockOpenFile.Size = new System.Drawing.Size(41, 23);\r
             this.buttonKDockOpenFile.TabIndex = 10;\r
@@ -237,7 +238,7 @@ namespace KancolleSniffer
             // \r
             // textBoxKDockSoundFile\r
             // \r
-            this.textBoxKDockSoundFile.Location = new System.Drawing.Point(46, 98);\r
+            this.textBoxKDockSoundFile.Location = new System.Drawing.Point(41, 91);\r
             this.textBoxKDockSoundFile.Name = "textBoxKDockSoundFile";\r
             this.textBoxKDockSoundFile.Size = new System.Drawing.Size(144, 19);\r
             this.textBoxKDockSoundFile.TabIndex = 9;\r
@@ -245,7 +246,7 @@ namespace KancolleSniffer
             // label6\r
             // \r
             this.label6.AutoSize = true;\r
-            this.label6.Location = new System.Drawing.Point(11, 101);\r
+            this.label6.Location = new System.Drawing.Point(6, 94);\r
             this.label6.Name = "label6";\r
             this.label6.Size = new System.Drawing.Size(29, 12);\r
             this.label6.TabIndex = 8;\r
@@ -253,7 +254,7 @@ namespace KancolleSniffer
             // \r
             // buttonNDockOpenFile\r
             // \r
-            this.buttonNDockOpenFile.Location = new System.Drawing.Point(196, 71);\r
+            this.buttonNDockOpenFile.Location = new System.Drawing.Point(191, 64);\r
             this.buttonNDockOpenFile.Name = "buttonNDockOpenFile";\r
             this.buttonNDockOpenFile.Size = new System.Drawing.Size(41, 23);\r
             this.buttonNDockOpenFile.TabIndex = 7;\r
@@ -263,7 +264,7 @@ namespace KancolleSniffer
             // \r
             // textBoxNDockSoundFile\r
             // \r
-            this.textBoxNDockSoundFile.Location = new System.Drawing.Point(46, 73);\r
+            this.textBoxNDockSoundFile.Location = new System.Drawing.Point(41, 66);\r
             this.textBoxNDockSoundFile.Name = "textBoxNDockSoundFile";\r
             this.textBoxNDockSoundFile.Size = new System.Drawing.Size(144, 19);\r
             this.textBoxNDockSoundFile.TabIndex = 6;\r
@@ -271,7 +272,7 @@ namespace KancolleSniffer
             // label5\r
             // \r
             this.label5.AutoSize = true;\r
-            this.label5.Location = new System.Drawing.Point(11, 76);\r
+            this.label5.Location = new System.Drawing.Point(6, 69);\r
             this.label5.Name = "label5";\r
             this.label5.Size = new System.Drawing.Size(29, 12);\r
             this.label5.TabIndex = 5;\r
@@ -279,7 +280,7 @@ namespace KancolleSniffer
             // \r
             // buttonMissionOpenFile\r
             // \r
-            this.buttonMissionOpenFile.Location = new System.Drawing.Point(196, 46);\r
+            this.buttonMissionOpenFile.Location = new System.Drawing.Point(191, 39);\r
             this.buttonMissionOpenFile.Name = "buttonMissionOpenFile";\r
             this.buttonMissionOpenFile.Size = new System.Drawing.Size(41, 23);\r
             this.buttonMissionOpenFile.TabIndex = 4;\r
@@ -289,7 +290,7 @@ namespace KancolleSniffer
             // \r
             // textBoxMissionSoundFile\r
             // \r
-            this.textBoxMissionSoundFile.Location = new System.Drawing.Point(46, 48);\r
+            this.textBoxMissionSoundFile.Location = new System.Drawing.Point(41, 41);\r
             this.textBoxMissionSoundFile.Name = "textBoxMissionSoundFile";\r
             this.textBoxMissionSoundFile.Size = new System.Drawing.Size(144, 19);\r
             this.textBoxMissionSoundFile.TabIndex = 3;\r
@@ -297,7 +298,7 @@ namespace KancolleSniffer
             // label4\r
             // \r
             this.label4.AutoSize = true;\r
-            this.label4.Location = new System.Drawing.Point(11, 51);\r
+            this.label4.Location = new System.Drawing.Point(6, 44);\r
             this.label4.Name = "label4";\r
             this.label4.Size = new System.Drawing.Size(29, 12);\r
             this.label4.TabIndex = 2;\r
@@ -306,7 +307,8 @@ namespace KancolleSniffer
             // buttonOk\r
             // \r
             this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;\r
-            this.buttonOk.Location = new System.Drawing.Point(104, 316);\r
+            this.buttonOk.Location = new System.Drawing.Point(96, 338);\r
+            this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 8, 3, 3);\r
             this.buttonOk.Name = "buttonOk";\r
             this.buttonOk.Size = new System.Drawing.Size(75, 23);\r
             this.buttonOk.TabIndex = 2;\r
@@ -317,7 +319,8 @@ namespace KancolleSniffer
             // buttonCancel\r
             // \r
             this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;\r
-            this.buttonCancel.Location = new System.Drawing.Point(185, 316);\r
+            this.buttonCancel.Location = new System.Drawing.Point(177, 338);\r
+            this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 8, 3, 3);\r
             this.buttonCancel.Name = "buttonCancel";\r
             this.buttonCancel.Size = new System.Drawing.Size(75, 23);\r
             this.buttonCancel.TabIndex = 3;\r
@@ -330,14 +333,35 @@ namespace KancolleSniffer
     ";*.wma;*.mp2;*.mp3";\r
             this.openFileDialog.Title = "オーディオファイルを選択する";\r
             // \r
+            // groupBoxShow\r
+            // \r
+            this.groupBoxShow.Controls.Add(this.checkBoxTopMost);\r
+            this.groupBoxShow.Location = new System.Drawing.Point(12, 12);\r
+            this.groupBoxShow.Name = "groupBoxShow";\r
+            this.groupBoxShow.Size = new System.Drawing.Size(240, 40);\r
+            this.groupBoxShow.TabIndex = 4;\r
+            this.groupBoxShow.TabStop = false;\r
+            this.groupBoxShow.Text = "表示";\r
+            // \r
+            // checkBoxTopMost\r
+            // \r
+            this.checkBoxTopMost.AutoSize = true;\r
+            this.checkBoxTopMost.Location = new System.Drawing.Point(6, 18);\r
+            this.checkBoxTopMost.Name = "checkBoxTopMost";\r
+            this.checkBoxTopMost.Size = new System.Drawing.Size(112, 16);\r
+            this.checkBoxTopMost.TabIndex = 0;\r
+            this.checkBoxTopMost.Text = "最前面に表示する";\r
+            this.checkBoxTopMost.UseVisualStyleBackColor = true;\r
+            // \r
             // ConfigDialog\r
             // \r
             this.AcceptButton = this.buttonOk;\r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
             this.CancelButton = this.buttonCancel;\r
-            this.ClientSize = new System.Drawing.Size(272, 351);\r
+            this.ClientSize = new System.Drawing.Size(264, 373);\r
             this.ControlBox = false;\r
+            this.Controls.Add(this.groupBoxShow);\r
             this.Controls.Add(this.buttonCancel);\r
             this.Controls.Add(this.buttonOk);\r
             this.Controls.Add(this.groupBoxSound);\r
@@ -352,6 +376,8 @@ namespace KancolleSniffer
             this.groupBoxSound.ResumeLayout(false);\r
             this.groupBoxSound.PerformLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSoundVolume)).EndInit();\r
+            this.groupBoxShow.ResumeLayout(false);\r
+            this.groupBoxShow.PerformLayout();\r
             this.ResumeLayout(false);\r
 \r
         }\r
@@ -383,5 +409,7 @@ namespace KancolleSniffer
         private System.Windows.Forms.Label label3;\r
         private System.Windows.Forms.OpenFileDialog openFileDialog;\r
         private System.Windows.Forms.NumericUpDown numericUpDownMarginShips;\r
+        private System.Windows.Forms.GroupBox groupBoxShow;\r
+        private System.Windows.Forms.CheckBox checkBoxTopMost;\r
     }\r
 }
\ No newline at end of file
index ef4060f..dbe0ab2 100644 (file)
@@ -32,6 +32,7 @@ namespace KancolleSniffer
         {\r
             var config = (Config)Tag;\r
 \r
+            checkBoxTopMost.Checked = config.TopMost;\r
             checkBoxFlash.Checked = config.FlashWindow;\r
             checkBoxBalloon.Checked = config.ShowBaloonTip;\r
             groupBoxSound.Enabled = checkBoxSound.Checked = config.PlaySound;\r
@@ -48,6 +49,7 @@ namespace KancolleSniffer
         {\r
             var config = (Config)Tag;\r
 \r
+            config.TopMost = checkBoxTopMost.Checked;\r
             config.FlashWindow = checkBoxFlash.Checked;\r
             config.ShowBaloonTip = checkBoxBalloon.Checked;\r
             config.PlaySound = checkBoxSound.Checked;\r
index 14a6b5e..f06a384 100644 (file)
@@ -71,8 +71,7 @@ namespace KancolleSniffer
         {\r
             _sniffer.LoadMaster();\r
             _config.Load();\r
-            _wmp.settings.volume = _config.SoundVolume;\r
-            _sniffer.Item.MarginShips = _config.MarginShips;\r
+            ApplyConfig();\r
             FiddlerApplication.Startup(0, FiddlerCoreStartupFlags.RegisterAsSystemProxy);\r
         }\r
 \r
@@ -98,10 +97,15 @@ namespace KancolleSniffer
 \r
         private void ConfigToolStripMenuItem_Click(object sender, EventArgs e)\r
         {\r
-            if (_configDialog.ShowDialog() != DialogResult.OK)\r
-                return;\r
+            if (_configDialog.ShowDialog(this) == DialogResult.OK)\r
+                ApplyConfig();\r
+        }\r
+\r
+        private void ApplyConfig()\r
+        {\r
+            TopMost = _config.TopMost;\r
             _wmp.settings.volume = _config.SoundVolume;\r
-            _sniffer.Item.MarginShips = _config.MarginShips;\r
+            _sniffer.Item.MarginShips = _config.MarginShips;            \r
         }\r
 \r
         private void timerMain_Tick(object sender, EventArgs e)\r