public void onUpdate(AccountView view) { _current = view; end(); new Thread(() => { Dispatcher.Invoke(() => { foreach (var x in _Accounts) { var card = new AccountCard(); if (x.Value == _current) { card.HoverStroke.Stroke = Brushes.Red; } card.Margin = new Thickness(3); card.init(x.Key, MainWindow.ByteArrToString(x.Value.publicKey), _chain.count_funds(x.Value.publicKey), x.Value, _currency, _current == x.Value, onUpdate); AccountList.Children.Add(card); } Button b = new Button(); b.FontSize = 30; b.Click += B_Click; b.Margin = new Thickness(20); b.Content = "Add account"; AccountList.Children.Add(b); }); }).Start(); up2(_current, _curName); up(); }
public void init(Dictionary <string, AccountView> Accounts, ref AccountView current, string currName, Blockchain chain, string currency, UpdateMainBalance u, UpdateCurrent u2) { _chain = chain; if (active) { return; } up = u; up2 = u2; _Accounts = Accounts; _currency = currency; _chain = chain; active = true; _curName = currName; _current = current; new Thread(() => { Dispatcher.Invoke(() => { foreach (var x in Accounts) { var card = new AccountCard(); if (x.Value == _current) { card.HoverStroke.Stroke = Brushes.Red; } card.Margin = new Thickness(3); card.init(x.Key, MainWindow.ByteArrToString(x.Value.publicKey), chain.count_funds(x.Value.publicKey), x.Value, currency, _current == x.Value, onUpdate); AccountList.Children.Add(card); } Button b = new Button(); b.FontSize = 30; b.Click += B_Click; b.Margin = new Thickness(20); b.Content = "Add account"; AccountList.Children.Add(b); }); }).Start(); }