public SampleDataSource()
        {
            var group1 = new MachineDataGroup("basement",
                    "Basement Lab Machines",
                    "49 Machines",
                    "Assets/firstFloor.jfif",
                    "");
            createCpuGroup(group1, 1);
            this.AllGroups.Add(group1);
            var group2 = new MachineDataGroup("thirdFloor",
                    "Third Floor Lab Machines",
                    "96 Machines",
                    "Assets/thirdFloor.jfif",
                    "");
            createCpuGroup(group2, 3);
            this.AllGroups.Add(group2);
            var group3 = new MachineDataGroup("all",
                    "All Lab Machines",
                    "145 Machines",
                    "Assets/gates.jfif",
                    "");
            createCpuGroup(group3, -1);
            this.AllGroups.Add(group3);
            var group4 = new MachineDataGroup("headless",
                   "Headless Machines",
                   "14 Machines",
                   "Assets/headless.jfif",
                   "");
            createCpuGroup(group4, 0);
            this.AllGroups.Add(group4);

            var group5 = new MachineDataGroup("printers",
                   "Lab Printers",
                   "14 Printers",
                   "Assets/printer.jfif",
                   "");
            createPrinterGroup(group5);
            this.AllGroups.Add(group5);
        }
 public static async void createPrinterGroup(MachineDataGroup group)
 {
     group.Items.Clear();
     HttpClient client = new HttpClient();
     Task<String> getStringTask = client.GetStringAsync("https://www.cs.utexas.edu/~chenclee/hacktx/unixlabprinters.scgi");
     String urlContents = await getStringTask;
     string[] words = urlContents.Split(';');
     Array.Sort(words);
     Random rnd = new Random();
     foreach (string word in words)
     {
         if (word.Length > 0)
         {
             string ranFile = (2).ToString();
             String src = "Assets/printer" + ranFile + ".png";
             string[] data = word.Split(',');
             string content = "Num jobs in queue: " + data[1] + "\nBytes in print queue: " + data[2] + "\nPrinter location: " + data[3];
             group.Items.Add(new MachineDataItem(data[0], data[0], data[3], src, "", content, group));
         }
     }
 }
 public static async void createCpuGroup(MachineDataGroup group, int floor)
 {
     group.Items.Clear();
     HttpClient client = new HttpClient();
     Task<String> getStringTask = client.GetStringAsync("https://www.cs.utexas.edu/~chenclee/hacktx/unixlabstatus.scgi");
     String urlContents = await getStringTask;
     string[] words = urlContents.Split(';');
     Array.Sort(words);
     Random rnd = new Random();
     foreach (string word in words)
     {
         if (word.Length > 0)
         {
             string[] data = word.Split(',');
             if (data[1][0] - '0' == floor || floor == -1)
             {
                 if (floor == 0)
                     data[1] = "N/A";
                 String occ = "Yes";
                 string ranFile = (2).ToString();
                 String src = "Assets/occupied" + ranFile + ".png";
                 if(data[2][0] - '0' == 0)
                 {
                     occ = "No";
                     src = "Assets/open" + ranFile + ".png";
                 }
                 String content = "";
                 if (data[4].Equals("down"))
                 {
                     src = "Assets/down.png";
                     content = "Machine Name: " + data[0] + "\nFloor: " + data[1] +
                         "\nOccupied: " + "N/A" + "\nTotal logged in: " + "N/A" +
                         "\nLoad Avg 1: " + "N/A" + "\nLoad Avg 2: " + "N/A" +
                         "\nLoad Avg 3: " + "N/A";
                 }
                 else
                     content = "Machine Name: " + data[0] + "\nFloor: " + data[1] +
                         "\nOccupied: " + occ + "\nTotal logged in: " + data[3] +
                         "\nLoad Avg 1: " + data[4] + "\nLoad Avg 2: " + data[5] +
                         "\nLoad Avg 3: " + data[6];
                 group.Items.Add(new MachineDataItem(data[0], data[0], "Occupied: " + occ, src, "", content, group));
             }
         }
     }
 }
 public MachineDataItem(String uniqueId, String title, String subtitle, String imagePath, String description, String content, MachineDataGroup group)
     : base(uniqueId, title, subtitle, imagePath, description)
 {
     this._content = content;
     this._group = group;
 }