フレンドリネームに" USB "を含むディスクドライブをリフレッシュ
Revision | c160128a0c3e43494d9b22635afc875f4fcfe716 (tree) |
---|---|
Time | 2019-10-15 22:06:09 |
Author | Yasushi Tanaka <tanaka_yasushi2008@yaho...> |
Commiter | Yasushi Tanaka |
Ver.1.2.0 - ディスク無効化後に1500msスリープする (安定性向上のため)
@@ -36,7 +36,7 @@ | ||
36 | 36 | // OKButton |
37 | 37 | // |
38 | 38 | this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK; |
39 | - this.OKButton.Location = new System.Drawing.Point(275, 204); | |
39 | + this.OKButton.Location = new System.Drawing.Point(332, 256); | |
40 | 40 | this.OKButton.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); |
41 | 41 | this.OKButton.Name = "OKButton"; |
42 | 42 | this.OKButton.Size = new System.Drawing.Size(168, 57); |
@@ -47,13 +47,13 @@ | ||
47 | 47 | // |
48 | 48 | // HistoryTextBox |
49 | 49 | // |
50 | - this.HistoryTextBox.Location = new System.Drawing.Point(20, 18); | |
50 | + this.HistoryTextBox.Location = new System.Drawing.Point(26, 18); | |
51 | 51 | this.HistoryTextBox.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); |
52 | 52 | this.HistoryTextBox.Multiline = true; |
53 | 53 | this.HistoryTextBox.Name = "HistoryTextBox"; |
54 | 54 | this.HistoryTextBox.ReadOnly = true; |
55 | 55 | this.HistoryTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; |
56 | - this.HistoryTextBox.Size = new System.Drawing.Size(674, 151); | |
56 | + this.HistoryTextBox.Size = new System.Drawing.Size(783, 206); | |
57 | 57 | this.HistoryTextBox.TabIndex = 1; |
58 | 58 | this.HistoryTextBox.Text = resources.GetString("HistoryTextBox.Text"); |
59 | 59 | // |
@@ -61,7 +61,7 @@ | ||
61 | 61 | // |
62 | 62 | this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F); |
63 | 63 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
64 | - this.ClientSize = new System.Drawing.Size(717, 285); | |
64 | + this.ClientSize = new System.Drawing.Size(832, 342); | |
65 | 65 | this.Controls.Add(this.HistoryTextBox); |
66 | 66 | this.Controls.Add(this.OKButton); |
67 | 67 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; |
@@ -118,7 +118,9 @@ | ||
118 | 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
119 | 119 | </resheader> |
120 | 120 | <data name="HistoryTextBox.Text" xml:space="preserve"> |
121 | - <value>【2019/2/25 Ver1.1.0】 | |
121 | + <value>【2019/10/12 Ver.1.2.0】 | |
122 | +・ディスク無効化から有効化するまでの間に1500msスリープするようにした(安定性向上のため) | |
123 | +【2019/2/25 Ver.1.1.0】 | |
122 | 124 | ・リフレッシュを行う際に、エクスプローラでフォルダが開かれていた場合は自動で閉じる機能を追加(エクスプローラのバグ対策) |
123 | 125 | ・スケーリングAwareをマニフェストファイルで明示的に指定 |
124 | 126 | 【2019/1/5 Ver.1.0.0】 |
@@ -42,6 +42,16 @@ namespace DiskRefresh | ||
42 | 42 | /// 無効状態の論理ドライブ名並び |
43 | 43 | /// </summary> |
44 | 44 | private string[] disabledLogicalDrives = null; |
45 | + | |
46 | + /// <summary> | |
47 | + /// デバイス無効化後の待ち時間(合計時間) | |
48 | + /// </summary> | |
49 | + private readonly int waitAfterDisabled = 1500; | |
50 | + | |
51 | + /// <summary> | |
52 | + /// デバイス無効化後の待ち時間(DoEventsの間隔) | |
53 | + /// </summary> | |
54 | + private readonly int waitAfterDisabledUnit = 50; | |
45 | 55 | |
46 | 56 | /// <summary> |
47 | 57 | /// コンストラクタ |
@@ -141,6 +151,15 @@ namespace DiskRefresh | ||
141 | 151 | return; |
142 | 152 | } |
143 | 153 | |
154 | + // ここでスリープ | |
155 | + GuideLabel.Text = "USBディスクを無効化しました\nしばらくお待ちください…"; | |
156 | + Application.DoEvents(); | |
157 | + for (int waitTime = 0; waitTime < waitAfterDisabled; waitTime += waitAfterDisabledUnit) | |
158 | + { | |
159 | + System.Threading.Thread.Sleep(waitAfterDisabledUnit); | |
160 | + Application.DoEvents(); | |
161 | + } | |
162 | + | |
144 | 163 | // 無効時の論理ドライブ並びを取得 |
145 | 164 | disabledLogicalDrives = getLogicalDrives(); |
146 | 165 |