editable app settings, publish to ..\auftrag\Actuelle Anwendungen

This commit is contained in:
Stoyan Zlatev
2025-02-12 12:57:58 +01:00
parent 6351a5f1f6
commit 10d75ec629
8 changed files with 263 additions and 269 deletions
+13 -6
View File
@@ -3,18 +3,25 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<appSettings>
<add key="PickingSlot" value="1" />
<add key="PickingBarcode" value="COM41" />
<add key="LeakSlot" value="2" />
<add key="LeakStationId" value="1" />
<add key="MarriageSlot" value="4" />
<add key="MarriageBarcode" value="COM42" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
+2 -2
View File
@@ -1,9 +1,9 @@
<Application x:Class="CordonelAssemblyLine.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CordonelAssemblyLine"
xmlns:Model="clr-namespace:CordonelAssemblyLine.Model"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Model:ExeConfig x:Key="ExeConfig" />
</Application.Resources>
</Application>
@@ -15,19 +15,26 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<PublishUrl>\\sla12file\auftrag\Aktuelle Anwendungen\CAL\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<InstallFrom>Unc</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<InstallUrl>\\sla12file\auftrag\Aktuelle Anwendungen\CAL\</InstallUrl>
<ProductName>Cordonel Assembly Line</ProductName>
<PublisherName>Xylem Sensus Laatzen</PublisherName>
<SuiteName>Cordonel Assembly Line</SuiteName>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -71,6 +78,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>254AA244F3F29F0692A7B2FAA31F24C884355262</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>CordonelAssemblyLine_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -82,6 +101,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@@ -100,9 +120,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ShouldBePressureTestedModal.xaml.cs">
<DependentUpon>ShouldBePressureTestedModal.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -130,10 +147,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ShouldBePressureTestedModal.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Leak.xaml.cs">
@@ -142,6 +155,7 @@
<Compile Include="Marriage.xaml.cs">
<DependentUpon>Marriage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\ExeConfig.cs" />
<Compile Include="Model\MarriageViewModel.cs" />
<Compile Include="Model\LeakViewModel.cs" />
<Compile Include="Model\PickingModel.cs" />
@@ -165,6 +179,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="CordonelAssemblyLine_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -245,4 +260,7 @@
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /Q /S *.xml *.pdb</PostBuildEvent>
</PropertyGroup>
</Project>
+78 -12
View File
@@ -3,8 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CordonelAssemblyLine"
xmlns:ProductionControls="clr-namespace:ProductionControls;assembly=ProductionControls"
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Closing="Window_Closing">
@@ -25,22 +23,90 @@
<Button Content="Kommissionierung/Picking" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click"/>
<Button Content="Helium Prüfung/Leak" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_1" Grid.Row="1"/>
<Button Content="Verheiraten/Marrieage" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_2" Grid.Row="2"/>
<TextBox Name="txtPickingBarcode" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<TextBox Name="txtPickingSlot" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<!--#region PICKING -->
<TextBox Name="txtPickingSlot"
Grid.Column="1"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding PickingSlot, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120"/>
<TextBox Name="txtPickingBarcode"
Grid.Column="2"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding PickingBarcode, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120"/>
<!--#endregion PICKING -->
<!--#region LEAK -->
<TextBox Name="txtLeakSlot"
Grid.Column="1"
Grid.Row="1"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding LeakSlot, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120"/>
<TextBox Name="txtLeakStation"
Grid.Column="2"
Grid.Row="1"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding LeakStationId, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120" />
<TextBox x:Name="txtTester"
Grid.Column="3"
Grid.Row="1"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding LeakTester, Source={StaticResource ExeConfig}}"
TextChanged="TxtTester_TextChanged"
VerticalAlignment="Top"
Width="120"/>
<!--#endregion LEAK -->
<!--#region MARRIAGE -->
<TextBox Name="txtMarrieageSlot"
Grid.Column="1" Grid.Row="2"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding MarriageSlot, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120"/>
<TextBox Name="txtMarrieageBarcode"
Grid.Column="2"
Grid.Row="2"
HorizontalAlignment="Left"
Height="23"
Margin="10,41,0,0"
TextWrapping="Wrap"
Text="{Binding MarriageBarcode, Source={StaticResource ExeConfig}}"
VerticalAlignment="Top"
Width="120"/>
<!--#endregion MARRIAGE -->
<Label Content="Slot" Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
<Label Content="BarcodePort" Grid.Column="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="75"/>
<TextBox Name="txtLeakStation" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<TextBox Name="txtLeakSlot" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<Label Content="Slot" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
<Label Content="StationId" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="57"/>
<TextBox Name="txtMarrieageBarcode" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<TextBox Name="txtMarrieageSlot" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<Label Content="Slot" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
<Label Content="BarcodePort" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="75"/>
<TextBox x:Name="txtTester" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="" TextChanged="TxtTester_TextChanged" VerticalAlignment="Top" Width="120"/>
<Label Content="Tester" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="57"/>
<ProductionControls1:ctlPictureProgressBar Name="progressBar" HorizontalAlignment="Left" Height="80" Margin="11,0,0,0" Grid.Row="3" VerticalAlignment="Top" Width="771" Grid.ColumnSpan="4"/>
+19 -18
View File
@@ -14,31 +14,32 @@ namespace CordonelAssemblyLine
private Picking PickingWindow;
private Leak LeakWindow;
private Marriage MarriageWindow;
public String PickingSlot { get; set; }
public String PickingBarcode { get; set; }
public String LeakSlot { get; set; }
public String LeakStationId { get; set; }
public String MarriageSlot { get; set; }
public String MarriageBarcode { get; set; }
//public String PickingSlot { get; set; }
//public String PickingBarcode { get; set; }
//public String LeakSlot { get; set; }
//public String LeakStationId { get; set; }
//public String MarriageSlot { get; set; }
//public String MarriageBarcode { get; set; }
public MainWindow()
{
InitializeComponent();
PickingSlot = System.Configuration.ConfigurationManager.AppSettings["PickingSlot"].ToString();
PickingBarcode = System.Configuration.ConfigurationManager.AppSettings["PickingBarcode"].ToString();
LeakSlot = System.Configuration.ConfigurationManager.AppSettings["LeakSlot"].ToString();
LeakStationId = System.Configuration.ConfigurationManager.AppSettings["LeakStationId"].ToString();
MarriageSlot = System.Configuration.ConfigurationManager.AppSettings["MarriageSlot"].ToString();
MarriageBarcode = System.Configuration.ConfigurationManager.AppSettings["MarriageBarcode"].ToString();
//PickingSlot = System.Configuration.ConfigurationManager.AppSettings["PickingSlot"].ToString();
//PickingBarcode = System.Configuration.ConfigurationManager.AppSettings["PickingBarcode"].ToString();
//LeakSlot = System.Configuration.ConfigurationManager.AppSettings["LeakSlot"].ToString();
//LeakStationId = System.Configuration.ConfigurationManager.AppSettings["LeakStationId"].ToString();
//MarriageSlot = System.Configuration.ConfigurationManager.AppSettings["MarriageSlot"].ToString();
//MarriageBarcode = System.Configuration.ConfigurationManager.AppSettings["MarriageBarcode"].ToString();
txtPickingBarcode.Text = PickingBarcode;
txtPickingSlot.Text = PickingSlot;
txtLeakStation.Text = LeakStationId;
txtLeakSlot.Text = LeakSlot;
txtMarrieageBarcode.Text = MarriageBarcode;
txtMarrieageSlot.Text = MarriageSlot;
//txtPickingBarcode.Text = PickingBarcode;
//txtPickingSlot.Text = PickingSlot;
//txtLeakStation.Text = LeakStationId;
//txtLeakSlot.Text = LeakSlot;
//txtMarrieageBarcode.Text = MarriageBarcode;
//txtMarrieageSlot.Text = MarriageSlot;
}
@@ -0,0 +1,112 @@
namespace CordonelAssemblyLine.Model
{
using System.Configuration;
using System.Linq;
using System.Runtime.CompilerServices;
public class ExeConfig
{
public int PickingSlot
{
get
{
_ = int.TryParse(GetValue(), out var value);
return value;
}
set => SetValue(value);
}
public string PickingBarcode
{
get => GetValue();
set => SetValue(value);
}
public int LeakSlot
{
get
{
_ = int.TryParse(GetValue(), out var value);
return value;
}
set => SetValue(value);
}
public int LeakStationId
{
get
{
_ = int.TryParse(GetValue(), out var value);
return value;
}
set => SetValue(value);
}
public string LeakTester
{
get => GetValue();
set => SetValue(value);
}
public int MarriageSlot
{
get
{
_ = int.TryParse(GetValue(), out var value);
return value;
}
set => SetValue(value);
}
public string MarriageBarcode
{
get => GetValue();
set => SetValue(value);
}
private static string GetValue([CallerMemberName] string key = "")
{
if (string.IsNullOrWhiteSpace(key))
{
return default(string);
}
var dll = typeof(ExeConfig).Assembly.Location;
var configuration = ConfigurationManager.OpenExeConfiguration(dll);
var settings = configuration?.AppSettings?.Settings ?? new KeyValueConfigurationCollection();
if (!settings.AllKeys.Contains(key))
{
return default(string);
}
return settings[key].Value;
}
private static void SetValue(object value, [CallerMemberName] string key = "")
{
if (string.IsNullOrWhiteSpace(key))
{
return;
}
var dll = typeof(ExeConfig).Assembly.Location;
var configuration = ConfigurationManager.OpenExeConfiguration(dll);
var settings = configuration?.AppSettings?.Settings ?? new KeyValueConfigurationCollection();
if (!settings.AllKeys.Contains(key))
{
settings.Add(key, string.Empty);
}
settings[key].Value = $"{value}";
configuration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
}
}
@@ -1,153 +0,0 @@
<Window x:Class="CordonelAssemblyLine.ShouldBePressureTestedModal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Local="clr-namespace:CordonelAssemblyLine"
AllowsTransparency="True"
Background="LightGoldenrodYellow"
Foreground="DimGray"
Height="300"
Style="{DynamicResource WindowStyle}"
Width="500"
WindowStartupLocation="CenterScreen"
WindowStyle="None">
<Window.Resources>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2"
SnapsToDevicePixels="true"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeThickness="1"
StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="button-bg" Color="DimGray" Opacity="0.8" />
<SolidColorBrush x:Key="button-bg-hover" Color="DimGray" />
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource button-bg}" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Verdana"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="30 20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3"
Opacity="{TemplateBinding Opacity}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource button-bg-hover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource button-bg-hover}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource button-bg}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<GeometryGroup x:Key="bi-exclamination">
<PathGeometry Figures="M6.95.435c.58-.58 1.52-.58 2.1 0l6.515 6.516c.58.58.58 1.519 0 2.098L9.05 15.565c-.58.58-1.519.58-2.098 0L.435 9.05a1.48 1.48 0 0 1 0-2.098zm1.4.7a.495.495 0 0 0-.7 0L1.134 7.65a.495.495 0 0 0 0 .7l6.516 6.516a.495.495 0 0 0 .7 0l6.516-6.516a.495.495 0 0 0 0-.7L8.35 1.134z"/>
<PathGeometry Figures="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>
</GeometryGroup>
<Style x:Key="WindowStyle" TargetType="{x:Type Window}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="DimGray"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border Background="{TemplateBinding Background}"
BorderThickness="0"
CornerRadius="3"
Padding="3">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3">
<Grid>
<AdornerDecorator>
<ContentPresenter/>
</AdornerDecorator>
<ResizeGrip x:Name="WindowResizeGrip"
HorizontalAlignment="Right"
IsTabStop="false"
Visibility="Collapsed"
VerticalAlignment="Bottom"/>
</Grid>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Window.DataContext>
<Local:ShouldBePressureTestedModalVM />
</Window.DataContext>
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" Margin="0 30">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock FontFamily="Verdana"
FontSize="15"
FontWeight="Black"
HorizontalAlignment="Center"
Text="Dieser Zähler muss zur Druckprüfung!"
TextWrapping="Wrap"
TextAlignment="Center"
Width="300"/>
<TextBlock FontFamily="Verdana"
FontSize="13"
Grid.Row="1"
HorizontalAlignment="Center"
Margin="0 10 0 0"
TextWrapping="Wrap"
TextAlignment="Center"
Width="300">
<Run Text="Dieser Zähler ist teil der" />
<Run Text="{Binding RuleText}" />
<Run Text="Stichproben regel." />
</TextBlock>
</Grid>
<Button Click="CloseModal"
Content="Bitte bestätigen"
Grid.Row="4"
Style="{DynamicResource ButtonStyle}"/>
</Grid>
</Window>
@@ -1,57 +0,0 @@
namespace CordonelAssemblyLine
{
using Stichproben.Cordonel;
using System.ComponentModel;
using System.Windows;
public partial class ShouldBePressureTestedModal : Window
{
private ShouldBePressureTestedModal(int pcbId)
{
this.InitializeComponent();
if (this.DataContext is ShouldBePressureTestedModalVM vm)
{
if (vm.ShouldBePressureTested(pcbId))
{
this.ShowDialog();
}
}
}
private void CloseModal(object _, RoutedEventArgs _1)
=> this.Close();
public static void Check(int pcbId)
=> new ShouldBePressureTestedModal(pcbId);
}
public class ShouldBePressureTestedModalVM : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string ruleText;
public string RuleText
{
get => this.ruleText;
set
{
this.ruleText = value;
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RuleText)));
}
}
internal bool ShouldBePressureTested(int pcbId)
{
var assemblyLocation = typeof(App).Assembly.Location;
var stichproben = new Stichproben(assemblyLocation);
var result = stichproben.ShouldBePressureTested(pcbId);
this.RuleText = $"{result.Rule}% von {result.Count} Stk.";
return result.ShouldBePressureTested;
}
}
}