private void InitializeNettwork() { try { //NETTWORK STUFF nettwork = new LayerBlockchainNetwork(_friChain, _loggedUser); nettwork._blockchainPeer.OnRegisterClient += NewClientRegistered; nettwork._blockchainPeer.OnUnRegisterClient += ClientUnregistered; nettwork._blockchainPeer.OnRecieveListOfClients += PeersListObtained; nettwork.WholeChainDownloaded += WholeChainDownloaded; nettwork.NewBlockArrived += NewBlockArrived; nettwork.TransactionPoolChanged += TransactionPoolChanged; nettwork.BlockChainSynchronized += BlockChainSynchronized; nettwork.BlockChainSynchronizing += BlockChainSynchronizing; nettwork.InsufficientFund += InsufficientFundHandler; nettwork.IsMining += MiningIndicator; //kick of blockchain game here, must first register events, than kick that off nettwork._blockchainPeer.Initialize(); //for (int i = 0; i < 5; i++) //{ // nettwork.Send(_loggedUser.Address, "1EkAmczL7REZVgTHfBC8Rk3fMLiVQnR3bi", 2); //} //CHAIN GAMES InitializeListBox(); } catch (Exception ex) { logger.Error(ex.ToString()); } }
private void InitializeLogger() { var logFile = LayerBlockchainNetwork.GetIpAddress().Replace(':', '_') + ".txt"; var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = logFile }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Trace, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Trace, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
public WalletPage(User user) { InitializeComponent(); InitializeLogger(); TryCreateShortcut(); // create shortcut, so i will be able to show toasts //INITIALIZE CHAIN, ETC _loggedUser = user; var bank = new WalletBank(); _loggedUserWallet = bank.FindWallet(user.Address); _friChain = new BlockChain(LayerBlockchainNetwork.GetIpAddress()); //REGISTER CLOSING EVENET Application.Current.MainWindow.Closing += new CancelEventHandler(AppClosing); //SET GUI PROPERTIES InitializeProfile(); UpdateBalance(); UpdateRawChain(); UpdatePeerList(); }