public MyRidesPage(string playername) { CloudConnection cloud = new CloudConnection(); InitializeComponent(); name = playername; try { List <CloudConnection.JsonItem> itemslist = cloud.GetAllScores(name); ObservableCollection <CellViewModel> cellList = new ObservableCollection <CellViewModel>(); foreach (CloudConnection.JsonItem item in itemslist) { string newDate = cloud.getDate(item); CellViewModel cell = new CellViewModel { date = newDate, time = item.Time, distance = item.Distance + " M" }; cellList.Add(cell); } listView.ItemTemplate = new DataTemplate(typeof(CustomCell)); listView.ItemsSource = cellList; this.scroll.IsVisible = true; this.entrynone.IsVisible = false; }catch (Exception e) { this.scroll.IsVisible = false; this.entrynone.IsVisible = true; } }
/*** * Page Constructor * Initializes the page and all the relevant class properties. * params: * player - player1/player2, indicates the bluetooth device to be connected to. * name - the player's name */ public specificPlayerPage(string player, string name) { InitializeComponent(); currPlayer = player; playerName = name; playerNameLabel.Text = playerName; currDistance = "0"; currSpeed = "0"; timerRunning = false; lastUpdateTime = 0; askToQuit = false; sw = new Stopwatch(); isBTConnected = false; btError = ""; cloud = new CloudConnection(); }
void CreateEntriesList(string name) { int ent_limit = 6; //collect data from cloud here CloudConnection Cloud = new CloudConnection(); try { List <CloudConnection.JsonItem> scores = Cloud.GetXScores(name, ent_limit); foreach (CloudConnection.JsonItem item in scores) { int numVal = Int32.Parse(item.Distance); string newDate = Cloud.getDate(item); Microcharts.Entry ent = new Microcharts.Entry(numVal) { Label = newDate, ValueLabel = numVal + " M", Color = SKColor.Parse("#3498db") }; this.entries.Add(ent); string currtime = item.Time; Microcharts.Entry ent2 = new Microcharts.Entry(FromStringToIntTime(currtime)) { Label = newDate, ValueLabel = FromStringToIntTime(currtime).ToString() + " min", Color = SKColor.Parse("#3498db") }; this.entries2.Add(ent2); } } catch (Exception e) { //we got here if there is no data from the cloud } }