aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs29
1 files changed, 20 insertions, 9 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
index 5a1fa8cca..74995c16d 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows;
using Microsoft.Azure.Management.AppService.Fluent;
using Microsoft.Azure.Management.Fluent;
using Tango.AzureUtils.ActiveDirectory;
@@ -33,7 +34,7 @@ namespace Tango.AzureUtils.UI.ViewModels
}
private String _slotName;
- [Required]
+ [Required(ErrorMessage = "Deployment slot name is required.")]
public String SlotName
{
get { return _slotName; }
@@ -41,8 +42,8 @@ namespace Tango.AzureUtils.UI.ViewModels
}
private String _email;
- [Required]
- [EmailAddress]
+ [Required(ErrorMessage = "Active directory email is required.")]
+ [EmailAddress(ErrorMessage = "Please enter a valid email.")]
public String Email
{
get { return _email; }
@@ -50,7 +51,7 @@ namespace Tango.AzureUtils.UI.ViewModels
}
private String _password;
- [Required]
+ [Required(ErrorMessage = "Password is required.")]
public String Password
{
get { return _password; }
@@ -67,8 +68,6 @@ namespace Tango.AzureUtils.UI.ViewModels
public override void OnApplicationReady()
{
Email = "roy@twine-s.com";
- Password = "1Creativity";
- SlotName = "ROY";
}
public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps)
@@ -77,7 +76,21 @@ namespace Tango.AzureUtils.UI.ViewModels
DeploymentSlots = apps.OfType<IDeploymentSlot>().Where(x => x.Parent == _machineServiceApp).ToList();
SelectedDeploymentSlot = DeploymentSlots.FirstOrDefault();
- _environmentManager = new EnvironmentManager(azure, new ActiveDirectoryManager(azure, AzureUtilsAuthenticationFactory.GetCredentials()));
+ _environmentManager = new EnvironmentManager(azure);
+ _environmentManager.ConfirmationRequired += _environmentManager_ConfirmationRequired;
+ _environmentManager.Progress += (x, e) => StatusManager.UpdateStatus(e);
+ }
+
+ private void _environmentManager_ConfirmationRequired(object sender, AzureUtilsConfirmationEventArgs e)
+ {
+ if (MessageBox.Show(e.Message, "Confirmation Required", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
+ {
+ e.Confirm();
+ }
+ else
+ {
+ e.Cancel();
+ }
}
private async void CreateDeploymentSlot()
@@ -87,9 +100,7 @@ namespace Tango.AzureUtils.UI.ViewModels
if (!Validate()) return;
IsFree = false;
- StatusManager.UpdateStatus(AzureUtilsStage.Creating, "Creating new deployment slot...", true);
await _environmentManager.CreateDeploymentSlot(_machineServiceApp as IWebApp, SelectedDeploymentSlot, SlotName, Email, Password);
- StatusManager.UpdateStatus(AzureUtilsStage.Ready, "Deployment slot created successfully.");
}
catch (Exception ex)
{