public static MonitisData.ExternalMonitorsInfo getExternalMonitorInfoList(MonitisData.ExternalMonitors _externalMonitors) { apiKey = Properties.Settings.Default.monitisApiKey; MonitisData.ExternalMonitorsInfo externalMonitorsInfo = new MonitisData.ExternalMonitorsInfo(); foreach (MonitisData.ExternalMonitor ext in _externalMonitors.getItestList().Values) { externalMonitorsInfo.add(getExternalMonitorInfo(ext.id)); } return externalMonitorsInfo; }
//Get list of external monitors from within your Monitis account //For each monitor returned create a worksheet within the spreadhseet private void buttonGetMonitors_Click(object sender, RoutedEventArgs e) { //get the list of external monitors from your Monitis account externalMonitorList = MonitisService.getListOfExternalMonitors(); externalMonitorInfoList = MonitisService.getExternalMonitorInfoList(externalMonitorList); //get list of locations of all external monitors in the Monitis account locationsUsed = new ApplUtils.Locations(externalMonitorInfoList); Properties.Settings.Default.externalMonitors = new System.Collections.Specialized.StringCollection(); //populate the ComboBox foreach (ExternalMonitor ext in externalMonitorList.testList) { Properties.Settings.Default.externalMonitors.Add(ext.name); Properties.Settings.Default.Save(); GoogleDocs.GoogleSpreadSheetService.addWorkSheet(ext.name, 1, 7); dataGridExternalMonitors.Items.Add(new ApplUtils.ExternalMonitor(ext.name, true)); } GoogleDocs.GoogleSpreadSheetService.deleteWorkSheet("Sheet 1"); this.buttonGetMonitors.IsEnabled = false; this.buttonPostData.IsEnabled = true; }