public void fillComboboxWithRoutes() { HttpClient c = new HttpClient(); Task<string> t = c.GetStringAsync("https://sharingservice20200308094713.azurewebsites.net" + "/api/routes/all"); var result = string.Join(",", t.Result); //"[\"14 : 24, 28, 11\",\"15 : 24, 28, 11\",\"YetAnotherRouteName : 24, 28, 33\",\"FirstRealRoute : 3\",\"stuff : 1\",\"something : 4, 5\",\"Something : 4\"]" Console.WriteLine(result); string[] stringArray = result.Split('\"'); List<string> listForCombobox = new List<string>(); foreach (string currStr in stringArray) { if (currStr.Contains(":")) this.comboBox1.Items.Add(currStr.Split(':')[0].Substring(0, currStr.Split(':')[0].Length - 1)); } if (this.comboBox1.Items.Count > 0) this.comboBox1.SelectedIndex = 0; // myThread.Abort(); // myThread.Join(); LoadingForm.setAbort(); }
private async void loadBtn_MouseUp(object sender, MouseEventArgs e) { if (this.comboBox1.Items.Count == 0) { // If no routes exist, don't allow "delete" if (this.comboBox1.Items.Count == 0) { MessageBox.Show("Cannot Load. No Routes Exist", "No Experiences Exist", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } myThread = new Thread(new ThreadStart(parentForm.DisplayLoadingScreen)); myThread.Start(); // Load Selected Route // Get Name of Route string experienceName = (string)this.comboBox1.SelectedItem; // Get All of the Anchors for that Route HttpClient c = new HttpClient(); Task <string> experienceItems = c.GetStringAsync("https://sharingservice20200308094713.azurewebsites.net" + "/api/experiences/" + experienceName); // Populate the table Console.WriteLine(experienceItems.Result); string[] outStrArray = experienceItems.Result.Replace(" ", "").Split(','); parentForm.clearAvailableExperienceItems(); for (int i = 0; i < outStrArray.Length; i++) { List <string> outList = new List <string>(); outList.Add(outStrArray[i]); if (outStrArray[i][0] == 'R') { outList.Add("Route"); } else if (outStrArray[i][0] == 'A') { outList.Add("Assembly"); } parentForm.addRowToCurrentExperienceTable(i, outList); } parentForm.experienceTable.Visible = true; parentForm.experienceTable.ReadOnly = true; // Don't allow edits // parentForm.newRouteTable.Rows[parentForm.newRouteTable.Rows.Count - 1].Cells["routeAnchorsForRemovalChkboxesCol"].Value = false; parentForm.experienceLabel.Text = "Loaded Experience"; parentForm.experienceLoadBtn.Text = "New"; LoadingForm.setAbort(); //this.parentForm.TopLevel = true; //this.TopLevel = false; this.Close(); }
private async void loadBtn_MouseUp(object sender, MouseEventArgs e) { if (this.comboBox1.Items.Count == 0) { // If no routes exist, don't allow "delete" if (this.comboBox1.Items.Count == 0) { MessageBox.Show("Cannot Load. No Routes Exist", "No Routes Exist", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } myThread = new Thread(new ThreadStart(parentForm.DisplayLoadingScreen)); myThread.Start(); // Load Selected Route // Get Name of Route string routeName = (string)this.comboBox1.SelectedItem; // Get All of the Anchors for that Route HttpClient c = new HttpClient(); Task<string> allAnchorsAndInfo = c.GetStringAsync("https://sharingservice20200308094713.azurewebsites.net" + "/api/anchors/allForRoute/" +routeName); // Populate the table Console.WriteLine(allAnchorsAndInfo.Result); string[] outStrArray = allAnchorsAndInfo.Result.Replace("\"","").Replace("[", "").Replace("]", "").Split(','); parentForm.clearNewRouteTable(); for (int i = 0; i < outStrArray.Length; i++) { List<string> outList = new List<string>(); outList.Add(outStrArray[i].Split(':')[0]); outList.Add(outStrArray[i].Split(':')[1]); outList.Add(outStrArray[i].Split(':')[2]); outList.Add(outStrArray[i].Split(':')[3]); outList.Add(outStrArray[i].Split(':')[4]); parentForm.addRowToCurrentRouteTable(i, outList); } parentForm.newRouteTable.Visible = true; parentForm.newRouteTable.ReadOnly = true; // Don't allow edits // parentForm.newRouteTable.Rows[parentForm.newRouteTable.Rows.Count - 1].Cells["routeAnchorsForRemovalChkboxesCol"].Value = false; parentForm.newRouteTableLabel.Text = "Loaded Route"; LoadingForm.setAbort(); this.Close(); }
private void RoutesTab_ActiveChanged(object sender, EventArgs e) { // When "Create New" loses focus (another tab is selected) // hid tables and labels if (RoutesTab.Active == true) { setupForNewRoute(); LoadingForm.setAbort(); uiState = RouteUIState.newRoute; } else { newRouteTable.Visible = false; newRouteTableLabel.Visible = false; availableNavPointsTable.Visible = false; availableNavPointsTableLabel.Visible = false; addAnchorToNewRouteBtn.Visible = false; removeAnchorFromNewRouteBtn.Visible = false; saveNewRouteBtn.Visible = false; updateAnchorBtn.Visible = false; loadBtn.Visible = false; } }
public void abortLoadingForm() { LoadingForm.setAbort(); }