Ejemplo n.º 1
0
        // Handle timer routines
        static public void onUpdate(object source, ElapsedEventArgs e)
        {
            // Update the friendlist
            FriendList.Update();

            // Cleanup the presence list
            // TODO: optimize this by using a different thread perhaps
            PresenceList.performCleanup();


            if (Node.walletStorage.getPrimaryAddress() == null)
            {
                return;
            }

            if (Config.enablePushNotifications)
            {
                OfflinePushMessages.fetchPushMessages();
            }

            // Request initial wallet balance
            if (balance.blockHeight == 0 || balance.lastUpdate + 300 < Clock.getTimestamp())
            {
                using (MemoryStream mw = new MemoryStream())
                {
                    using (BinaryWriter writer = new BinaryWriter(mw))
                    {
                        writer.Write(Node.walletStorage.getPrimaryAddress().Length);
                        writer.Write(Node.walletStorage.getPrimaryAddress());
                        NetworkClientManager.broadcastData(new char[] { 'M' }, ProtocolMessageCode.getBalance, mw.ToArray(), null);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 static void handleNotificationReceived(OSNotification notification)
 {
     if (OfflinePushMessages.fetchPushMessages(true))
     {
         OneSignal.Current.ClearAndroidOneSignalNotifications();
     }
 }
Ejemplo n.º 3
0
        // Handle timer routines
        static public void mainLoop()
        {
            byte[] primaryAddress = IxianHandler.getWalletStorage().getPrimaryAddress();
            if (primaryAddress == null)
            {
                return;
            }

            byte[] getBalanceBytes;
            using (MemoryStream mw = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(mw))
                {
                    writer.WriteIxiVarInt(primaryAddress.Length);
                    writer.Write(primaryAddress);
                }
                getBalanceBytes = mw.ToArray();
            }

            while (running)
            {
                try
                {
                    // Update the friendlist
                    FriendList.Update();

                    // Request initial wallet balance
                    if (balance.blockHeight == 0 || balance.lastUpdate + 300 < Clock.getTimestamp())
                    {
                        CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.getBalance2, getBalanceBytes, null);
                    }

                    if (Config.enablePushNotifications)
                    {
                        OfflinePushMessages.fetchPushMessages();
                    }

                    // Cleanup the presence list
                    // TODO: optimize this by using a different thread perhaps
                    PresenceList.performCleanup();
                }
                catch (Exception e)
                {
                    Logging.error("Exception occured in mainLoop: " + e);
                }
                Thread.Sleep(2500);
            }
        }