mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Merge pull request #233 from chsbuffer/master
Fix some problems of saving selected index
This commit is contained in:
@@ -204,6 +204,13 @@ namespace Netch.Forms
|
|||||||
SelectLastMode();
|
SelectLastMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveConfigs()
|
||||||
|
{
|
||||||
|
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
|
||||||
|
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.SelectedIndex;
|
||||||
|
Utils.Configuration.Save();
|
||||||
|
}
|
||||||
|
|
||||||
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
||||||
{
|
{
|
||||||
var cbx = sender as ComboBox;
|
var cbx = sender as ComboBox;
|
||||||
@@ -294,6 +301,8 @@ namespace Netch.Forms
|
|||||||
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
|
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
|
||||||
ServerLabel.Text = Utils.i18N.Translate("Server");
|
ServerLabel.Text = Utils.i18N.Translate("Server");
|
||||||
ModeLabel.Text = Utils.i18N.Translate("Mode");
|
ModeLabel.Text = Utils.i18N.Translate("Mode");
|
||||||
|
ProfileLabel.Text = Utils.i18N.Translate("Profile Name");
|
||||||
|
ProfileGroupBox.Text = Utils.i18N.Translate("Profiles");
|
||||||
SettingsButton.Text = Utils.i18N.Translate("Settings");
|
SettingsButton.Text = Utils.i18N.Translate("Settings");
|
||||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||||
UsedBandwidthLabel.Text = $@"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
|
UsedBandwidthLabel.Text = $@"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
|
||||||
@@ -630,6 +639,7 @@ namespace Netch.Forms
|
|||||||
private void ReloadModesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ReloadModesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
|
SaveConfigs();
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
InitMode();
|
InitMode();
|
||||||
@@ -659,6 +669,7 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
private void EditPictureBox_Click(object sender, EventArgs e)
|
private void EditPictureBox_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
SaveConfigs();
|
||||||
// 当前ServerComboBox中至少有一项
|
// 当前ServerComboBox中至少有一项
|
||||||
if (ServerComboBox.SelectedIndex != -1)
|
if (ServerComboBox.SelectedIndex != -1)
|
||||||
{
|
{
|
||||||
@@ -757,7 +768,8 @@ namespace Netch.Forms
|
|||||||
MainController = new MainController();
|
MainController = new MainController();
|
||||||
if (MainController.Start(server, mode))
|
if (MainController.Start(server, mode))
|
||||||
{
|
{
|
||||||
if (mode.Type == 0)
|
//if (mode.Type == 0)
|
||||||
|
if (false)
|
||||||
{
|
{
|
||||||
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
|
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
|
||||||
MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;
|
MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;
|
||||||
@@ -836,7 +848,8 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
MainController.Stop();
|
MainController.Stop();
|
||||||
|
|
||||||
if (mode.Type == 0)
|
//if (mode.Type == 0)
|
||||||
|
if (false)
|
||||||
{
|
{
|
||||||
LastUploadBandwidth = 0;
|
LastUploadBandwidth = 0;
|
||||||
LastDownloadBandwidth = 0;
|
LastDownloadBandwidth = 0;
|
||||||
@@ -895,9 +908,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
|
SaveConfigs();
|
||||||
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.SelectedIndex;
|
|
||||||
Utils.Configuration.Save();
|
|
||||||
|
|
||||||
State = Models.State.Terminating;
|
State = Models.State.Terminating;
|
||||||
NotifyIcon.Visible = false;
|
NotifyIcon.Visible = false;
|
||||||
@@ -983,13 +994,18 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
catch (Exception ee)
|
catch (Exception ee)
|
||||||
{
|
{
|
||||||
Utils.Logging.Info(ee.Message);
|
Task.Run(() =>
|
||||||
ProfileButtons[index].Text = "Error";
|
{
|
||||||
|
Utils.Logging.Info(ee.Message);
|
||||||
|
ProfileButtons[index].Text = Utils.i18N.Translate("Error");
|
||||||
|
Thread.Sleep(1200);
|
||||||
|
ProfileButtons[index].Text = Utils.i18N.Translate("None");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitProfile()
|
public void InitProfile()
|
||||||
@@ -1006,7 +1022,7 @@ namespace Netch.Forms
|
|||||||
for (int i = 0; i < num_profile; ++i)
|
for (int i = 0; i < num_profile; ++i)
|
||||||
{
|
{
|
||||||
var b = new Button();
|
var b = new Button();
|
||||||
ProfileTable.Controls.Add(b,i,0);
|
ProfileTable.Controls.Add(b, i, 0);
|
||||||
b.Location = new Point(i * 100, 0);
|
b.Location = new Point(i * 100, 0);
|
||||||
b.Click += new EventHandler(ProfileButton_Click);
|
b.Click += new EventHandler(ProfileButton_Click);
|
||||||
b.Dock = DockStyle.Fill;
|
b.Dock = DockStyle.Fill;
|
||||||
@@ -1018,7 +1034,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
b.Text = "None";
|
b.Text = Utils.i18N.Translate("None");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"Started": "已启动",
|
"Started": "已启动",
|
||||||
"Stopping": "正在停止中",
|
"Stopping": "正在停止中",
|
||||||
"Stopped": "已停止",
|
"Stopped": "已停止",
|
||||||
|
|
||||||
"Server": "服务器",
|
"Server": "服务器",
|
||||||
"Import Servers From Clipboard": "从剪贴板导入服务器",
|
"Import Servers From Clipboard": "从剪贴板导入服务器",
|
||||||
"Add [Socks5] Server": "添加 [Socks5] 服务器",
|
"Add [Socks5] Server": "添加 [Socks5] 服务器",
|
||||||
@@ -50,14 +50,14 @@
|
|||||||
"Saved": "保存成功",
|
"Saved": "保存成功",
|
||||||
"Plugin": "插件",
|
"Plugin": "插件",
|
||||||
"Plugin Options": "插件参数",
|
"Plugin Options": "插件参数",
|
||||||
|
|
||||||
"Subscribe": "订阅",
|
"Subscribe": "订阅",
|
||||||
"Manage Subscribe Links": "管理订阅链接",
|
"Manage Subscribe Links": "管理订阅链接",
|
||||||
"Update Servers From Subscribe Links": "从订阅链接更新服务器",
|
"Update Servers From Subscribe Links": "从订阅链接更新服务器",
|
||||||
"No subscription link": "没有任何一条订阅链接",
|
"No subscription link": "没有任何一条订阅链接",
|
||||||
"Updating in the background": "正在后台更新中",
|
"Updating in the background": "正在后台更新中",
|
||||||
"Update completed": "更新完成",
|
"Update completed": "更新完成",
|
||||||
|
|
||||||
"Options": "选项",
|
"Options": "选项",
|
||||||
"Restart Service": "重启服务",
|
"Restart Service": "重启服务",
|
||||||
"Restarting service": "正在重启服务中",
|
"Restarting service": "正在重启服务中",
|
||||||
@@ -122,7 +122,11 @@
|
|||||||
"Global Bypass IPs": "全局直连 IP",
|
"Global Bypass IPs": "全局直连 IP",
|
||||||
"Port value illegal. Try again.": "端口值非法。请重试。",
|
"Port value illegal. Try again.": "端口值非法。请重试。",
|
||||||
"Check update when opened": "打开软件时检查更新",
|
"Check update when opened": "打开软件时检查更新",
|
||||||
|
|
||||||
|
"Profile Name": "Profile Name",
|
||||||
|
"Profiles": "Profiles",
|
||||||
|
"None": "无",
|
||||||
|
|
||||||
"Show": "显示",
|
"Show": "显示",
|
||||||
"Exit": "退出"
|
"Exit": "退出"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user