-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
2,575 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# NEU-IPGW | ||
|
||
|
||
This is the program designed to easily pass NEU ip gateway. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ipgw_new", "ipgw_new\ipgw_new.csproj", "{5D2ED149-E3E8-4C19-A46D-021867637EF9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5D2ED149-E3E8-4C19-A46D-021867637EF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5D2ED149-E3E8-4C19-A46D-021867637EF9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5D2ED149-E3E8-4C19-A46D-021867637EF9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5D2ED149-E3E8-4C19-A46D-021867637EF9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/> | ||
</startup> | ||
</configuration> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace ipgw_new | ||
{ | ||
public partial class ConfigForm : Form | ||
{ | ||
private ConfigHelper ch; | ||
private ipgwConfig myconfig; | ||
/// <summary> | ||
/// 配置更改参数类 | ||
/// </summary> | ||
public class ConfigChangedEventArgs : EventArgs | ||
{ | ||
public ipgwConfig myconfig { get; set; } | ||
} | ||
public delegate void ConfigChangedEventHandler(object sender, ConfigChangedEventArgs e); | ||
public event ConfigChangedEventHandler ConfigChanged; | ||
public ConfigForm() | ||
{ | ||
InitializeComponent(); | ||
this.ch = new ConfigHelper(); | ||
//检查是否为首次启动 | ||
if (ch.Check()) | ||
{ | ||
this.myconfig = ch.LoadConfig(); | ||
this.cancelButton.Enabled = true; | ||
this.uidBox.Text = myconfig.uid; | ||
this.pwdBox.Text = myconfig.pwd; | ||
this.linkOnStartCheckBox.Checked = (myconfig.linkOnStart == "true"); | ||
this.minOnStartCheckBox.Checked = (myconfig.minOnStart == "true"); | ||
switch (myconfig.onClosing) | ||
{ | ||
case "none": | ||
this.noneRadioButton.Checked = true; | ||
break; | ||
case "exit": | ||
this.exitRadioButton.Checked = true; | ||
break; | ||
case "minimum": | ||
this.minimumRadioButton.Checked = true; | ||
break; | ||
} | ||
} | ||
else | ||
{ | ||
this.cancelButton.Enabled = false; | ||
this.myconfig = new ipgwConfig(); | ||
} | ||
} | ||
|
||
private void button1_Click(object sender, EventArgs e) | ||
{ | ||
this.myconfig.uid = this.uidBox.Text; | ||
this.myconfig.pwd = this.pwdBox.Text; | ||
this.myconfig.linkOnStart = this.linkOnStartCheckBox.Checked ? "true" : "false"; | ||
this.myconfig.minOnStart = this.minOnStartCheckBox.Checked ? "true" : "false"; | ||
if (this.exitRadioButton.Checked) | ||
this.myconfig.onClosing = "exit"; | ||
else if (this.minimumRadioButton.Checked) | ||
this.myconfig.onClosing = "minimum"; | ||
else | ||
this.myconfig.onClosing = "none"; | ||
|
||
ConfigChangedEventArgs e1 = new ConfigChangedEventArgs(); | ||
e1.myconfig = this.myconfig; | ||
//触发事件改变主窗体配置 | ||
OnConfigChanged(e1); | ||
//保存配置到文件 | ||
ch.SaveConfig(this.myconfig); | ||
|
||
MessageBox.Show("保存成功"); | ||
this.Close(); | ||
} | ||
/// <summary> | ||
/// 触发事件的方法 | ||
/// </summary> | ||
/// <param name="e"></param> | ||
protected virtual void OnConfigChanged(ConfigChangedEventArgs e) | ||
{ | ||
if (ConfigChanged != null) | ||
ConfigChanged(this, e); | ||
} | ||
|
||
private void button2_Click(object sender, EventArgs e) | ||
{ | ||
this.Close(); | ||
} | ||
} | ||
} |
Oops, something went wrong.