コード例 #1
0
ファイル: MainForm.cs プロジェクト: zhouziqunzzq/ipgw_new
 public MainForm()
 {
     InitializeComponent();
     this.ch       = new ConfigHelper();
     this.myconfig = new ipgwConfig();
     this.hh       = new httpHelper();
     this.tempE    = new onClosingForm.onClosingEventArgs();
     //检查是否为首次启动
     if (ch.Check())
     {
         this.myconfig = ch.LoadConfig();
     }
     else
     {
         MessageBox.Show("欢迎使用IP控制网关!在开始之前,请进行简单的配置。", "欢迎", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.button1_Click(new object(), new EventArgs());
     }
     //若需要,自动最小化
     if (this.myconfig.minOnStart == "true")
     {
         this.Visible             = false;
         this.ShowInTaskbar       = false;
         this.WindowState         = FormWindowState.Minimized;
         this.notifyIcon1.Visible = true;
     }
     //若需要,进行自动连接
     if (this.myconfig.linkOnStart == "true")
     {
         this.hh.Logout(this.myconfig.uid, this.myconfig.pwd);
         this.连接网络ToolStripMenuItem_Click(new object(), new EventArgs());
         this.获取信息ToolStripMenuItem_Click(new object(), new EventArgs());
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: zhouziqunzzq/ipgw_new
 protected void onClosing(object sender, onClosingForm.onClosingEventArgs e)
 {
     this.tempE          = e;
     this.onClosingShown = true;
     if (e.remember)
     {
         this.myconfig.onClosing = e.choice;
         ch.SaveConfig(this.myconfig);
     }
     if (e.choice == "exit")
     {
         this.notifyIcon1.Visible = false;
         this.Close();
     }
     else
     {
         this.WindowState         = FormWindowState.Minimized;
         this.Visible             = false;
         this.notifyIcon1.Visible = true;
     }
 }