Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
satouriko committed Sep 17, 2016
1 parent 4f7b185 commit 73d171a
Show file tree
Hide file tree
Showing 24 changed files with 2,575 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
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.



22 changes: 22 additions & 0 deletions ipgw_new.sln
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
6 changes: 6 additions & 0 deletions ipgw_new/App.config
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>
219 changes: 219 additions & 0 deletions ipgw_new/ConfigForm.Designer.cs

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

97 changes: 97 additions & 0 deletions ipgw_new/ConfigForm.cs
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();
}
}
}
Loading

0 comments on commit 73d171a

Please sign in to comment.