Browse Source

restyle

pull/695/head
YFdyh000 5 years ago
parent
commit
621565f4a4
  1. 45
      v2rayN/v2rayN/Forms/MainForm.cs

45
v2rayN/v2rayN/Forms/MainForm.cs

@ -461,11 +461,8 @@ namespace v2rayN.Forms
private void lvServers_DoubleClick(object sender, EventArgs e) private void lvServers_DoubleClick(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
if (index < 0) if (index < 0) return;
{
return;
}
if (config.vmess[index].configType == (int)EConfigType.Vmess) if (config.vmess[index].configType == (int)EConfigType.Vmess)
{ {
@ -594,11 +591,9 @@ namespace v2rayN.Forms
private void menuRemoveServer_Click(object sender, EventArgs e) private void menuRemoveServer_Click(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
if (index < 0) if (index < 0) return;
{
return;
}
if (UI.ShowYesNo(UIRes.I18N("RemoveServer")) == DialogResult.No) if (UI.ShowYesNo(UIRes.I18N("RemoveServer")) == DialogResult.No)
{ {
return; return;
@ -630,11 +625,9 @@ namespace v2rayN.Forms
private void menuCopyServer_Click(object sender, EventArgs e) private void menuCopyServer_Click(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
if (index < 0) if (index < 0) return;
{
return;
}
if (ConfigHandler.CopyServer(ref config, index) == 0) if (ConfigHandler.CopyServer(ref config, index) == 0)
{ {
//刷新 //刷新
@ -644,11 +637,9 @@ namespace v2rayN.Forms
private void menuSetDefaultServer_Click(object sender, EventArgs e) private void menuSetDefaultServer_Click(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
if (index < 0) if (index < 0) return;
{
return;
}
SetDefaultServer(index); SetDefaultServer(index);
} }
@ -689,7 +680,7 @@ namespace v2rayN.Forms
} }
private void Speedtest(string actionType) private void Speedtest(string actionType)
{ {
if (GetLvSelectedIndex() < 0) return; if (GetServerListSelectedConfigIndex() < 0) return;
ClearTestResult(); ClearTestResult();
SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, actionType, UpdateSpeedtestHandler); SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, actionType, UpdateSpeedtestHandler);
} }
@ -707,19 +698,19 @@ namespace v2rayN.Forms
private void menuExport2ClientConfig_Click(object sender, EventArgs e) private void menuExport2ClientConfig_Click(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
MainFormHandler.Instance.Export2ClientConfig(index, config); MainFormHandler.Instance.Export2ClientConfig(index, config);
} }
private void menuExport2ServerConfig_Click(object sender, EventArgs e) private void menuExport2ServerConfig_Click(object sender, EventArgs e)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
MainFormHandler.Instance.Export2ServerConfig(index, config); MainFormHandler.Instance.Export2ServerConfig(index, config);
} }
private void menuExport2ShareUrl_Click(object sender, EventArgs e) private void menuExport2ShareUrl_Click(object sender, EventArgs e)
{ {
GetLvSelectedIndex(); GetServerListSelectedConfigIndex();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
foreach (int v in lvSelecteds) foreach (int v in lvSelecteds)
@ -742,7 +733,7 @@ namespace v2rayN.Forms
private void menuExport2SubContent_Click(object sender, EventArgs e) private void menuExport2SubContent_Click(object sender, EventArgs e)
{ {
GetLvSelectedIndex(); GetServerListSelectedConfigIndex();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
foreach (int v in lvSelecteds) foreach (int v in lvSelecteds)
@ -822,7 +813,7 @@ namespace v2rayN.Forms
/// 多选选中请在调用此函数后检查 lvSelecteds /// 多选选中请在调用此函数后检查 lvSelecteds
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private int GetLvSelectedIndex() private int GetServerListSelectedConfigIndex()
{ {
int index = -1; int index = -1;
lvSelecteds.Clear(); lvSelecteds.Clear();
@ -1166,7 +1157,7 @@ namespace v2rayN.Forms
private void MoveServer(EMove eMove) private void MoveServer(EMove eMove)
{ {
int index = GetLvSelectedIndex(); int index = GetServerListSelectedConfigIndex();
if (index < 0) if (index < 0)
{ {
UI.Show(UIRes.I18N("PleaseSelectServer")); UI.Show(UIRes.I18N("PleaseSelectServer"));

Loading…
Cancel
Save