예제 #1
0
        private void LoadUserHistory()
        {
            //只加载最近10个
            var dirs = new DirectoryInfo(LocalUserProfile.UserProfileDirecotry).GetDirectories().OrderByDescending(d => d.LastWriteTime).Take(10);

            foreach (var d in dirs)//每个目录一个用户(的所有设置)
            {
                //找密码
                string pwd = LocalUserProfile.GetProfileContent(d.Name, "password");
                _userHistory[d.Name] = pwd;
                cmbUserName.Items.Add(d.Name);
            }
            if (_userHistory.Any())
            {
                _vm.UserName = _userHistory.Keys.First();
            }
        }
예제 #2
0
        public VMLoginForm()
        {
            //加载登录记录
            //只加载最近10个
            var dirs = new DirectoryInfo(LocalUserProfile.UserProfileDirecotry).GetDirectories().OrderByDescending(d => d.LastWriteTime).Take(10);

            foreach (var d in dirs)//每个目录一个用户(的所有设置)
            {
                //找密码
                string pwd = LocalUserProfile.GetProfileContent(d.Name, "password");
                _userHistory[d.Name] = pwd;
            }
            UserHistory = _userHistory.Keys.ToArray();
            if (UserHistory.Length > 0)
            {
                UserName    = UserHistory[0];
                Password    = _userHistory[UserName];
                RememberPwd = Password != null;
            }
        }