Пример #1
0
        private void editAccount_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (gridControl1.DefaultView.RowCount < 2)
            {
                return;
            }
            var account    = (Account)accountBindingSource.Current;
            var accountKey = Keys.FirstOrDefault(p =>
                                                 p.PublicKey.X.SequenceEqual((byte[])account.AccountInfo.AccountKey.PublicKey.X) &&
                                                 p.PublicKey.Y.SequenceEqual((byte[])account.AccountInfo.AccountKey.PublicKey.Y)
                                                 );

            account.AccountInfo.AccountKey = accountKey;
            if (AccountEdit.EditAccount(account))
            {
                Node.Instance.ChangeAccountInfo(account, 0, "", accountKey);
            }
        }
Пример #2
0
        public static bool EditAccount(Account account)
        {
            AccountEdit accountEdit = new AccountEdit();

            accountEdit.accountName.DataBindings.Add("EditValue", account, "Name", false, DataSourceUpdateMode.Never);
            accountEdit.keys.DataBindings.Add("EditValue", account.AccountInfo, "AccountKey", false, DataSourceUpdateMode.Never);
            accountEdit.keys.Properties.Items.AddRange(Node.Keys.ToArray());
            if (accountEdit.ShowDialog() == DialogResult.OK)
            {
                account.Name = accountEdit.accountName.Text;
                if (!account.AccountInfo.AccountKey.Equals((ECKeyPair)accountEdit.keys.SelectedItem))
                {
                    account.AccountInfo.NewPublicKey = (ECKeyPair)accountEdit.keys.SelectedItem;
                }
                return(true);
            }
            return(false);
        }