Omni small changes

This commit is contained in:
Stoyan Zlatev
2024-01-03 17:14:17 +01:00
parent 06be0002d6
commit 10a366ad9c
9 changed files with 77 additions and 56 deletions
+2 -1
View File
@@ -4,7 +4,8 @@
<add key="PSNR" value="2015"/>
<add key="Type" value="T2" />
<add key="COMPorts" value="COM4" />
<add key="ExchangeHubURL" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb" />
<!--<add key="ExchangeHubURL" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb" />-->
<add key="ExchangeHubURL" value="http://localhost:52822/LaaProductionWeb"/>
<add key="OmniDB" value="Server=SLASQL01.emea.sensus.net; Database=AuftragKopie; User ID=sa; Password=sqlserver;" />
</appSettings>
</configuration>
@@ -173,6 +173,7 @@
private void PrepareConnections()
{
this.exchangeConnection.Disconnect();
this.exchangeConnection.Connect(this.hubsettings.ExchangeHubURL);
if (this.Size == 0 || this.Type is null)
@@ -421,7 +422,7 @@
if (this.AvailableIn <= 0)
{
this.AvailableIn = 0;
this.awaiter.Set();
this.awaiter?.Set();
}
};
@@ -7,7 +7,6 @@
using OMNIPruefung.ViewModels.Options;
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Input;
@@ -25,6 +24,7 @@
this.Disconnect = new Command(this.DisconnectHubHandler);
this.hubsettings = new ExchangeHubSettings();
this.connection = new ExchangeConnection();
this.connection.StateChanged += Connection_StateChanged1;
this.NotifyPropertyChanged(nameof(this.LogContent));
}
@@ -89,24 +89,29 @@
});
}
private void Connection_StateChanged(string fileName)
private void Connection_StateChanged1(string value, string groupName)
{
try
{
this.LogContent = File.ReadAllText(fileName);
}
catch (Exception e)
{
this.LogContent = e.ToString();
}
this.LogContent += $"[{groupName}] {value}{Environment.NewLine}";
this.NotifyPropertyChanged(nameof(this.LogContent));
}
private void DisconnectHubHandler()
{
this.connection.Disconnect();
this.Connected = false;
Task.Factory.StartNew(() =>
{
try
{
this.connection.Disconnect();
this.Connected = false;
}
catch (Exception e)
{
this.LogContent += $"{e}{Environment.NewLine}";
this.NotifyPropertyChanged(nameof(this.LogContent));
}
});
}
}
}
@@ -81,13 +81,13 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Text="{Binding Size}" HorizontalAlignment="Stretch" Margin="0, 2, 2, 2">
<ComboBoxItem IsSelected="True" >5</ComboBoxItem>
<ComboBoxItem IsSelected="True">6</ComboBoxItem>
<ComboBoxItem IsSelected="True">7</ComboBoxItem>
<ComboBoxItem IsSelected="True">8</ComboBoxItem>
<ComboBoxItem IsSelected="True">9</ComboBoxItem>
<ComboBoxItem IsSelected="True">10</ComboBoxItem>
<ComboBoxItem IsSelected="True">11</ComboBoxItem>
<ComboBoxItem IsSelected="True">5</ComboBoxItem>
<ComboBoxItem >6</ComboBoxItem>
<ComboBoxItem >7</ComboBoxItem>
<ComboBoxItem >8</ComboBoxItem>
<ComboBoxItem >9</ComboBoxItem>
<ComboBoxItem >10</ComboBoxItem>
<ComboBoxItem >11</ComboBoxItem>
</ComboBox>
<ComboBox Grid.Column="1" Text="{Binding Type}" HorizontalAlignment="Stretch" Margin="2, 2, 0, 2">
<ComboBoxItem IsSelected="True">C2</ComboBoxItem>
@@ -61,14 +61,12 @@
Margin="0, 0, 10, 0"/>
<Button VerticalAlignment="Stretch"
HorizontalAlignment="Left"
Visibility="{Binding Disconnected, Converter={StaticResource BooleanVisibility}}"
Style="{StaticResource SystemBtn}"
Command="{Binding Connect}"
Content="Verbinden"
Margin="0, 0, 10, 0"/>
<Button VerticalAlignment="Stretch"
HorizontalAlignment="Left"
Visibility="{Binding Connected, Converter={StaticResource BooleanVisibility}}"
Style="{StaticResource SystemBtn}"
Command="{Binding Disconnect}"
Content="Trennen"
@@ -119,6 +119,11 @@
while (this.IsAlive)
{
if (this.stream is null)
{
continue;
}
var bytes = this.ReadBytes();
if (bytes.Length > 0)