public valmoWin()
        {
            try
            {
                DirectoryInfo dirUpgrade = new DirectoryInfo("upgrade");
                DirectoryInfo dirBackup = new DirectoryInfo("backup");
                DirectoryInfo dirIpr = new DirectoryInfo("ipr");
                DirectoryInfo dirJpeg = new DirectoryInfo("jpeg");
                DirectoryInfo dirRec = new DirectoryInfo("rec");
                DirectoryInfo dirLns = new DirectoryInfo("lines");

                if (!dirUpgrade.Exists)
                {
                    dirUpgrade.Create();
                }
                if (!dirBackup.Exists)
                {
                    dirBackup.Create();
                }
                if (!dirJpeg.Exists)
                {
                    dirJpeg.Create();
                }
                if (!dirIpr.Exists)
                {
                    dirIpr.Create();
                }
                if (!dirRec.Exists)
                {
                    dirRec.Create();
                }
                if (!dirLns.Exists)
                {
                    dirLns.Create();
                }

                dv.feedbackHandle = callbackObjLstFunc;
                callbackObjLstHandle = new callBackObjEvent(callbackObjLstFunc);
                execHandle = new execEvent(execInvoke);
                execMsg = new execMsgEvent(execMsgFunc);
                setPageToNrHandle = setPangetoNr;
                setCurPageDisHandle = setCurPageDis;
                SCurUser = dv.users.curUser;

                InitializeComponent();

                ctrlsObjInit();

                setUnitResources(objUnit.unitBase[UnitType.Len_mm]);
                setUnitResources(objUnit.unitBase[UnitType.Temp_C]);
                setUnitResources(objUnit.unitBase[UnitType.Prs_Mpa]);
                setUnitResources(objUnit.unitBase[UnitType.Force_ton]);

                valmoWin.dv.SysPr[5].addHandle(handle_sys005, plcLstSpd.lowSpdType);

                vm.getTm("-------- 1 ------------");
                if (dv.getLink())
                {
                    vm.getTm("-------- 2 ------------");
                    //开机时,检测报警灯是否是开着的状态。如果开着,需要将其关闭
                    if (valmoWin.dv.SysPr[187].valueNew == 1)
                        valmoWin.dv.SysPr[187].valueNew = 0;

                    //unitInit();
                    setUnitResources(objUnit.lenUnitBasic);
                    setUnitResources(objUnit.tempUnitBasic);
                    setUnitResources(objUnit.prsUnitBasic);
                    setUnitResources(objUnit.forceUnitBasic);

                    foreach (nullEvent func in lstStartUpInit)
                    {
                        func();
                    }
                    setPangetoNr(0);
                }
                else
                {
                    execFunc(opeOrderType.winMsg, new WinMsg(WinMsgType.mwLinkPlcError));
                }
                vm.getTm("-------- 3 ------------");
                checkUsbFunc();
                lanCheck();
                checkAccredit();
            }
            catch (Exception ex)
            {
                vm.perror(ex.ToString());
            }

            dv.SysPr[14].add();

            BackstageTimer = new DispatcherTimer();
            BackstageTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            BackstageTimer.Tick += new EventHandler(ClockTick);
            BackstageTimer.Start();

            lastEventTime = DateTime.Now;
            valmoWin.BackstageClockTick += ScreenSaverTimer;
        }
        //2、添加新用户
        //2、add new user
        //先检查用户名是否已经存在
        //如果不存在就保存到结构中,并写到文件中;
        public int addUser(string name, string password, DateTime dt, byte level,string lan)
        {
            try
            {
                if (name == null || name == "")
                    return -2;//用户名错误
                userClass userNew = getUserByName(name);
                if (userNew != null)  //该用户已经存在
                    return -1;

                int userid = 76;
                switch (level)
                {
                    case 1:
                        {
                            userid = Properties.Settings.Default.opID;
                            userNew = new userClass(name, password, userid, dt, level);
                            Properties.Settings.Default.opID = userid + 1;
                            lstOp.Add(userNew);
                            saveToFile(1);
                            break;
                        }
                    case 2:
                        {
                            userid = Properties.Settings.Default.mtID;
                            userNew = new userClass(name, password, userid, dt, level);
                            userid = Properties.Settings.Default.mtID = userid + 1;
                            lstMt.Add(userNew);
                            saveToFile(2);
                            break;
                        }
                    case 3:
                        break;
                }
                vm.printLn("add new user ok!");
                return 1;

                //vm.printLn("name : {0} password : {1} userid : {2} createtime : {3} accessleve : {4} ", name, password, userid, dt, level);
            }
            catch (Exception ex)
            {
                vm.printLn(ex.ToString());
            }
            return 0;
        }
        /************************************************
         *    方法
         * 0、构造函数
         * 1、匹配用户名、密码
         * 2、添加新用户
         * 3、删除一个用户
         * 4、修改用户信息
         ************************************************/
        //0、构造函数
        //0、construct function
        public userBase()
        {
            try
            {
                string processorID = hardware.getProcessorId();
                if (processorID == Properties.Settings.Default.processorId)
                {
                    string str = Properties.Settings.Default.root;

                    string[] strTmp = str.Split('\t');
                    //if (strTmp[0] == "root")
                    //{
                    userRoot = new userClass(strTmp[0], strTmp[1], Int32.Parse(strTmp[2]), new DateTime(2012, 3, 25, 0, 0, 0), 5);
                    //}

                    str = Properties.Settings.Default.ser;
                    strTmp = str.Split('\t');
                    //if (strTmp[0] == "ser")
                    //{
                    userSer = new userClass(strTmp[0], strTmp[1], Int32.Parse(strTmp[2]), new DateTime(2012, 3, 25, 0, 0, 0), 4);
                    //}
                    str = Properties.Settings.Default.mgr;
                    strTmp = str.Split('\t');
                    //if (strTmp[0] == "mgr")
                    //{
                    userMgr = new userClass(strTmp[0], strTmp[1], Int32.Parse(strTmp[2]), new DateTime(2012, 3, 25, 0, 0, 0), 3);
                    //}
                    str = Properties.Settings.Default.mt;
                    strTmp = str.Split('\t');
                    //if (strTmp[0] == "mt")
                    //{
                    userMt = new userClass(strTmp[0], strTmp[1], Int32.Parse(strTmp[2]), new DateTime(2012, 3, 25, 0, 0, 0), 2);
                    //}
                    str = Properties.Settings.Default.op;
                    strTmp = str.Split('\t');
                    //if (strTmp[0] == "op")
                    //{
                    userOp = new userClass(strTmp[0], strTmp[1], Int32.Parse(strTmp[2]), new DateTime(2012, 3, 25, 0, 0, 0), 1);
                    //}

                    str = Properties.Settings.Default.lstMt;
                    strTmp = str.Split('#');

                    int num = Int32.Parse(strTmp[0]);
                    if (strTmp.Length == num + 2)
                    {
                        for (int i = 1; i < num + 1; i++)
                        {
                            string[] strVar = strTmp[i].Split('\t');
                            lstMt.Add(new userClass(strVar[0], strVar[1], Int32.Parse(strVar[2]), DateTime.Parse(strVar[3]), Byte.Parse(strVar[4])));
                        }
                    }

                    str = Properties.Settings.Default.lstOp;
                    strTmp = str.Split('#');
                    num = Int32.Parse(strTmp[0]);
                    if (strTmp.Length == num + 2)
                    {
                        for (int i = 1; i < num + 1; i++)
                        {
                            string[] strVar = strTmp[i].Split('\t');
                            lstOp.Add(new userClass(strVar[0], strVar[1], Int32.Parse(strVar[2]), DateTime.Parse(strVar[3]), Byte.Parse(strVar[4])));
                        }
                    }

                }
                else
                {
                    userRoot = new userClass("root", "Yehill", 5, new DateTime(2012, 3, 25, 0, 0, 0), 5);
                    userSer = new userClass("ser", "Action", 4, new DateTime(2012, 3, 25, 0, 0, 0), 4);
                    userMgr = new userClass("mgr", "2013", 3, new DateTime(2012, 3, 25, 0, 0, 0), 3);
                    userMt = new userClass("mt", "222", 2, new DateTime(2012, 3, 25, 0, 0, 0), 2);
                    userOp = new userClass("op", "111", 1, new DateTime(2012, 3, 25, 0, 0, 0), 1);

                    Properties.Settings.Default.root = userRoot.toString();
                    Properties.Settings.Default.ser = userSer.toString();
                    Properties.Settings.Default.mgr = userMgr.toString();
                    Properties.Settings.Default.mt = userMt.toString();
                    Properties.Settings.Default.op = userOp.toString();
                    Properties.Settings.Default.lstMt = "0#";
                    Properties.Settings.Default.lstOp = "0#";
                    Properties.Settings.Default.processorId = processorID;
                    Properties.Settings.Default.Save();
                }
            }
            catch
            {

            }
            userLiuzs = new userClass("liuzs","643",6,new DateTime(2012, 3, 25, 0, 0, 0), 3);
             userNull = new userClass("guest", "null", 0, new DateTime(2012, 3, 25, 0, 0, 0), 0);
        }
 /// <summary>
 /// 复制用户
 /// </summary>
 /// <param name="user_scr">源用户</param>
 public void user_copy(userClass user_scr)
 {
     if (this == user_scr)
         return;
     name = user_scr.name;
     user_password = user_scr.user_password;
     user_userId = user_scr.user_userId;
     user_createTime = user_scr.user_createTime;
     user_accessLevel = user_scr.user_accessLevel;
     user_language = user_scr.user_language;
 }