// monitor wallet private void monitor_wallet() { try { while (KeepAlive) { System.Threading.Thread.Sleep(5000); MotherWallet mw = Json.Wallet(); Status.smart = "SMART: " + mw.Smart.smartBalance.ToString("n2"); Status.globe = "GLOBE: " + mw.Globe.globeBalance.ToString("n2"); Status.sunxx = "SUNXX: " + mw.Sun.sunBalance.ToString("n2"); Logs(220, ""); } } catch (ThreadAbortException e) { Console.WriteLine("Exception message: {0}", e.Message); Console.WriteLine("Thread Abort Exception - resetting."); if (error_message != null) { Logs(500, error_message); } else { Logs(-200, "Service disconnected - Forced Stopped"); } Thread.ResetAbort(); } }
public static MotherWallet Wallet() { MotherWallet mw = new MotherWallet(); string url = "http://api-load4wrd.kpa.ph/balance.aspx"; try { WebClient client = new WebClient(); string value = client.DownloadString(url); mw = JsonConvert.DeserializeObject <MotherWallet>(value); } catch (Exception ex) { } return(mw); }