How DIAView VBS configured to control login and logout by equipment

Animation effect

 

 Implementation steps

Step 1: Create the framework page

a) The title bar Size: 1024 * 100, coordinates: 0,0

b) Menu Bar size: 100 * 668, the coordinates: 0,100

c) main window, operators and administrators of uniform size: 924 * 668, the coordinates: 100, 100

Step two: Add the variable address "electronic lock device" ==> tag for the device turned on allows the administrator or super administrator to log mark; "is logged on" user mark whether the user is logged in;

The third step: the title bar of the window corresponding event

a) animation

b) button "simulated machine Exit" ==> Events "button press"

Var.设备电子锁= Not Var.设备电子锁

c) the button "Login" ==> Events "button press"

UserCmd.LoginBox()
usertype=UserCmd.GetUserType(UserCmd.UserName)
'判断当前用户是否为管理员或超级管理员
If usertype="Admin"  Or usertype="SystemAdmin" then
    If Var.设备电子锁=False then
        MsgBox "请打开设备电子锁!"
        UserCmd.Logout()
        Var.是否登录=False
        Call HMICmd.OpenWindowAndCloseOther("标题栏,菜单栏,主窗口")
        Exit Sub
    End If
End If
'判断用户是否登录,如果不为None表示已登录
If UserCmd.UserName<>"None" then
    Var.是否登录=True
End If

d) the button "Logout" ==> Events "button press"

UserCmd.Logout()
Var.是否登录=False
Call HMICmd.OpenWindowAndCloseOther("标题栏,菜单栏,主窗口")

e) window ==> Events ==> Screen program ==> run-time events

usertype=UserCmd.GetUserType(UserCmd.UserName)
If Var.是否登录=True  And Var.设备电子锁=False  And ( usertype="Admin"  Or usertype="SystemAdmin" )  then
    Var.是否登录=False
    UserCmd.Logout()
    Call HMICmd.OpenWindowAndCloseOther("标题栏,菜单栏,主窗口")
End If

Step four: the menu bar of the window "button" and events

a) button "operator" ==> Events "button press"

Call HMICmd.OpenWindowAndCloseOther("标题栏,菜单栏,操作员")

b) the button "administrator" ==> Events "button press"

Call HMICmd.OpenWindowAndCloseOther("标题栏,菜单栏,管理员")

Step five: the main window of the "text" Animation

Guess you like

Origin blog.csdn.net/qq_40191093/article/details/92568693