コード例 #1
0
ファイル: LoginDialog.cs プロジェクト: hoangduit/openpetra
        /// <summary>
        /// This function gets the windows user name and the previously used login name for Petra
        ///
        /// </summary>
        /// <returns>void</returns>
        private void GetUsers()
        {
            // in some countries, don't give a clue about the username
            if (TAppSettingsManager.ToBoolean(TAppSettingsManager.GetValue("UseWindowsUserID"), false))
            {
                // Get the windows user name
                String UserNameStr = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToUpper();

                // get rid of the domain and the back slash
                UserNameStr = UserNameStr.Substring(UserNameStr.IndexOf("\\") + 1);

                ReadRememberedUserName(ref UserNameStr);

                txtUserName.Text = UserNameStr;
            }
            else
            {
                chkRememberUserName.Visible = false;
            }
        }