diff --git a/Netch/Controllers/MainController.cs b/Netch/Controllers/MainController.cs
index 7c2d7b6d..607e5c52 100644
--- a/Netch/Controllers/MainController.cs
+++ b/Netch/Controllers/MainController.cs
@@ -235,6 +235,22 @@ namespace Netch.Controllers
return result;
}
+ ///
+ /// 重测NAT
+ ///
+ public void RetryNatTest()
+ {
+ _ = Task.Run(() =>
+ {
+ Global.MainForm.NatTypeStatusText(i18N.Translate("Starting NatTester"));
+ // Thread.Sleep(1000);
+ var (nttResult, natType, localEnd, publicEnd) = pNTTController.Start();
+ var country = Utils.Utils.GetCityCode(publicEnd);
+
+ if (nttResult) Global.MainForm.NatTypeStatusText(natType, country);
+ });
+ }
+
///
/// 停止
///
diff --git a/Netch/Forms/MainForm.Designer.cs b/Netch/Forms/MainForm.Designer.cs
index 7b9b5d72..24beb70d 100644
--- a/Netch/Forms/MainForm.Designer.cs
+++ b/Netch/Forms/MainForm.Designer.cs
@@ -605,6 +605,7 @@ namespace Netch.Forms
this.NatTypeStatusLabel.Size = new System.Drawing.Size(36, 17);
this.NatTypeStatusLabel.Text = "NAT:";
this.NatTypeStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
+ this.NatTypeStatusLabel.Click += new System.EventHandler(this.NatTypeStatusLabel_Click);
//
// NatTypeStatusLightLabel
//
@@ -616,6 +617,7 @@ namespace Netch.Forms
this.NatTypeStatusLightLabel.Size = new System.Drawing.Size(18, 21);
this.NatTypeStatusLightLabel.Text = "⬤";
this.NatTypeStatusLightLabel.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+ this.NatTypeStatusLightLabel.Click += new System.EventHandler(this.NatTypeStatusLabel_Click);
//
// ControlButton
//
diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs
index cd1469c3..1c993919 100644
--- a/Netch/Forms/MainForm.cs
+++ b/Netch/Forms/MainForm.cs
@@ -441,5 +441,14 @@ namespace Netch.Forms
if (!_comboBoxInitialized) return;
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
}
+
+ private void NatTypeStatusLabel_Click(object sender, EventArgs e)
+ {
+ //一个不太优雅的🔒
+ if (_state == State.Started && NatTypeStatusLabel.ToString().Contains("["))
+ {
+ _mainController.RetryNatTest();
+ }
+ }
}
}
\ No newline at end of file