Example #1
0
        async Task DumpAllCoinsAndStats()
        {
            List <Coin> allCoinList = exchangeMonitor.allCoins.ToList();

            List <string[]> results = new List <string[]>();
            AboutCoin       headers = new AboutCoin();

            headers.PopulateWithColumnNames();
            results.Add(headers.ToArray());

            for (int i = 0; i < allCoinList.Count; i++)
            {
                AboutCoin about = DescribeCoin(allCoinList[i].fullName);
                if (about != null)
                {
                    results.Add(about.ToArray());
                }
            }

            for (int i = 0; i < 100; i++)
            { // Clear some old coins
                results.Add(new AboutCoin().ToArray());
            }

            await sheet.Write(dataDumpTab, "A1", results);
        }
Example #2
0
        void RefreshTimer_Elapsed(
            object sender,
            ElapsedEventArgs e)
        {
            IList <IList <object> > data        = sheet.Read(tab, "A2:A");
            List <Coin>             allCoinList = exchangeMonitor.allCoins.ToList();

            List <string[]> results = new List <string[]>();

            for (int i = 0; i < data.Count; i++)
            {
                results.Add(DescribeCoin(data[i][0], out Coin coin).ToArray());
                if (coin != null)
                {
                    allCoinList.Remove(coin);
                }
            }
            for (int i = 0; i < allCoinList.Count; i++)
            { // All all remaining coins
                results.Add(DescribeCoin(allCoinList[i].fullName, out Coin coin).ToArray());
            }

            sheet.Write(tab, "A2", results);

            IList <IList <object> > alarmData = sheet.Read(tab, "E2:E");

            for (int i = 0; i < alarmData.Count; i++)
            {
                if (alarmData[i].Count <= 0)
                {
                    continue;
                }
                if (alarmData[i][0].ToString().Equals("TRUE",
                                                      StringComparison.InvariantCultureIgnoreCase))
                {
                    SoundPlayer player = new SoundPlayer(
                        @"d:\\StreamAssets\\HeyLISTEN.wav");
                    player.Play();
                }
            }

            Console.Write(".");

            refreshTimer.Start();
        }