Example #1
0
        public FormWallet(Network network, KnoledgeWallet wallet)
        {
            InitializeComponent();

            _network = network;
            _wallet  = wallet;
        }
Example #2
0
        public static KnoledgeWallet[] LoadWallets(Network network)
        {
            List <KnoledgeWallet> wallets = new List <KnoledgeWallet>();

            foreach (var child in new DirectoryInfo(Common.AppDir).GetDirectories())
            {
                KnoledgeWallet kw = new KnoledgeWallet(network);
                kw.Name = child.Name;

                try
                {
                    kw.PrivateKeys =
                        File.ReadAllText(kw.PrivateKeyFile)
                        .Split(',')
                        .Select(c => new BitcoinExtKey(c, network))
                        .ToArray();

                    using (var fs = File.Open(kw.WalletFile, FileMode.Open))
                    {
                        kw._wallet = Wallet.Load(fs);
                    }
                    wallets.Add(kw);
                }
                catch (IOException)
                {
                }
            }
            return(wallets.ToArray());
        }
Example #3
0
        private void LoadWallets()
        {
            var wallets = Common.LoadWallets(Network);

            foreach (var wallet in wallets)
            {
                wallet.Update();
                _wallets.Add(wallet);
            }

            _wallet = _wallets.FirstOrDefault();
            UpdateWalletComboBox();
        }
Example #4
0
        private void comboBoxWallet_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxWallet.SelectedItem != null)
            {
                _wallet = (KnoledgeWallet)comboBoxWallet.SelectedItem;
                _wallet.Update();

                UpdateAddressComboBox();

                comboBoxAddress.Text         = "";
                comboBoxAddress.SelectedItem = _wallet.CurrentAddress;

                UpdateListView(_wallet.Transactions);
            }
        }
Example #5
0
        internal void CreateWallet(KnoledgeWallet knoledgeWallet)
        {
            WalletCreation creation = knoledgeWallet.CreateWalletCreation();
            Wallet         wallet   = new Wallet(creation);

            knoledgeWallet.Set(wallet);

            _wallets.Add(knoledgeWallet);

            if (_wallet == null)
            {
                _wallet = knoledgeWallet;
            }

            knoledgeWallet.Save();

            if (_connectionParameters != null)
            {
                wallet.Connect(_connectionParameters);
            }
        }
Example #6
0
        private void addWalletToolStripMenuItem_Click(object sender, EventArgs e)
        {
            KnoledgeWallet wallet = new KnoledgeWallet(Network);

            wallet.Name = "Wallet" + _wallets.Count;

            using (FormWallet form = new FormWallet(Network, wallet))
            {
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (wallet.IsValid)
                    {
                        using (new HourGlass())
                        {
                            UpdateStatusLabel("Creating a new wallet, please wait...");
                            CreateWallet(wallet);
                            UpdateWalletComboBox();
                        }
                    }
                }
            }
        }
Example #7
0
 public WalletKey(Network network, KnoledgeWallet parent)
 {
     _network = network;
     _parent  = parent;
 }