diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-09 00:42:01 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-02-09 00:42:01 +0200 |
| commit | 771fd149d07b15174d7811f5b3630859d8fb4f0b (patch) | |
| tree | c01945fa12ee38c8d4f36176dcd13559f76dbd13 /Software/Visual_Studio/Azure/Tango.AzureUtils.UI | |
| parent | c9597d3b4a053b7a1246419cb31517dd9f530543 (diff) | |
| download | Tango-771fd149d07b15174d7811f5b3630859d8fb4f0b.tar.gz Tango-771fd149d07b15174d7811f5b3630859d8fb4f0b.zip | |
Working on azure utils...
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils.UI')
3 files changed, 55 insertions, 9 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentLogStreamViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentLogStreamViewVM.cs index 40548bd31..04fca66e1 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentLogStreamViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentLogStreamViewVM.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.AzureUtils.Environment; using Tango.AzureUtils.Logging; +using Tango.Core.Commands; using Tango.SharedUI.Components; namespace Tango.AzureUtils.UI.ViewModels @@ -27,7 +28,7 @@ namespace Tango.AzureUtils.UI.ViewModels public IWebAppBase SelectedDeploymentSlot { get { return _selectedDeploymentSlot; } - set { _selectedDeploymentSlot = value; RaisePropertyChangedAuto(); OnSelectedDeploymentSlotChanged(); } + set { _selectedDeploymentSlot = value; RaisePropertyChangedAuto(); } } private TextController _log; @@ -37,14 +38,32 @@ namespace Tango.AzureUtils.UI.ViewModels set { _log = value; RaisePropertyChangedAuto(); } } + private bool _isStarted; + public bool IsStarted + { + get { return _isStarted; } + set { _isStarted = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand StartCommand { get; set; } + + public RelayCommand StopCommand { get; set; } + + public RelayCommand ClearCommand { get; set; } + public EnvironmentLogStreamViewVM() { Log = new TextController(); + + StartCommand = new RelayCommand(Start,() => !IsStarted); + StopCommand = new RelayCommand(Stop, () => IsStarted); + ClearCommand = new RelayCommand(Clear); } public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps) { DeploymentSlots = apps.ToList(); + SelectedDeploymentSlot = DeploymentSlots.SingleOrDefault(x => x.Name.EndsWith("DEV")); _logStreamManager = new LogStreamManager(azure); _logStreamManager.ConfirmationRequired += ConfirmationHandler; @@ -57,11 +76,31 @@ namespace Tango.AzureUtils.UI.ViewModels Log.WriteLine(msg); } - private async void OnSelectedDeploymentSlotChanged() + private void Clear() + { + Log.Clear(); + } + + private void Stop() + { + IsStarted = false; + _logStreamManager.StopLogStreaming(); + } + + private async void Start() { if (SelectedDeploymentSlot != null && _logStreamManager != null) { - await _logStreamManager.StartLogStreamingAsync(SelectedDeploymentSlot); + try + { + IsStarted = true; + Log.Clear(); + await _logStreamManager.StartLogStreamingAsync(SelectedDeploymentSlot); + } + catch + { + IsStarted = false; + } } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentLogStreamView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentLogStreamView.xaml index 168e0b546..fbfbf8d6c 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentLogStreamView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentLogStreamView.xaml @@ -18,13 +18,13 @@ Foreground="{StaticResource PrimaryForegroundBrush}"> <Grid> <Grid.ColumnDefinitions> - <ColumnDefinition Width="50*"/> + <ColumnDefinition Width="50*" MaxWidth="500" /> <ColumnDefinition Width="60*"/> </Grid.ColumnDefinitions> <GroupBox Header="Source Deployment Slot" Padding="5" Margin="10"> <DockPanel> - <ComboBox DockPanel.Dock="Top" ItemsSource="{Binding DeploymentSlots}" SelectedItem="{Binding SelectedDeploymentSlot}" DisplayMemberPath="Name"></ComboBox> + <ComboBox IsEnabled="{Binding IsStarted,Converter={StaticResource BooleanInverseConverter}}" DockPanel.Dock="Top" ItemsSource="{Binding DeploymentSlots}" SelectedItem="{Binding SelectedDeploymentSlot}" DisplayMemberPath="Name"></ComboBox> <localControls:WebAppPropertiesControl VerticalAlignment="Top" Margin="0 20 0 0" DataContext="{Binding SelectedDeploymentSlot}" /> </DockPanel> @@ -32,7 +32,14 @@ <Grid Grid.Column="1"> <GroupBox Header="Logs" Margin="10" Padding="10"> - <TextBox components:TextController.Controller="{Binding Log}" AcceptsReturn="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsReadOnlyCaretVisible="True" BorderThickness="0"></TextBox> + <DockPanel> + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" DockPanel.Dock="Bottom" Height="40" Margin="0 10 0 0"> + <Button Command="{Binding ClearCommand}" Padding="40 0" Margin="0 0 10 0">CLEAR</Button> + <Button Command="{Binding StopCommand}" Padding="40 0">STOP</Button> + <Button Command="{Binding StartCommand}" Padding="40 0">START</Button> + </StackPanel> + <TextBox components:TextController.Controller="{Binding Log}" AcceptsReturn="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsReadOnlyCaretVisible="True" BorderThickness="0"></TextBox> + </DockPanel> </GroupBox> </Grid> </Grid> diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml index 113fd7b34..b82be1e67 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml @@ -22,7 +22,7 @@ </Grid.ColumnDefinitions> <Grid> - <GroupBox Header="Source App" Padding="10"> + <GroupBox Header="Source App" Padding="10" Margin="10"> <DockPanel> <ComboBox DockPanel.Dock="Top" ItemsSource="{Binding Apps}" SelectedItem="{Binding SelectedSourceApp}"> <ComboBox.ItemTemplate> @@ -39,7 +39,7 @@ <Grid Grid.Column="1" Margin="20 0"> <StackPanel> - <GroupBox Header="Upgrade Configuration" Padding="10"> + <GroupBox Header="Upgrade Configuration" Padding="10" Margin="0 10 0 0"> <StackPanel> <CheckBox Click="OnConfigChanged" IsChecked="{Binding Config.SynchronizeDatabaseSchema}" >Upgrade Database Schema</CheckBox> <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.SynchronizeDatabaseData}" >Upgrade Database Static Collections</CheckBox> @@ -61,7 +61,7 @@ </Grid> <Grid Grid.Column="2"> - <GroupBox Header="Target App" Padding="10"> + <GroupBox Header="Target App" Padding="10" Margin="10"> <DockPanel> <ComboBox DockPanel.Dock="Top" ItemsSource="{Binding Apps}" SelectedItem="{Binding SelectedTargetApp}"> <ComboBox.ItemTemplate> |
