aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure/Tango.AzureUtils.UI
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-06 01:19:06 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-06 01:19:06 +0200
commitc210f8d477af51fd70af0901315a48e193568059 (patch)
tree2ceda8036375cedf39bed1ccd652a9d89d2997f0 /Software/Visual_Studio/Azure/Tango.AzureUtils.UI
parent42f6e5e39ba83531adf8712155ca0015346bd662 (diff)
downloadTango-c210f8d477af51fd70af0901315a48e193568059.tar.gz
Tango-c210f8d477af51fd70af0901315a48e193568059.zip
Working on azure utils...
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils.UI')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs29
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml5
2 files changed, 23 insertions, 11 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)
{
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml
index 4c899bf2d..c7278e2da 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentCreationView.xaml
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:Tango.AzureUtils.UI.ViewModels"
+ xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
xmlns:global="clr-namespace:Tango.AzureUtils.UI"
xmlns:local="clr-namespace:Tango.AzureUtils.UI.Views"
mc:Ignorable="d"
@@ -34,9 +35,9 @@
<TextBox Margin="0 2 0 0" FontSize="20" Text="{Binding Email}"></TextBox>
<TextBlock Margin="0 10 0 0">Password</TextBlock>
- <TextBox Margin="0 2 0 0" FontSize="20" Text="{Binding Password}"></TextBox>
+ <PasswordBox Margin="0 2 0 0" FontSize="20" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"></PasswordBox>
- <Button Margin="0 40 0 0" Padding="20" Command="{Binding CreateDeploymentSlotCommand}">CREATE DEPLOYMENT SLOT</Button>
+ <Button Margin="0 40 0 0" Padding="20" Command="{Binding CreateDeploymentSlotCommand}">CREATE ENVIRONMENT</Button>
</StackPanel>
</Grid>
</Grid>