欢迎光临
我们一直在努力

建站超值云服务器,限时71元/月

using system;
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;

namespace cprogrammanage
{
    /// <summary>
    /// summary description for frmconfigure.
    /// </summary>
    public class frmconfigure : system.windows.forms.form
    {
        private microsoft.win32.registrykey parentkey;
        private bool bolexistkey;

        private system.windows.forms.tabcontrol tabcontrol1;
        private system.windows.forms.tabpage tabpage1;
        private system.windows.forms.label label1;
        private system.windows.forms.label label2;
        private system.windows.forms.label label3;
        private system.windows.forms.textbox txtlserver;
        private system.windows.forms.textbox txtldatabase;
        private system.windows.forms.textbox txtlloginid;
        private system.windows.forms.checkbox chklntlogin;
        private system.windows.forms.linklabel linkcancel;
        private system.windows.forms.linklabel linkok;
        private system.windows.forms.linklabel linkdefault;
        private system.windows.forms.tabpage tabpage2;
        private system.windows.forms.checkbox chkrntlogin;
        private system.windows.forms.textbox txtrloginid;
        private system.windows.forms.textbox txtrdatabase;
        private system.windows.forms.textbox txtrserver;
        private system.windows.forms.label label4;
        private system.windows.forms.label label5;
        private system.windows.forms.label label6;
        /// <summary>
        /// required designer variable.
        /// </summary>
        private system.componentmodel.container components = null;

        public frmconfigure()
        {
            //
            // required for windows form designer support
            //
            initializecomponent();

            //
            // todo: add any constructor code after initializecomponent call
            //
        }

