Exemplo n.º 1
0
        /// <summary>
        /// newkeyBtn_Click event
        /// </summary>
        private void newkeyBtn_Click(object sender, EventArgs e)
        {
            Cursor crs = this.Cursor;

            try
            {
                MMCService.NewUserKey(_upn);
                _secretkey              = MMCService.GetEncodedUserKey(_upn);
                this.DisplayKey.Text    = _secretkey;
                this.qrCodeGraphic.Text = MMCService.GetQRCodeValue(_upn, this.DisplayKey.Text);
                if (!SyncDisabled)
                {
                    userPropertyPage.SyncSharedUserData(this, true);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = crs;
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                {
                    Text    = ex.Message,
                    Buttons = MessageBoxButtons.OK,
                    Icon    = MessageBoxIcon.Error
                };
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            finally
            {
                this.Cursor = crs;
            }
        }
 /// <summary>
 /// newkeyBtn_Click event
 /// </summary>
 private void newkeyBtn_Click(object sender, EventArgs e)
 {
     MMCService.NewUserKey(_upn);
     _secretkey              = MMCService.GetEncodedUserKey(_upn);
     this.DisplayKey.Text    = _secretkey;
     this.qrCodeGraphic.Text = MMCService.GetQRCodeValue(_upn, this.DisplayKey.Text);
     if (!SyncDisabled)
     {
         userPropertyPage.SyncSharedUserData(this, true);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// SetUserControlData method implmentation
        /// </summary>
        public void SetUserControlData(MFAUserList lst, bool disablesync)
        {
            SyncDisabled = disablesync;
            try
            {
                MFAUser obj = lst[0];
                _upn       = obj.UPN;
                _email     = obj.MailAddress;
                _secretkey = MMCService.GetEncodedUserKey(obj.UPN);

                if (string.IsNullOrEmpty(_email))
                {
                    this.EmailPrompt.Text = "Email : ";
                    _emailnotset          = true;
                }
                else
                {
                    this.EmailPrompt.Text = string.Format("Email : {0}", _email);
                    _emailnotset          = false;
                }
                if (!string.IsNullOrEmpty(_secretkey))
                {
                    this.DisplayKey.Text = _secretkey;
                    if (!string.IsNullOrEmpty(_upn))
                    {
                        this.qrCodeGraphic.Text = MMCService.GetQRCodeValue(_upn, this.DisplayKey.Text);
                    }
                    else
                    {
                        this.qrCodeGraphic.Text = string.Empty;
                    }
                }
                else
                {
                    userPropertyPage.Dirty = true;
                }
                UpdateControlsEnabled();
            }
            catch (Exception)
            {
                this.DisplayKey.Text    = string.Empty;
                this.qrCodeGraphic.Text = string.Empty;
            }
            finally
            {
                SyncDisabled = false;
            }
        }
        /// <summary>
        /// SetUserControlData method implmentation
        /// </summary>
        public void SetUserControlData(RegistrationList lst, bool disablesync)
        {
            SyncDisabled = disablesync;
            try
            {
                Registration obj = ((RegistrationList)lst)[0];
                _secretkey = MMCService.GetEncodedUserKey(((Registration)obj).UPN);
                // _secretkey = KeysManager.EncodedKey(((Registration)obj).UPN);
                _upn   = ((Registration)obj).UPN;
                _email = ((Registration)obj).MailAddress;

                if (string.IsNullOrEmpty(_email))
                {
                    this.EmailPrompt.Text = "Adresse email : ";
                    _emailnotset          = true;
                }
                else
                {
                    this.EmailPrompt.Text = string.Format("Adresse email : {0}", _email);
                    _emailnotset          = false;
                }
                if (!string.IsNullOrEmpty(_secretkey))
                {
                    this.DisplayKey.Text = _secretkey;
                    if (!string.IsNullOrEmpty(_upn))
                    {
                        this.qrCodeGraphic.Text = MMCService.GetQRCodeValue(_upn, this.DisplayKey.Text);
                    }
                    else
                    {
                        this.qrCodeGraphic.Text = string.Empty;
                    }
                }
                else
                {
                    userPropertyPage.Dirty = true;
                }
                UpdateControlsEnabled();
            }
            finally
            {
                SyncDisabled = false;
            }
        }