// Gets a door job from the library by name using the search API call private async Task <JObject> GetDoorJobByName(string name) { var api = new KvalCAMApi(BaseAddressTextBox.Text); var result = await api.GetDoorJobByName(name); if (result == null) { throw new Exception($"DoorJob with name \"{name}\" not found"); } return(result); }
private async void LoadNamedButton_Click(object sender, RoutedEventArgs e) { try { // Use the base path set for connecting using the API var api = new KvalCAMApi(BaseAddressTextBox.Text); // Get the job var result = await api.GetDoorJobByName(JobNameTextBox.Text); await api.UploadDoorJobToEditor(result); ResponseTextBox.Text = $"Success, loaded job: {JobNameTextBox.Text}"; } catch (Exception ex) { ResponseTextBox.Text = $"Error: {ex.Message}"; } }