aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-09 00:42:01 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-09 00:42:01 +0200
commit771fd149d07b15174d7811f5b3630859d8fb4f0b (patch)
treec01945fa12ee38c8d4f36176dcd13559f76dbd13 /Software/Visual_Studio/Azure
parentc9597d3b4a053b7a1246419cb31517dd9f530543 (diff)
downloadTango-771fd149d07b15174d7811f5b3630859d8fb4f0b.tar.gz
Tango-771fd149d07b15174d7811f5b3630859d8fb4f0b.zip
Working on azure utils...
Diffstat (limited to 'Software/Visual_Studio/Azure')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentLogStreamViewVM.cs45
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentLogStreamView.xaml13
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml6
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils/Logging/LogStreamManager.cs15
4 files changed, 66 insertions, 13 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>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Logging/LogStreamManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Logging/LogStreamManager.cs
index 4c37adb61..19752a6b8 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Logging/LogStreamManager.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Logging/LogStreamManager.cs
@@ -50,14 +50,21 @@ namespace Tango.AzureUtils.Logging
{
while (_currentStream != null)
{
- String line = String.Empty;
+ String line = null;
do
{
- line = _reader.ReadLine();
- if (line != null)
+ try
{
- LogAvailable?.Invoke(this, line);
+ line = _reader.ReadLine();
+ if (line != null)
+ {
+ LogAvailable?.Invoke(this, line);
+ }
+ }
+ catch
+ {
+ line = null;
}
} while (line != null);