import fonts.fontAwesome; import win.ui; /*DSG{{*/ setting = win.form(text="aardio form";right=984;bottom=589;bgcolor=16777215) setting.add( btnConnect={cls="plus";text="连接";left=322;top=176;right=506;bottom=212;bgcolor=11580047;dl=1;dt=1;font=LOGFONT(h=-16;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=20}};iconText='\uF066';notify=1;tabstop=1;z=3}; btnFresh={cls="plus";text="刷新";left=126;top=176;right=310;bottom=212;bgcolor=11580047;dl=1;dt=1;font=LOGFONT(h=-16;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=20}};iconText='\uF021';notify=1;tabstop=1;z=2}; cbbDev={cls="combobox";left=127;top=123;right=376;bottom=149;dl=1;dt=1;edge=1;items={};mode="dropdown";z=5}; plus={cls="plus";text="全屏";left=133;top=316;right=216;bottom=347;align="left";dl=1;dt=1;font=LOGFONT(h=-15);iconStyle={align="left";font=LOGFONT(h=-15;name='FontAwesome')};iconText='\uF0C8 ';notify=1;textPadding={left=24};z=7}; plus5={cls="plus";text="English";left=130;top=264;right=248;bottom=295;align="left";dl=1;dt=1;font=LOGFONT(h=-20;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=5}};iconText='\uF0C8';notify=1;textPadding={left=30};z=1}; static={cls="static";left=128;top=65;right=441;bottom=81;transparent=1;z=6}; static4={cls="static";text="V2.7 20230616";left=745;top=4;right=981;bottom=35;align="right";font=LOGFONT(h=-22);notify=1;transparent=1;z=4} ) /*}}*/ setting.plus.skin({ color={ active=0xFF00FF00; default=0xFF000000; disabled=0xEE666666; hover=0xFFFF0000 }; checked={ iconText='\uF14A' } }) import usb2canfd; import win.timer import console; loadcodex("\dlg\msg.aardio"); loadcodex("\CANThread\CanThreadStart.aardio"); setting.btnConnect.disabled = 1; setting.btnFresh.oncommand = function(id,event){ setting.cbbDev.clear();//清空下拉框,防止反复刷新叠加 CT_Fresh(); sleep(100); var ret = CT_GetCANHw(); if(ret != null && #ret > 0){ for(i=1;#ret;1){ setting.cbbDev.add(ret[i]); } setting.btnConnect.disabled = 0; } else { setting.cbbDev.add("未找到硬件"); setting.btnConnect.disabled = 1; } setting.cbbDev.selIndex = 1 } setting.btnConnect.oncommand = function(id,event){ CT_Connect(setting.cbbDev.selIndex,1,true); } CAN_Connected_callback = function(){ setting.cbbDev.disabled = 1 setting.btnFresh.disabled = 1; setting.btnConnect.disabled = 1; MsgProTimer.enable(); } setting.plus5.skin( background = { hover = "/res/images/btn-hover.png"; focus = "/res/images/btn-focus.jpg"; active = "/res/images/btn-active.png"; disabled = "/res/images/btn-disabled.png"; } ) setting.plus5.oncommand = function(id,event){ } default_cx=0,default_cy=0; setting.plus.oncommand = function(id,event){ var Screen_cx,Screen_cy = win.getScreen(); if(setting.plus.checked){ var x=0,y=0; x,y,default_cx,default_cy = mainForm.getPos(); mainForm.setPos(0,0,Screen_cx,default_cy/default_cx*Screen_cx); } else { mainForm.setPos((Screen_cx-default_cx)/2,(Screen_cy-default_cy)/2,default_cx,default_cy); } } aboutcounter = 0; setting.static4.oncommand = function(id,event){ aboutcounter++; if(aboutcounter >= 5){ aboutcounter = 0; var frmChild = mainForm.loadForm("\dlg\about.aardio"); frmChild.doModal(mainForm); } } setting.show(); win.loopMessage(); return setting;