示例#1
0
        /// <summary>
        /// Full disconnection of the wallet.
        /// </summary>
        public void FullDisconnection(bool manualDisconnection = true)
        {
            if (ThreadListenBlockchainNetwork != null && (ThreadListenBlockchainNetwork.IsAlive || ThreadListenBlockchainNetwork != null))
            {
                ThreadListenBlockchainNetwork.Abort();
                GC.SuppressFinalize(ThreadListenBlockchainNetwork);
            }

            SeedNodeConnector?.DisconnectToSeed();
            SeedNodeConnector?.Dispose();

            WalletInPendingCreate = false;
            WalletAddress         = string.Empty;
            WalletPassword        = string.Empty;
            WalletPrivateKey      = string.Empty;
        }
示例#2
0
        /// <summary>
        /// Connect to the network of blockchain.
        /// </summary>
        /// <returns></returns>
        public static async Task <bool> ConnectToBlockchainAsync()
        {
            classSeedNodeConnector?.DisconnectToSeed();
            classSeedNodeConnector = null;
            classSeedNodeConnector = new ClassSeedNodeConnector();


            ListOfMiningMethodName?.Clear();
            ListOfMiningMethodContent?.Clear();
            if (!await classSeedNodeConnector.StartConnectToSeedAsync(string.Empty))
            {
                IsConnected = false;
                return(false);
            }
            if (!FirstStart)
            {
                FirstStart = true;
                CheckBlockchainConnection();
            }
            IsConnected = true;
            return(true);
        }