// Constructor public MainPage() { InitializeComponent(); // Set the data context of the listbox control to the sample data DataContext = App.ViewModel; Configs.SetFirstLoad(true); PageHandler.ClearViewModelData(); if (Configs.HasPlayerObject()) { //MessageBox.Show("building from storage"); parseJSON(Configs.GetPlayerJSON()); } else { //MessageBox.Show("getting from web"); GetAPIData(); } if (Configs.GetAPIkey() == "") { SignedRequest sr = new SignedRequest(); TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); string unixtime = ts.TotalSeconds.ToString(); sr.ident = Configs.Ident; sr.time = unixtime; sr.clientident = null; sr.name = null; string json = JsonConvert.SerializeObject(sr); sr.MakeRequest("setupkey", "global", json); } BGTaks.AddBGTaks(); }
private void ApplicationBarMenuItem_Click_api(object sender, EventArgs e) { SignedRequest sr = new SignedRequest(); TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); string unixtime = ts.TotalSeconds.ToString(); if (Configs.GetAPIkey() == "") { MessageBox.Show("Making a new API key."); sr.ident = Configs.Ident; sr.time = unixtime; sr.clientident = null; sr.name = null; string json = JsonConvert.SerializeObject(sr); sr.MakeRequest("setupkey", "global", json); } else { MessageBox.Show("Using " + Configs.GetIdent() + " " + Configs.GetAPIkey()); sr.ident = Configs.GetIdent(); sr.time = unixtime; sr.player = Configs.GetPlayer(); string json = JsonConvert.SerializeObject(sr); sr.MakeRequest("playerupdate", Configs.GetPlatform(), json); } }