Skip to content

Commit

Permalink
Merge pull request #245 from LovelyWei/master
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup authored Feb 18, 2020
2 parents 9b7f0b1 + df70603 commit 9f46d7a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
22 changes: 21 additions & 1 deletion Netch/Forms/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Netch.Controllers;
using Netch.Controllers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -791,6 +791,26 @@ private void ControlButton_Click(object sender, EventArgs e)
// UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
// MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;

// 如果勾选启动后最小化
if (Global.Settings.MinimizeWhenStarted)
{
WindowState = FormWindowState.Minimized;
NotifyIcon.Visible = true;

if (IsFirstOpened)
{
// 显示提示语
NotifyIcon.ShowBalloonTip(5,
UpdateChecker.Name,
Utils.i18N.Translate("Netch is now minimized to the notification bar, double click this icon to restore."),
ToolTipIcon.Info);

IsFirstOpened = false;
}

Hide();
}

ControlButton.Enabled = true;
ControlButton.Text = Utils.i18N.Translate("Stop");

Expand Down
27 changes: 20 additions & 7 deletions Netch/Forms/SettingForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Netch/Forms/SettingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void SettingForm_Load(object sender, EventArgs e)
StopWhenExitedCheckBox.Checked = Global.Settings.StopWhenExited;
StartWhenOpenedCheckBox.Checked = Global.Settings.StartWhenOpened;
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;

Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
Expand All @@ -72,6 +73,7 @@ private void SettingForm_Load(object sender, EventArgs e)
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
StopWhenExitedCheckBox.Text = Utils.i18N.Translate(StopWhenExitedCheckBox.Text);
StartWhenOpenedCheckBox.Text = Utils.i18N.Translate(StartWhenOpenedCheckBox.Text);
MinimizeWhenStartedCheckBox.Text = Utils.i18N.Translate(MinimizeWhenStartedCheckBox.Text);
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);

Expand Down Expand Up @@ -133,6 +135,7 @@ private void ControlButton_Click(object sender, EventArgs e)
Global.Settings.StopWhenExited = StopWhenExitedCheckBox.Checked;
Global.Settings.StartWhenOpened = StartWhenOpenedCheckBox.Checked;
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;

try
{
Expand Down
5 changes: 5 additions & 0 deletions Netch/Models/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public class Setting
/// </summary>
public bool StartWhenOpened = false;

/// <summary>
/// 是否启动后自动最小化
/// </summary>
public bool MinimizeWhenStarted = false;

/// <summary>
/// 是否打开软件时检查更新
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Netch/Resources/zh-CN
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@

"Settings": "设置",
"Start when opened": "打开软件时启动加速",
"Minimize when started": "启动加速后隐藏",
"Local Port": "本地端口",
"Allow other Devices to connect": "允许其他设备连入",
"Netmask": "子网掩码",
Expand Down

0 comments on commit 9f46d7a

Please sign in to comment.