Example #1
0
        private void Next_button_Click(object sender, EventArgs e)
        {
            page = GetPage();
            string[] date = new string[2];
            editForm e1   = new editForm();
            string   scr;

            switch (page)
            {
            case 0:     //0ページ目
                PageMove(1);
                break;

            case 1:    //1ページ目
                date = vpn_ctr.NameIPGet();
                Ip   = date[0];
                name = date[1];
                if (e1.check(name, Ip) == false)
                {
                    MessageBox.Show("入力が正しくありません");
                }
                else
                {
                    PageMove(2);
                }
                break;

            case 2:    //2ページ目
                date          = config_ctr.ConfigKeyGet();
                tunnelTypeStr = date[0];
                Key           = date[1];
                tunnelType    = e1.vpnValueChange(tunnelTypeStr, Key);
                if (Key == "" && tunnelType == "L2TP -L2tpPsk ")
                {
                    MessageBox.Show("事前共有キーの入力がされていません");
                }
                else
                {
                    PageMove(3);
                    ButonnTextReprint(1);
                }
                break;

            case 3:     //3ページ目
                        //vpn作成
                addOrSet = @"Add-VpnConnection";
                scr      = e1.vpnConnectionString(addOrSet, name, Ip, tunnelType);
                vpnformInstance.RunPowerShell(scr, 0);
                ButonnTextReprint(2);
                PageMove(4);
                break;

            case 4:    //4ページ目
                PageMove(5);
                break;
            }
        }
Example #2
0
        private void compbutton_Click(object sender, EventArgs e)
        {
            //必須事項が記入されているか確かめる
            bool checkflg = check(nametext.Text, iptext.Text);

            if (checkflg == false)
            {
                MessageBox.Show("入力事項を確認してください");
                return;
            }

            //流すためのソースを作成
            string src;

            if (vpnformInstance == null)
            {
                src = "Add-VpnConnection";   //作成ボタンで開いたなら
            }
            else
            {
                src = "Set-VpnConnection";   //編集ボタンで開いたなら
            }

            string vpnValue   = vpnValueChange((string)vpnValueBox.SelectedItem, secretKeyBox.Text);
            string AuthMethod = "Chap";

            src = src + " -Name " + nametext.Text + " -ServerAddress " + iptext.Text + " -TunnelType " + vpnValue + " -AuthenticationMethod " + AuthMethod + " -Force";

            vpnformInstance.RunPowerShell(src, 0);

            this.Close();
        }
Example #3
0
        private void compButton_Click(object sender, EventArgs e)
        {
            string src = "";

            src = ConnectSrcCreate(vname, userText.Text, passText.Text);
            if (src != "NULL")
            {
                vpnformInstance.RunPowerShell(src, 1); this.Close();
            }
            else
            {
                return;
            }
        }