public AssetsMetadata(WalletManager wallet)
        {
            try
            {
                string directory = Utils.PathCombine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Utils.Config("assetsDir"));
                _CacheJsonStore.FileName = Utils.PathCombine(directory, "metadata.json");
                _CacheJsonStore.Value.ToList().ForEach(t => _Cache.TryAdd(t.Key, new AssetMetadata()
                {
                    Asset = Convert.FromBase64String(t.Key), Display = t.Value.name
                }));
                _Cache.TryAdd(Convert.ToBase64String(Consensus.Tests.zhash), new AssetMetadata()
                {
                    Asset = Consensus.Tests.zhash, Display = ZEN
                });

                wallet.OnItems += OnItems;
            } catch (Exception e)
            {
                InfrastructureTrace.Error("AssetsMetadata ctor", e);
            }
        }
Beispiel #2
0
        public void Start(WalletManager walletManager, Network.NodeManager nodeManager)
        {
            Wallet = walletManager;
            Node   = nodeManager;

            AssetsMetadata = new AssetsMetadata(Wallet);

            resources.OwnResource(MessageProducer <BlockChainMessage> .Instance.AddMessageListener(new MessageListener <BlockChainMessage>(message => {
                if (message is BlockMessage)
                {
                    StatusMessage(new BlockChainAcceptedMessage {
                        Value = ((BlockMessage)message).BlockNumber
                    });
                }
            })));

            resources.OwnResource(Singleton <MessageProducer <IStatusMessage> > .Instance.AddMessageListener(new MessageListener <IStatusMessage>(StatusMessage)));

            Gtk.Application.Init();

            MainWindow        = new MainWindow();
            DialogBase.parent = MainWindow;
            MainWindow.Show();

            if (StatusMessageProducer._Queue != null)
            {
                lock (StatusMessageProducer._Queue)
                {
                    IStatusMessage message;
                    while (StatusMessageProducer._Queue.TryDequeue(out message))
                    {
                        StatusMessage(message);
                    }
                }
            }

            Gtk.Application.Run();
        }