private void ButttonNewAsset_Click(object sender, RoutedEventArgs e) { var dialog = new ChooseNewAssetTypeDialog(); if (dialog.ShowDialog() == true) { if (dialog.newAssetType == AutomationISE.Model.Constants.assetVariable) { createOrUpdateVariableAsset(dialog.newAssetName, null); } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetCredential) { createOrUpdateCredentialAsset(dialog.newAssetName, null); } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetConnection) { } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetCertificate) { } } }
private async void ButtonNewAsset_Click(object sender, RoutedEventArgs e) { try { var dialog = new ChooseNewAssetTypeDialog(); if (dialog.ShowDialog() == true) { if (dialog.newAssetType == AutomationISE.Model.Constants.assetVariable) { await createOrUpdateVariableAsset(dialog.newAssetName, null); assetsComboBox.SelectedItem = assetsComboBox.Items[0]; } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetCredential) { await createOrUpdateCredentialAsset(dialog.newAssetName, null,true); assetsComboBox.SelectedItem = assetsComboBox.Items[1]; } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetConnection) { await createOrUpdateConnectionAsset(dialog.newAssetName, null,true); assetsComboBox.SelectedItem = assetsComboBox.Items[2]; } else if (dialog.newAssetType == AutomationISE.Model.Constants.assetCertificate) { } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }