コード例 #1
0
ファイル: BlockchainJob.cs プロジェクト: ft-john/FiiiCoin
        public static void Initialize()
        {
            var notify = new NotifyComponent();
            BlockchainComponent blockChainComponent = new BlockchainComponent();
            AccountComponent    accountComponent    = new AccountComponent();
            UtxoComponent       utxoComponent       = new UtxoComponent();

            //从配置文件中读取
            ConfigurationTool tool   = new ConfigurationTool();
            NodeConfig        config = tool.GetAppSettings <NodeConfig>("NodeConfig");

            notify.SetCallbackApp(config.WalletNotify);

            if (GlobalActions.TransactionNotifyAction == null)
            {
                GlobalActions.TransactionNotifyAction = NewTransactionNotify;
            }

            blockChainComponent.Initialize();
            var accounts = accountComponent.GetAllAccounts();

            if (accounts.Count == 0)
            {
                var account = accountComponent.GenerateNewAccount();
                accountComponent.SetDefaultAccount(account.Id);
            }

            BlockchainJob.Current = new BlockchainJob();
            utxoComponent.Initialize();
        }
コード例 #2
0
        public void Apply(IEntity entity)
        {
            var uiComponent = new UIComponent {
                UIName = uiName, IsDynamic = true, UIType = UIType.UI_NOTIFY
            };
            var notifyComponent = new NotifyComponent
            {
                Message       = message, CustomHideDelay = customHideDelay, Container = container, ShowAnimation = showAnimation,
                HideAnimation = hideAnimation, SlideUpOnHide = slideUpOnHide, SequenceType = sequenceType, SequenceDelay = sequenceDelay,
                ClearSequence = clearSequence, NewUnscaledTime = newUnscaledTime
            };

            entity.AddComponents(uiComponent, notifyComponent);
            entity.AddComponent <ViewComponent>();
        }
コード例 #3
0
ファイル: BlockchainJob.cs プロジェクト: omcdev/blockchain
        public static void Initialize()
        {
            var notify = new NotifyComponent();
            BlockchainComponent blockChainComponent = new BlockchainComponent();
            AccountComponent    accountComponent    = new AccountComponent();

            BlockchainJob.Current = new BlockchainJob();

            BlockDac.Default.GetAccountByLockScript = BlockchainJob.Current.GetAccountByLockScript;

            //从配置文件中读取
            ConfigurationTool tool = new ConfigurationTool();

            config = tool.GetAppSettings <NodeConfig>("NodeConfig");
            if (config == null)
            {
                GlobalParameters.IsPool = false;
                config = new NodeConfig();
            }
            else
            {
                notify.SetCallbackApp(config.WalletNotify);
                BlockchainJob.Current.P2PJob.LocalIP = config.LocalIP;
                GlobalParameters.IsPool = config.IsPool;
            }

            ConfigCenter.ConfigNode = config;



            //TODO 待验证删除
            //if (config != null)
            //{
            //    notify.SetCallbackApp(config.WalletNotify);
            //    BlockchainJob.Current.P2PJob.IPAddress = config.Ip;
            //    GlobalParameters.IsPool = config.IsPool;
            //}
            //else
            //{
            //    GlobalParameters.IsPool = false;
            //}

            if (GlobalActions.TransactionNotifyAction == null)
            {
                GlobalActions.TransactionNotifyAction = NewTransactionNotify;
            }

            blockChainComponent.Initialize();
            var accounts = AccountDac.Default.GetAccountBook();

            if (accounts.Count == 0)
            {
                var account = accountComponent.GenerateNewAccount(false);
                accountComponent.SetDefaultAccount(account.Id);
            }

            var defaultAccount = AppDac.Default.GetDefaultAccount();

            if (string.IsNullOrEmpty(defaultAccount))
            {
                var first = AccountDac.Default.GetAccountBook().FirstOrDefault();
                UserSettingComponent component = new UserSettingComponent();
                component.SetDefaultAccount(first);
            }

            TransactionPool.Instance.Load();
        }
コード例 #4
0
ファイル: BlockchainJob.cs プロジェクト: omcdev/blockchain
        public static void NewTransactionNotify(string txHash)
        {
            NotifyComponent notify = new NotifyComponent();

            notify.ProcessNewTxReceived(txHash);
        }