        /// <summary>
        /// clean up any resources being used.
        /// </summary>
        protected override void dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.dispose();
                }
            }
            base.dispose( disposing );
        }

        #region windows form designer generated code
        /// <summary>
        /// required method for designer support – do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void initializecomponent()
        {
            this.tabcontrol1 = new system.windows.forms.tabcontrol();
            this.tabpage1 = new system.windows.forms.tabpage();
            this.chklntlogin = new system.windows.forms.checkbox();
            this.txtlloginid = new system.windows.forms.textbox();
            this.label3 = new system.windows.forms.label();
            this.txtldatabase = new system.windows.forms.textbox();
            this.label2 = new system.windows.forms.label();
            this.txtlserver = new system.windows.forms.textbox();
            this.label1 = new system.windows.forms.label();
            this.tabpage2 = new system.windows.forms.tabpage();
            this.label4 = new system.windows.forms.label();
            this.label5 = new system.windows.forms.label();
            this.label6 = new system.windows.forms.label();
            this.chkrntlogin = new system.windows.forms.checkbox();
            this.txtrloginid = new system.windows.forms.textbox();
            this.txtrdatabase = new system.windows.forms.textbox();
            this.txtrserver = new system.windows.forms.textbox();
            this.linkcancel = new system.windows.forms.linklabel();
            this.linkok = new system.windows.forms.linklabel();
            this.linkdefault = new system.windows.forms.linklabel();
            this.tabcontrol1.suspendlayout();
            this.tabpage1.suspendlayout();
            this.tabpage2.suspendlayout();
            this.suspendlayout();
            //
            // tabcontrol1
            //
            this.tabcontrol1.controls.addrange(new system.windows.forms.control[] {
                                                                                      this.tabpage1,
                                                                                      this.tabpage2});
            this.tabcontrol1.name = "tabcontrol1";
            this.tabcontrol1.selectedindex = 0;
            this.tabcontrol1.size = new system.drawing.size(256, 152);
            this.tabcontrol1.tabindex = 0;
            //
            // tabpage1
            //
            this.tabpage1.controls.addrange(new system.windows.forms.control[] {
                                                                                   this.chklntlogin,
                                                                                   this.txtlloginid,
                                                                                   this.label3,
                                                                                   this.txtldatabase,
                                                                                   this.label2,
                                                                                   this.txtlserver,
                                                                                   this.label1});
            this.tabpage1.location = new system.drawing.point(4, 22);
            this.tabpage1.name = "tabpage1";
            this.tabpage1.size = new system.drawing.size(248, 126);
            this.tabpage1.tabindex = 0;
            this.tabpage1.text = "local setup";
            //
            // chklntlogin
            //
            this.chklntlogin.location = new system.drawing.point(72, 104);
            this.chklntlogin.name = "chklntlogin";
            this.chklntlogin.size = new system.drawing.size(72, 16);
            this.chklntlogin.tabindex = 6;
            this.chklntlogin.text = "nt login";
            this.chklntlogin.checkedchanged += new system.eventhandler(this.chklntlogin_checkedchanged);
            //
            // txtlloginid
            //
            this.txtlloginid.location = new system.drawing.point(72, 72);
            this.txtlloginid.name = "txtlloginid";
            this.txtlloginid.size = new system.drawing.size(160, 20);
            this.txtlloginid.tabindex = 5;
            this.txtlloginid.text = "";
            //
            // label3
            //
            this.label3.autosize = true;
            this.label3.location = new system.drawing.point(24, 76);
            this.label3.name = "label3";
            this.label3.size = new system.drawing.size(46, 13);
            this.label3.tabindex = 4;
            this.label3.text = "loginid:";
            //
            // txtldatabase
            //
            this.txtldatabase.location = new system.drawing.point(72, 40);
            this.txtldatabase.name = "txtldatabase";
            this.txtldatabase.size = new system.drawing.size(160, 20);
            this.txtldatabase.tabindex = 3;
            this.txtldatabase.text = "";
            //
            // label2
            //
            this.label2.autosize = true;
            this.label2.location = new system.drawing.point(16, 44);
            this.label2.name = "label2";
            this.label2.size = new system.drawing.size(57, 13);
            this.label2.tabindex = 2;
            this.label2.text = "database:";
            //
            // txtlserver
            //
            this.txtlserver.location = new system.drawing.point(72, 8);
            this.txtlserver.name = "txtlserver";
            this.txtlserver.size = new system.drawing.size(160, 20);
            this.txtlserver.tabindex = 1;
            this.txtlserver.text = "";
            //
            // label1
            //
            this.label1.autosize = true;
            this.label1.location = new system.drawing.point(32, 12);
            this.label1.name = "label1";
            this.label1.size = new system.drawing.size(41, 13);
            this.label1.tabindex = 0;
            this.label1.text = "server:";
            //
            // tabpage2
            //
            this.tabpage2.controls.addrange(new system.windows.forms.control[] {
                                                                                   this.label4,
                                                                                   this.label5,
                                                                                   this.label6,
                                                                                   this.chkrntlogin,
                                                                                   this.txtrloginid,
                                                                                   this.txtrdatabase,
                                                                                   this.txtrserver});
            this.tabpage2.location = new system.drawing.point(4, 22);
            this.tabpage2.name = "tabpage2";
            this.tabpage2.size = new system.drawing.size(248, 126);
            this.tabpage2.tabindex = 1;
            this.tabpage2.text = "remote setup";
            //
            // label4
            //
            this.label4.autosize = true;
            this.label4.location = new system.drawing.point(24, 75);
            this.label4.name = "label4";
            this.label4.size = new system.drawing.size(46, 13);
            this.label4.tabindex = 16;
            this.label4.text = "loginid:";
            //
            // label5
            //
            this.label5.autosize = true;
            this.label5.location = new system.drawing.point(16, 43);
            this.label5.name = "label5";
            this.label5.size = new system.drawing.size(57, 13);
            this.label5.tabindex = 15;
            this.label5.text = "database:";
            //
            // label6
            //
            this.label6.autosize = true;
            this.label6.location = new system.drawing.point(32, 11);
            this.label6.name = "label6";
            this.label6.size = new system.drawing.size(41, 13);
            this.label6.tabindex = 14;
            this.label6.text = "server:";
            //
            // chkrntlogin
            //
            this.chkrntlogin.location = new system.drawing.point(74, 103);
            this.chkrntlogin.name = "chkrntlogin";
            this.chkrntlogin.size = new system.drawing.size(72, 16);
            this.chkrntlogin.tabindex = 13;
            this.chkrntlogin.text = "nt login";
            this.chkrntlogin.checkedchanged += new system.eventhandler(this.chkrntlogin_checkedchanged);
            //
            // txtrloginid
            //
            this.txtrloginid.location = new system.drawing.point(74, 71);
            this.txtrloginid.name = "txtrloginid";
            this.txtrloginid.size = new system.drawing.size(160, 20);
            this.txtrloginid.tabindex = 12;
            this.txtrloginid.text = "";
            //
            // txtrdatabase
            //
            this.txtrdatabase.location = new system.drawing.point(74, 39);
            this.txtrdatabase.name = "txtrdatabase";
            this.txtrdatabase.size = new system.drawing.size(160, 20);
            this.txtrdatabase.tabindex = 10;
            this.txtrdatabase.text = "";
            //
            // txtrserver
            //
            this.txtrserver.location = new system.drawing.point(74, 7);
            this.txtrserver.name = "txtrserver";
            this.txtrserver.size = new system.drawing.size(160, 20);
            this.txtrserver.tabindex = 8;
            this.txtrserver.text = "";
            //
            // linkcancel
            //
            this.linkcancel.autosize = true;
            this.linkcancel.location = new system.drawing.point(208, 155);
            this.linkcancel.name = "linkcancel";
            this.linkcancel.size = new system.drawing.size(39, 13);
            this.linkcancel.tabindex = 10;
            this.linkcancel.tabstop = true;
            this.linkcancel.text = "can&cel";
            this.linkcancel.linkclicked += new system.windows.forms.linklabellinkclickedeventhandler(this.linkcancel_linkclicked);
            //
            // linkok
            //
            this.linkok.autosize = true;
            this.linkok.location = new system.drawing.point(176, 155);
            this.linkok.name = "linkok";
            this.linkok.size = new system.drawing.size(21, 13);
            this.linkok.tabindex = 9;
            this.linkok.tabstop = true;
            this.linkok.text = "&ok";
            this.linkok.linkclicked += new system.windows.forms.linklabellinkclickedeventhandler(this.linkok_linkclicked);
            //
            // linkdefault
            //
            this.linkdefault.location = new system.drawing.point(16, 155);
            this.linkdefault.name = "linkdefault";
            this.linkdefault.size = new system.drawing.size(48, 13);
            this.linkdefault.tabindex = 11;
            this.linkdefault.tabstop = true;
            this.linkdefault.text = "&default";
            this.linkdefault.linkclicked += new system.windows.forms.linklabellinkclickedeventhandler(this.linkdefault_linkclicked);
            //
            // frmconfigure
            //
            this.autoscalebasesize = new system.drawing.size(5, 13);
            this.clientsize = new system.drawing.size(256, 173);
            this.controls.addrange(new system.windows.forms.control[] {
                                                                          this.linkdefault,
                                                                          this.linkcancel,
                                                                          this.linkok,
                                                                          this.tabcontrol1});
            this.maximizebox = false;
            this.minimizebox = false;
            this.name = "frmconfigure";
            this.text = "configure the login setup";
            this.load += new system.eventhandler(this.frmconfigure_load);
            this.tabcontrol1.resumelayout(false);
            this.tabpage1.resumelayout(false);
            this.tabpage2.resumelayout(false);
            this.resumelayout(false);

        }
        #endregion

        private void linkdefault_linkclicked(object sender, system.windows.forms.linklabellinkclickedeventargs e)
        {
            txtlserver.text="192.168.0.1";
            txtrserver.text="1.1.1.1";
            txtldatabase.text="data";
            txtrdatabase.text="data";
        }

        private void chkrntlogin_checkedchanged(object sender, system.eventargs e)
        {
            if(this.chkrntlogin.checked)
            {
                txtrloginid.enabled=false;
            }
            else
            {
                txtrloginid.enabled=true;
            }
        }

        private void frmconfigure_load(object sender, system.eventargs e)
        {
            //txtlserver.text=system.getsetting("programmanage","logoninfo","localserver","192.168.0.1");
            //string[] reabc;
            try
            {
                //reabc=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvaluenames();
                txtlserver.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("localserver").tostring();
                txtldatabase.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("localdatabase").tostring();
                txtlloginid.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("localloginid").tostring();
                if(microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("localntlogin").tostring()=="0")
                {
                    chklntlogin.checked=false;
                }
                else
                {
                    chklntlogin.checked=true;
                }
                txtrserver.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("remoteserver").tostring();
                txtrdatabase.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("remotedatabase").tostring();
                txtrloginid.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("remoteloginid").tostring();
                if(microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue("remotentlogin").tostring()=="0")
                {
                    chkrntlogin.checked=false;
                }
                else
                {
                    chkrntlogin.checked=true;
                }
            }
            catch (exception k)
            {
                messagebox.show(k.message,k.source+k.gethashcode(),messageboxbuttons.ok,messageboxicon.information);
                return;
            }
/*
            for (int i=0;i<reabc.length;i++)
            {
                if(reabc[i]!="localserver")
                {
                    txtlserver.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue(reabc[i]).tostring();
                }
                else
                {
                    txtrserver.text=microsoft.win32.registry.currentuser.opensubkey("software").opensubkey("programmanage").getvalue(reabc[i]).tostring();
                }
            }
*/            //txtlserver.text=reabc[0];
            //txtldatabase.text=reabc[1];
            //txtlloginid.text=reabc[2];
        }

        private void chklntlogin_checkedchanged(object sender, system.eventargs e)
        {
            if (chklntlogin.checked)
            {
                txtlloginid.enabled=false;
            }
            else
            {
                txtlloginid.enabled=true;
            }
        }

        private void linkok_linkclicked(object sender, system.windows.forms.linklabellinkclickedeventargs e)
        {
            
            try
            {
                parentkey=microsoft.win32.registry.currentuser.opensubkey("software",true).opensubkey("programmanage",true);
            }
            catch (exception l)
            {
                bolexistkey=true;
            }

            if (bolexistkey)
            {
                parentkey=microsoft.win32.registry.currentuser.opensubkey("software",true).createsubkey("programmanage");
            }

                //parentkey.
                parentkey.setvalue("localserver",txtlserver.text);
                parentkey.setvalue("localdatabase",txtldatabase.text);
                parentkey.setvalue("localloginid",txtlloginid.text);
                if (chklntlogin.checked )
                {
                    parentkey.setvalue("localntlogin","1");
                }
                else
                {
                    parentkey.setvalue("localntlogin","0");
                }
                parentkey.setvalue("remoteserver",txtrserver.text);
                parentkey.setvalue("remotedatabase",txtrdatabase.text);
                parentkey.setvalue("remoteloginid",txtrloginid.text);
                if (chkrntlogin.checked )
                {
                    parentkey.setvalue("remotentlogin","1");
                }
                else
                {
                    parentkey.setvalue("remotentlogin","0");
                }
            this.close();
        }

        private void linkcancel_linkclicked(object sender, system.windows.forms.linklabellinkclickedeventargs e)
        {
            this.close();
        }
    }
}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 »
分享到: 更多 (0)

相关推荐

  • 暂无文章