/// <summary> /// コンストラクタ /// </summary> public SettingForm(SettingState St) { InitializeComponent(); tabPage1.Text = "上位プロキシ"; tabPage3.Text = "機能制限"; ChangeSetting = St; /*設定状況でフォームの変化*/ if (St.Ups.IPAdress.Length == 0) { label1.Enabled = false; label2.Enabled = false; textBox1.Enabled = false; textBox2.Enabled = false; checkBox1.Checked = false; } else { checkBox1.Checked = true; textBox1.Text = St.Ups.IPAdress; textBox2.Text = St.Ups.Port.ToString(); } if (St.PassStatus) { if (St.PassSet) { label10.Text = "認証中"; } else { label10.Text = "未認証"; checkBox1.Enabled = false; checkBox3.Enabled = false; } checkBox3.Checked = true; } else { label10.Text = "パスコード未設定"; label9.Enabled = false; label10.Enabled = false; label11.Enabled = false; textBox3.Enabled = false; button4.Enabled = false; button5.Enabled = false; } /*ここまでデザイン*/ }
/// <summary> /// 設定画面設定 /// </summary> private void Setting_Click(object sender, EventArgs e) { //設定フォームを開く SettingForm Sf = new SettingForm(SettingDefault); this.Enabled = false; Sf.ShowDialog(); this.Enabled = true; //インスタンスの決定されたメンバを適用 SettingDefault = Sf.ChangeSetting; }
/// <summary> /// フォームコンストラクタ /// </summary> public MainForm() { InitializeComponent(); this.ShowInTaskbar = false; //初期設定 UpperProxyDefault = new UpperProxy(Gi_Proxy.Properties.Settings.Default.UpperIP, Gi_Proxy.Properties.Settings.Default.UpperPort); SettingDefault = new SettingState(UpperProxyDefault, Gi_Proxy.Properties.Settings.Default.PassState, Gi_Proxy.Properties.Settings.Default.PassSet); //ダブルバッファ処理を入れてちらつき防止 this.DoubleBuffered = true; this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.UpdateStyles(); //default初期化 GraphData = new Dictionary<string, NodeNetwork>(); GraphData.Add(MainNodeParty, new NodeNetwork()); BanList = new List<string>(); //ブロックしているリストをSettingから取得 foreach (string Dm in Gi_Proxy.Properties.Settings.Default.Banlist.Split('/')) { if (Dm == "") continue; BanList.Add(Dm); } //ステータスバー表記 NotifyIcon1.Text=ApplicationName; //初期ノード GraphData[MainNodeParty].Nodes.InitNode("localhost", 1.0d, 0.0d, 0.0d); GraphData[MainNodeParty].Nodes["localhost"].NodeShape.Click += new System.EventHandler(this.NodeShape_Click); GraphData[MainNodeParty].Nodes["localhost"].NodeShape.MouseUp += new MouseEventHandler(this.NodeShape_MouseUp); GraphData[MainNodeParty].Nodes["localhost"].NodeShape.MouseMove += new MouseEventHandler(this.NodeShape_MouseMove); GraphData[MainNodeParty].Nodes["localhost"].NodeShape.ContextMenuStrip = this.contextMenuStrip1; //フォームの初期化 InitForm(); //ダブルバッファパネルにホイールのイベントを追加する this.doubleBufferPanel1.MouseWheel += new MouseEventHandler(this.doubleBufferPanel1_MouseWheel); //BBPPsの親 this.sc.Parent = this.doubleBufferPanel1; //ノードの描画を開始 timer1.Enabled = true; //サーバーソケット初期化 Server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress IP = IPAddress.Parse("127.0.0.1"); IPEndPoint IPEndPoint = new IPEndPoint(IP, 9000); Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); Server.Bind(IPEndPoint); Server.Listen(5); //クライアントからの受信を開始する ThProxy = new Thread(GetProxyRequest); ThProxy.Start(); }