Ejemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ThinNeo.NEP6.NEP6Account acc = this.nep6_listOut.SelectedItem as ThinNeo.NEP6.NEP6Account;
            if (acc == null)
            {
                return;
            }
            if (acc.nep2key == null)
            {
                return;
            }
            var pass = Dialog_Input_password.ShowDialog(null);

            if (pass != null)
            {
                try
                {
                    var prikey = acc.GetPrivate(nep6wallet.scrypt, pass);
                    labelPri.Content = ThinNeo.Helper.GetWifFromPrivateKey(prikey);
                }
                catch
                {
                    labelPri.Content = "密码错误或者其他错误";
                }
            }
        }
Ejemplo n.º 2
0
        public void ShowAddressInfo(ThinNeo.NEP6.NEP6Wallet nep6wallet, string password)
        {
            var wifs     = new List <string>();
            var demoItem = this.listboxDemo.Items[0] as ListBoxItem;

            for (var i = 0; i < nep6wallet.accounts.Count; i++)
            {
                var v = nep6wallet.accounts.ToList()[i];
                ThinNeo.NEP6.NEP6Account acc = v.Value as ThinNeo.NEP6.NEP6Account;
                if (acc == null)
                {
                    return;
                }
                if (acc.nep2key == null)
                {
                    return;
                }

                string      xaml          = System.Windows.Markup.XamlWriter.Save(demoItem);
                ListBoxItem item          = System.Windows.Markup.XamlReader.Parse(xaml) as ListBoxItem;
                var         label_address = item.FindName("address") as Label;
                var         label_index   = item.FindName("index") as Label;
                var         img_state     = item.FindName("img_state") as Image;
                var         label_state   = item.FindName("label_state") as Label;

                try
                {
                    var prikey = acc.GetPrivate(nep6wallet.scrypt, password);
                    var wif    = NeoDun.SignTool.GetWifFromPrivateKey(prikey);
                    wifs.Add(wif);
                    label_address.Content  = ThinNeo.Helper.GetAddressFromScriptHash(acc.ScriptHash);
                    label_index.Content    = (i + 1).ToString("00");
                    label_state.Content    = "等待中";
                    label_state.Foreground = new SolidColorBrush(Color.FromRgb(191, 191, 191));
                    img_state.Visibility   = Visibility.Hidden;
                    this.listbox.Items.Add(item);
                }
                catch
                {
                    label_address.Content  = "密码和地址不匹配,数据错误";
                    label_index.Content    = (i + 1).ToString("00");
                    label_state.Visibility = Visibility.Hidden;
                    img_state.Visibility   = Visibility.Hidden;
                    this.listbox.Items.Add(item);
                }
            }
            AddAddress(wifs);
        }
Ejemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ThinNeo.NEP6.NEP6Account acc = this.listAccount.SelectedItem as ThinNeo.NEP6.NEP6Account;
            if (acc == null)
            {
                return;
            }
            if (acc.nep2key == null)
            {
                return;
            }

            try
            {
                this.prikey       = acc.GetPrivate(nep6wallet.scrypt, pbox.Password);
                this.DialogResult = true;
            }
            catch
            {
                MessageBox.Show("密码错误或者其他错误");
            }
        }