Esempio n. 1
0
        private void OnWindowAppeared(object sender, GwmWindowEventArgs eventArgs)
        {
            if (eventArgs.Form is not PwEntryForm pwEntryForm)
            {
                return;
            }

            var formUtil = new EntryFormUtil(pwEntryForm);

            var menuItem = new CreateAddressMenuItem();

            menuItem.OnClick(async() =>
            {
                string?description = formUtil.GetTitle();

                var service = new AnonAddyService(this.accessTokenFactory);

                AnonAddyEntry anonAddyEntry = await service.RequestAddress(description);

                formUtil.PopulateUserNameFieldWith(anonAddyEntry);
                formUtil.AddIdFrom(anonAddyEntry);
            });

            if (this.accessTokenFactory != null)
            {
                formUtil.Add(menuItem);
            }
        }
Esempio n. 2
0
        internal void AddIdFrom(AnonAddyEntry anonAddyEntry)
        {
            if (anonAddyEntry.Id != null)
            {
                var protectedId = new ProtectedString(false, anonAddyEntry.Id.ToString());
                this.form.EntryStrings.Set("x-aa-id", protectedId);
            }

            this.form.EntryRef.Touch(true, false);
        }
Esempio n. 3
0
        internal void PopulateUserNameFieldWith(AnonAddyEntry anonAddyEntry)
        {
            Control?userNameControl = GetControlByKey("m_tbUserName");

            if (userNameControl != null)
            {
                userNameControl.Text = anonAddyEntry.MailAddress.Address;
            }

            this.form.EntryRef.Touch(true, false);
        }