1 import win.ui; 2 import inet.adapter; 3 import inet.conn; 4 /*DSG{{*/ 5 winForm = ..win.form(text="网卡管理工具";right=305;bottom=521;max=false) 6 winForm.add( 7 button={cls="button";text="修改";left=79;top=447;right=219;bottom=485;z=16}; 8 combobox={cls="combobox";left=34;top=39;right=260;bottom=65;edge=1;items={};mode="dropdownlist";z=6}; 9 edns={cls="edit";text="8.8.8.8";left=114;top=393;right=254;bottom=411;disabled=1;edge=1;z=14}; 10 eip={cls="edit";text="192.168.0.0";left=121;top=148;right=258;bottom=166;disabled=1;edge=1;z=10}; 11 emac={cls="static";text="00-00-00-00";left=94;top=290;right=270;bottom=308;z=15}; 12 ewangguan={cls="edit";text="192.168.0.1";left=121;top=217;right=258;bottom=235;disabled=1;edge=1;z=12}; 13 eyanma={cls="edit";text="255.255.255.0";left=120;top=180;right=257;bottom=198;disabled=1;edge=1;z=11}; 14 groupbox={cls="groupbox";text="ip地址设置";left=18;top=94;right=286;bottom=263;edge=1;z=3}; 15 groupbox2={cls="groupbox";text="选择网卡名称";left=15;top=15;right=287;bottom=79;edge=1;z=4}; 16 groupbox3={cls="groupbox";text="dns设置";left=21;top=333;right=286;bottom=433;edge=1;z=1}; 17 groupbox4={cls="groupbox";text="mac地址";left=20;top=269;right=287;bottom=318;edge=1;z=2}; 18 radiobutton={cls="radiobutton";text="自动选择";left=38;top=115;right=132;bottom=129;checked=1;z=17}; 19 radiobutton2={cls="radiobutton";text="使用下面";left=166;top=113;right=246;bottom=127;z=18}; 20 radiobutton3={cls="radiobutton";text="自动选择";left=38;top=357;right=132;bottom=378;checked=1;z=19}; 21 radiobutton4={cls="radiobutton";text="使用下面";left=142;top=358;right=222;bottom=372;z=20}; 22 sdns={cls="static";text="dns地址:";left=38;top=395;right=100;bottom=416;notify=1;transparent=1;z=13}; 23 sip={cls="static";text="ip地址:";left=40;top=150;right=99;bottom=186;notify=1;transparent=1;z=7}; 24 static={cls="static";text="static";left=-152;top=485;right=24;bottom=503;transparent=1;z=21}; 25 static2={cls="static";text="static2";left=-177;top=-230;right=35;bottom=43;notify=1;transparent=1;z=5}; 26 static3={cls="static";text="powered by aardio(www.yaoyue68.com)";left=34;top=498;right=299;bottom=516;transparent=1;z=22}; 27 swangguan={cls="static";text="网关地址:";left=37;top=220;right=106;bottom=241;notify=1;transparent=1;z=9}; 28 syanma={cls="static";text="子网掩码:";left=36;top=184;right=105;bottom=205;notify=1;transparent=1;z=8} 29 ) 30 /*}}*/ 31 32 winForm.radiobutton4.oncommand = function(id,event){ 33 jing_mo(3) 34 } 35 36 winForm.radiobutton3.oncommand = function(id,event){ 37 jing_mo(4) 38 } 39 40 winForm.radiobutton.oncommand = function(id,event){ 41 jing_mo(2) 42 } 43 44 winForm.radiobutton2.oncommand = function(id,event){ 45 jing_mo(1) 46 } 47 //静默文本,默认静默 48 jing_mo=function(y){ 49 50 select(y) { 51 case 1 { 52 winForm.eip.disabled=false 53 winForm.eyanma.disabled=false 54 winForm.ewangguan.disabled=false 55 } 56 case 2{ 57 winForm.eip.disabled=true 58 winForm.eyanma.disabled=true 59 winForm.ewangguan.disabled=true 60 61 } 62 case 3{ 63 winForm.edns.disabled=false 64 } 65 else { 66 winForm.edns.disabled=true 67 } 68 } 69 } 70 71 //默认显示项设置 72 winForm.combobox.add("请选择网卡") 73 winForm.combobox.selectString("请选择") //查找并默认选中 74 75 //循环显示网卡列表 76 winForm.combobox.oncommand = function(id,event){ 77 78 for adptInfo in inet.adapter.each() { 79 //去重 80 if(!winForm.combobox.findEx(adptInfo.description)){ 81 winForm.combobox.add(adptInfo.description) 82 } 83 } 84 85 86 echo_s(winForm.combobox.selText) 87 88 } 89 90 //匹配选中项并操作信息 91 92 echo_s=function(a){ 93 94 for adptInfo in inet.adapter.each() { 95 if(a=adptInfo.description){ 96 winForm.eip.text=adptInfo.ipAddressList.ipAddress ; 97 winForm.emac.text= adptInfo.mac; 98 winForm.eyanma.text=adptInfo.ipAddressList.ipMask ; 99 winForm.ewangguan.text=adptInfo.gatewayList.ipAddress ; 100 winForm.edns.text =adptInfo.dhcpServer.ipAddress ; 101 102 } 103 104 } 118 winForm.show() 119 win.loopMessage();
时间: 2024-10-21 17:04:42