This commit is contained in:
Luc 2021-05-12 16:31:01 +02:00
parent 66cf9c4440
commit 5cc711e946
15 changed files with 188 additions and 190 deletions

View file

@ -35,16 +35,12 @@ DWORD EpdBase::Epd2U::StartCom()
if (CommsInitialized==0)
do {
InitRv = InitComms(port, 9600, 8, 0, 0);
//System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms RV={0} Port={1}", InitRv, port));
if (InitRv == 0) {
rv= GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
//System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms ErrorReason={0} ErrorData={1} Port={2}", ErrorReason, ErrorData, port));
Sleep(300); DeinitComms(port);
}
else {
SetRetryCounts(RxRetryCount, TxRetryCount);
//SetDiscoveryTimeslotCount(port, 2);
SetDiscoveryTimeslotPeriod(port, DiscoveryTimeslotPeriod);
SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod);
}
@ -75,10 +71,7 @@ int EpdBase::Epd2U::StartDiscover( int EpdTimeout)
Ev1 = CreateWaitableTimer(NULL, TRUE, NULL);
LARGE_INTEGER wt;
wt.QuadPart = Int32x32To64(maxDiscoverTime, -10000); //10 seconden proberen
//wt.QuadPart = -100000000LL;
if (Ev1 != NULL) SetWaitableTimer(Ev1, &wt, 0, NULL, NULL, FALSE);
int maxtries = 100; DeviceCount = 0; DiscRV = 1; DWORD wo = 1; // ongeveer 43 tries in 10 seconden
int tries = 0;
while (DeviceCount == 0 && wo != 0) //tries-- > 0 &&
@ -88,7 +81,8 @@ int EpdBase::Epd2U::StartDiscover( int EpdTimeout)
if (DiscRV == 0) {
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
}
wo = WaitForSingleObject(Ev1, 0);
Sleep(100);
wo = WaitForSingleObject(Ev1,0);
}
CloseHandle(Ev1);
Ev1 = INVALID_HANDLE_VALUE;

View file

@ -3,7 +3,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define eDosStation_TargetDir=$(var.eDosStation.TargetDir)?>
<?define syncEdosLocal_TargetDir=$(var.syncEdosLocal.TargetDir)?>
<Product Id="*" Name="eDosStation" Language="1033" Version="1.6.1.0" Manufacturer="SCK CEN Luc Vandenbroucke" UpgradeCode="24e037ca-edbb-49d5-85d4-3a93dd7d10d8">
<Product Id="*" Name="eDosStation" Language="1033" Version="1.6.2.0" Manufacturer="SCK CEN Luc Vandenbroucke" UpgradeCode="24e037ca-edbb-49d5-85d4-3a93dd7d10d8">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Comments="EPD lees software en synchronisatie tussen local en remote database" InstallPrivileges="elevated" Platform="x86" Description="eDosStation 1.6.1" />
<Media Id="1" EmbedCab="yes" Cabinet="cab" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

View file

@ -1,20 +1,20 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:eDosStation"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="eDosStation.EntryBadge"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
x:Class="eDosStation.EntryBadge"
mc:Ignorable="d"
Title="EntryBadge"
Height="980" Width="1820" ResizeMode="NoResize"
FontFamily="Segoe UI" FontSize="36"
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing" >
WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing"
>
<Window.Resources>
<local:DataSet1 x:Key="dataSet1"/>
<CollectionViewSource x:Key="getTaskListViewSource" Source="{Binding GetTaskInfo, Source={StaticResource dataSet1}}"/>
<CollectionViewSource x:Key="getTaskListViewSource" Source="{Binding GetTaskInfo, Source={StaticResource dataSet1}}" />
</Window.Resources>
<DockPanel VerticalAlignment="Top">
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Left">
@ -23,9 +23,9 @@
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center">
<!--<StaticResource ResourceKey="tbFooter" />-->
</StackPanel>
<TabControl Name="tb" TabStripPlacement="Top" SelectionChanged="tb_SelectionChanged" VerticalAlignment="Center" >
<TabControl Name="tb" TabStripPlacement="Top" VerticalAlignment="Center" >
<TabItem Name="tbEntry" VerticalAlignment="Center" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,100,10,10">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,100,10,10" >
<Border Background="{Binding Mode=OneWay, Source={StaticResource sckbLB}}" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" CornerRadius="10" BorderThickness="2" BorderBrush="Blue" >
<StackPanel HorizontalAlignment="Center" >
<TextBlock TextAlignment="Center" Padding="10,10,10,10" >
@ -48,11 +48,10 @@
<TextBlock x:Name="Code" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,50,0,0" Name="pTestButtons" Visibility="Collapsed" />
</StackPanel>
</TabItem>
<TabItem Name="tbUser" VerticalAlignment="Center" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical" Margin="50,50,50,50">
<Border Background="AliceBlue" TextBlock.FontSize="20" Padding="20,20,20,20" >
<StackPanel HorizontalAlignment="Center" >
<TextBlock Name="Username" Text="" TextAlignment="Center" Margin="0,20,0,20" HorizontalAlignment="Stretch"/>
@ -65,14 +64,13 @@
<TextBlock x:Name="UserComment" />
</StackPanel>
</Border>
<ProgressBar x:Name="pUserSeconds" Background="Blue" Value="5" Maximum="10" Tag="AA" >
<ProgressBar.Effect>
<DropShadowEffect/>
</ProgressBar.Effect>
</ProgressBar>
<TextBlock x:Name="tUserSeconds" Text="10" TextAlignment="Center" HorizontalAlignment="Stretch" />
<telerik:RadButton Content="OK" Name="bUserRead" Click="BUserRead_Click" Style="{DynamicResource OkCancelButton}"/>
<telerik:RadButton Content="OK" Name="bUserRead" Click="BUserRead_Click" Style="{DynamicResource OkCancelButton}" Margin="50,50,50,50"/>
</StackPanel>
</TabItem>
<TabItem Name="tbTask" VerticalAlignment="Top">

View file

@ -1,9 +1,9 @@

using System;
using System;
using System.Data;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Threading;
namespace eDosStation
@ -70,7 +70,18 @@ namespace eDosStation
statusEPD.Text = $"EPD: {ep.EpdID}";
if (ep.Issued)
{
MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
TextBlock il = new TextBlock();
il.Inlines.Add(new Run("This EPD is currently issued") {
FontSize = 36
}); ;
il.Inlines.Add(new LineBreak());
il.Inlines.Add(new Run("Please take an other."));
il.HorizontalAlignment = HorizontalAlignment.Center;
il.TextAlignment = System.Windows.TextAlignment.Center;
(new InstMessage(il)).ShowDialog();
//MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
this.Close();
return false;
}
@ -85,7 +96,7 @@ namespace eDosStation
this.Close();
return false;
}
bool isBG = (ep.epdType == 0);
bool isBG = ep.epdType == 0;
if (isBG != CurTaskRow.EPDRad.Equals("BG"))
{
MessageBox.Show("Wrong EPD Type", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
@ -155,8 +166,6 @@ namespace eDosStation
dataInterface.VisitInitCommand.Parameters["EPD_InternalID"].Value = (int)ep.EpdID;
dataInterface.VisitInitCommand.Parameters["isBG"].Value = isBG;
dataInterface.VisitInitCommand.Parameters["ENTRY_EPD_CLOCK"].Value = ep.CountsClock;
using (var l = new SqlLog())
try
{
@ -194,7 +203,6 @@ namespace eDosStation
ep.Hp10THDose1 = CurTaskRow.Hp10Dose1;
ep.Hp10THDose2 = CurTaskRow.Hp10Dose2;
ep.Hp07THDose = CurTaskRow.Hp07Dose;
int? kx = null;
if (!CurTaskRow.IsFNGain_ANGainValueNull()) kx = (int)CurTaskRow.FNGain_ANGainValue;
if (kx != null && (ep.K3 != kx || ep.K4 != kx))
@ -233,7 +241,7 @@ namespace eDosStation
int ok = ep.Connect(false,thisStation.EPDTimeOut);
if (ok != 1)
{
statusEPD.Text= $"GetEpd {ok} ConnectError: {ep.ConnectError}";
statusEPD.Text= $"GetEpd {ok} Connect Error: {ep.ConnectError}";
}
if (ep.DeviceCount == 1 && ep.b.CurrentDeviceID > 0)
@ -245,15 +253,7 @@ namespace eDosStation
if (!EpdFound)
{
MessageBox.Show("EPD niet gevonden");
this.Close();
endPage();
//statusEPD.Text = $"EPD: Wait ";
//Search = 100;
//dispatcherTimer = new DispatcherTimer();
//dispatcherTimer.Tick += DispatcherTimer_Tick;
//dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
//dispatcherTimer.Start();
//return;
}
}
@ -563,8 +563,6 @@ namespace eDosStation
private void AddTestButtons()
{
//pTestButtons
//<Button Height="30" Content="*TP 1*" Tag="1" Name="bTestPerson1" Click="BTestPerson_Click" Margin="0,0,20,0"/>
StackPanel sp = pTestButtons;
Button b;
Thickness m = new Thickness(0, 0, 20, 0);
@ -634,8 +632,6 @@ namespace eDosStation
//else {
// dfReader.WaitForBadge();
//}
}
private void DfReader_BadgeError(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeErrorEventArgs e)
@ -647,21 +643,7 @@ namespace eDosStation
{
endPage();
}
private void tb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.Count>0 && e.AddedItems[0] is TabControl)
{
}
}
private void bEpdDone_Click(object sender, RoutedEventArgs e)
{
}
private void DfReader_BadgeTO(LSWDesfirePublic.CCard Sender, EventArgs e)
{
this.Dispatcher.InvokeAsync(new Action(() => endPage()),DispatcherPriority.Normal);

View file

@ -7,10 +7,14 @@
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
Title="Exit"
Height="980" Width="1820" ResizeMode="NoResize"
Height="980" Width="1820"
ResizeMode="NoResize"
VerticalAlignment="Center"
FontFamily="Segoe UI" FontSize="36"
Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" Closing="Window_Closing">
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen"
WindowStyle="SingleBorderWindow"
Closing="Window_Closing">
<DockPanel>
<StatusBar DockPanel.Dock="Bottom" >
<StatusBarItem Name="statusEPD" Content="Epd" />

View file

@ -48,14 +48,15 @@ namespace eDosStation
private void LoadDoses()
{
//Zet timeout op dit scherm
if (dispatcherTimer == null)
{
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
} else
{
dispatcherTimer.Tick -= DispatcherTimer_IsEPDFound;
dispatcherTimer.Stop();
dispatcherTimer.Tick -= DispatcherTimer_IsEPDFound;
}
dispatcherTimer.Tick += DispatcherTimer_WindowTimeoutAndClose; ;
int rv= ep.GetStatus();
@ -76,15 +77,16 @@ namespace eDosStation
ep.Hp10 = 2;
#endif
if (!ep.Issued)
{
MessageBox.Show("This EPD is not issued","EDP",MessageBoxButton.OK,MessageBoxImage.Hand,MessageBoxResult.OK,MessageBoxOptions.ServiceNotification);
(new InstMessage("This EPD is not issued")).ShowDialog();
//MessageBox.Show("This EPD is not issued","EDP",MessageBoxButton.OK,MessageBoxImage.Hand,MessageBoxResult.OK,MessageBoxOptions.ServiceNotification);
this.Close();
return;
} else if (ep.EpdID==0)
{
MessageBox.Show("This EPD is not read", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
(new InstMessage("The EPD is not found")).ShowDialog();
//MessageBox.Show("This EPD is not read", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
}
bool NoTimeout = false;
@ -148,9 +150,8 @@ namespace eDosStation
}
l.Dispose();
}
if (!NoTimeout) dispatcherTimer.Start(); //Knop hide
return;
}
@ -160,7 +161,7 @@ namespace eDosStation
this.Close();
}
private void StartScan()
{
EpdFound = false;
@ -172,16 +173,6 @@ namespace eDosStation
LoadDoses();
}
else this.Close();
//if (!EpdFound && rv==1) //do loop ?
//{
// statusEPD.Content = $"EPD: Wait ";
// Search = 100;
// dispatcherTimer = new DispatcherTimer();
// dispatcherTimer.Tick += DispatcherTimer_IsEPDFound;
// dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
// dispatcherTimer.Start();
//}
}
private void Window_Loaded(object sender, RoutedEventArgs e)

View file

@ -3,22 +3,37 @@
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:eDosStation"
mc:Ignorable="d"
Title="InstMessage" Height="450" Width="800" Topmost="True" WindowStartupLocation="CenterScreen" Closing="Window_Closing" Loaded="Window_Loaded" >
<Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" MinWidth="500" >
<StackPanel Name="sComments" VerticalAlignment="Center" HorizontalAlignment="Center" >
</StackPanel>
<Button Content="OK" Name="bMsg" Click="BMsg_Click" Width="50" Margin="0,20,0,20"/>
Title="InstMessage" Height="700" Width="900"
Topmost="True"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
Closing="Window_Closing" Loaded="Window_Loaded" >
<DockPanel >
<StackPanel DockPanel.Dock="Bottom">
<telerik:RadButton Content="Close" Name="bMsg" Click="BMsg_Click" Height="50" Margin="0,20,0,20" Style="{StaticResource OkCancelButton}"/>
<ProgressBar x:Name="pUserSeconds" Background="Blue" Value="5" Maximum="10" Tag="AA" Height="10" MinWidth="150" >
<ProgressBar.Effect>
<DropShadowEffect/>
</ProgressBar.Effect>
</ProgressBar>
</StackPanel>
</Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" MinWidth="600" MinHeight="600" >
<Border Background="{StaticResource sckbLB}" CornerRadius="10" Margin="0,0,0,30" >
<StackPanel Orientation="Horizontal" >
<Image Source="/Images/Mannetje.png" Margin="10,5,20,5" />
<TextBlock Text="Message" VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" Width="500" FontSize="35" Foreground="{StaticResource sckbP}" FontWeight="Bold" />
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource sckbP}" BorderThickness="1" CornerRadius="10" Margin="0,0,0,50" MinHeight="300" >
<StackPanel Name="sComments" VerticalAlignment="Center" HorizontalAlignment="Center" TextBlock.FontSize="30" >
<TextBlock Text="koko" VerticalAlignment="Center" />
</StackPanel>
</Border>
</StackPanel>
</DockPanel>
</Window>

View file

@ -21,11 +21,17 @@ namespace eDosStation
public partial class InstMessage : Window
{
DispatcherTimer dispatcherTimer;
int UserSeconds;
public InstMessage(TextBlock comments)
int UserSeconds;
public InstMessage(string Comments)
{
InitializeComponent();
sComments.Children.Add(comments);
AddComment(Comments);
}
public InstMessage(TextBlock tbComments)
{
InitializeComponent();
AddComment(tbComments);
}
private void BMsg_Click(object sender, RoutedEventArgs e)
@ -33,6 +39,20 @@ namespace eDosStation
Close();
}
private void AddComment(TextBlock tbComments)
{
sComments.Children.Clear();
sComments.Children.Add(tbComments);
}
private void AddComment(string Comments)
{
TextBlock tb = new TextBlock(new Run(Comments));
tb.FontSize = 24;
tb.VerticalAlignment = VerticalAlignment.Center;
AddComment(tb);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
sComments.Children.Clear();
@ -42,7 +62,6 @@ namespace eDosStation
{
if (--UserSeconds > 0 )
{
//tUserSeconds.Text = UserSeconds.ToString();
pUserSeconds.Value = UserSeconds;
}
else

View file

@ -14,14 +14,17 @@
>
<DockPanel>
<Menu DockPanel.Dock="Top">
<Menu.ItemsPanel>
<ItemsPanelTemplate>
<DockPanel HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</Menu.ItemsPanel>
<MenuItem Header="E_xit" Name="mExit" Click="mExit_Click" HorizontalAlignment="Right" />
<MenuItem Header="Settings" Click="MenuItem_Click" />
<MenuItem Header="Advanced Settings" >
<MenuItem Header="Enc" Name="mEnc" Click="MEnc_Click" />
</MenuItem>
<Separator></Separator>
<MenuItem Header="About" Name="mAbout" Click="mAbout_Click" HorizontalAlignment="Right" />
<Separator/>
<MenuItem Header="E_xit" Name="mExit" Click="mExit_Click" HorizontalAlignment="Right" />
</Menu>
<StatusBar DockPanel.Dock="Bottom" >
<StatusBarItem Name="Status" Content="Offline" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" />
@ -39,9 +42,9 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Source="/Images/logoh60.png" Height="60" HorizontalAlignment="Left" Margin="0,0,10,2" />
<TextBlock Grid.Column="1" FontSize="30" Text="HPH eDos" TextAlignment="Center" Foreground="{StaticResource sckbP}" FontWeight="Bold" VerticalAlignment="Center" Background="{DynamicResource sckbLB}" />
<TextBlock Grid.Column="2" FontSize="30" Name="tbTime" Text="2021-04-02 08:00" TextAlignment="Right" VerticalAlignment="Center" Foreground="{StaticResource sckbP}" HorizontalAlignment="Right" Padding="20,0" Background="{DynamicResource sckbLB}" />
<Image x:Name="logo" Source="/Images/logoh60.png" Height="60" HorizontalAlignment="Left" Margin="1,0,0,10" />
<TextBlock Grid.Column="1" FontSize="30" Text="HPH eDos" TextAlignment="Center" Foreground="{StaticResource sckbP}" FontWeight="Bold" VerticalAlignment="Center" Background="{DynamicResource sckbLB}" Height="{Binding ElementName=logo, Path=ActualHeight}" />
<TextBlock Grid.Column="2" FontSize="30" Name="tbTime" Text="2021-04-02 08:00" TextAlignment="Right" VerticalAlignment="Center" Foreground="{StaticResource sckbP}" HorizontalAlignment="Right" Padding="20,0" Background="{DynamicResource sckbLB}" Height="{Binding ElementName=logo, Path=ActualHeight}"/>
</Grid>
<StackPanel DockPanel.Dock="Left" Width="100" />
<StackPanel DockPanel.Dock="right" Width="100" />

View file

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.1.0")]
[assembly: AssemblyFileVersion("1.6.1.0")]
[assembly: AssemblyVersion("1.6.2.0")]
[assembly: AssemblyFileVersion("1.6.2.0")]

View file

@ -35,10 +35,9 @@
<TextBlock Grid.Row="2" Grid.Column="0" Text="Installation 2"></TextBlock>
<telerik:RadComboBox Name="CIns2" Grid.Row="2" Grid.Column="1" SelectedValuePath="Inst_CODE" DisplayMemberPath="InstallationName" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="Badgelezers" Height="23" Margin="0,0,0.2,0" VerticalAlignment="Top"></TextBlock>
<ComboBox Grid.Row="4" Grid.Column="1" Name="cbReaders" />
<telerik:RadComboBox Grid.Row="4" Grid.Column="1" Name="cbReaders" SelectedValuePath="Text" DisplayMemberPath="Text" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="Check user status" Height="23" Margin="0,0,0.2,0" VerticalAlignment="Top"></TextBlock>
<CheckBox Grid.Row="5" Grid.ColumnSpan="2" Name="cbCheckUsers" Grid.Column="1" Padding="10,0,10,0" VerticalAlignment="Center" />

View file

@ -1,7 +1,5 @@
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace eDosStation
{
@ -17,11 +15,22 @@ namespace eDosStation
Text = txt; Value = val;
}
}
public class readerclass
{
public string Text { get; set; }
public readerclass(string txt)
{
Text = txt;
}
}
public partial class Settings : Window
{
Station thisStation;
ObservableCollection<beepclass> beepValues = new ObservableCollection<beepclass>();
ObservableCollection<readerclass> readerValues = new ObservableCollection<readerclass>();
public Settings( Station tStation)
{
thisStation = tStation;
@ -45,7 +54,7 @@ namespace eDosStation
if (cbValidation.IsChecked == null) cbValidation.IsChecked = false;
thisStation.useTestButtons = cbValidation.IsChecked.Value;
thisStation.Reader = cbReaders.Text;
thisStation.Reader = (string)cbReaders.SelectedValue;
thisStation.checkUser = cbCheckUsers.IsChecked != null ? cbCheckUsers.IsChecked.Value : false;
thisStation.EPDTimeOut = int.Parse(tEPDTimeout.Text);
@ -64,23 +73,26 @@ namespace eDosStation
private void Window_Loaded(object sender, RoutedEventArgs e)
{
string[] readers = null;
using (var a = new LSWDesfirePublic.CCard())
{
a.GetReaderList();
readers = a.readersList.ToArray();
foreach (string s in a.readersList) { readerValues.Add(new readerclass(s)); }
}
cbReaders.ItemsSource = readerValues;
cbReaders.SelectedValue = thisStation.Reader;
foreach (string cn in System.IO.Ports.SerialPort.GetPortNames())
{
cComPort.Items.Add(cn);
}
beepValues.Add(new beepclass("Loud High Beep", 0b00010111));
beepValues.Add(new beepclass("Loud Low Beep", 0b00011111));
beepValues.Add(new beepclass("Normal Hig Beep", 0b00010110));
beepValues.Add(new beepclass("Normal Low Beep", 0b00011110));
beepValues.Add(new beepclass("No Beep", 0b00011010));
beepValues.Add(new beepclass("Loud High freq Beep", 0b00010111));
beepValues.Add(new beepclass("Loud Low freq Beep", 0b00011111));
beepValues.Add(new beepclass("Normal High freq Beep", 0b00010110));
beepValues.Add(new beepclass("Normal Low freq Beep", 0b00011110));
beepValues.Add(new beepclass("No Beep (only led)", 0b00011010));
//beepValues.Add(new beepclass("Beep", 22));
//beepValues.Add(new beepclass("No Beep", 18));
@ -110,19 +122,7 @@ namespace eDosStation
tEPDTimeout.Text = thisStation.EPDTimeOut.ToString();
bool rv = thisStation.dataInterface.checkCon(false);
cbReaders.Items.Clear();
foreach (string s in readers )
{
ComboBoxItem b = new ComboBoxItem();
b.Content = s;
if (s.Equals(thisStation.Reader))
{
b.IsSelected = true;
b.Background = Brushes.Green;
}
cbReaders.Items.Add(b);
}
}
}
}

View file

@ -3,10 +3,15 @@
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:eDosStation"
mc:Ignorable="d"
Title="ShowEPDDose" Height="450" Width="800" Loaded="Window_Loaded" Unloaded="Window_Unloaded" WindowStartupLocation="CenterScreen"
FontFamily="Segoe UI">
Title="ShowEPDDose" Height="450" Width="800"
Loaded="Window_Loaded"
Unloaded="Window_Unloaded"
WindowStartupLocation="CenterScreen"
FontFamily="Segoe UI"
WindowStyle="None">
<DockPanel>
<StatusBar DockPanel.Dock="Bottom" >
<StatusBarItem Name="statusEPD" Content="Epd" />
@ -19,7 +24,7 @@
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
@ -27,27 +32,26 @@
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="PersID" Padding="20,0,20,0"/>
<TextBlock Grid.Row="0" Grid.Column="0" Text="PersID :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="1" Name ="Wearer" Text=""/>
<TextBlock Grid.Row="0" Grid.Column="2" Text ="Visit#" Padding="20,0,20,0" />
<TextBlock Grid.Row="0" Grid.Column="2" Text ="Visit#" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="3" Name ="EpdVisit" Text="" Padding="20,0,20,0" />
<Line Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Stroke="Black" Width="10" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Issued ?" Padding="20,0,20,0" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Issued :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="no" Name ="isIssued" Padding="20,0,20,0" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="Alarm ?" Padding="20,0,20,0"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="Alarm :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="no" Name ="hasAlarm" Padding="20,0,20,0"/>
<StackPanel Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Name="sAlarm" Margin="50,0,20,0"/>
<TextBlock Grid.Row="4" Grid.Column="0" Text="Dose" Padding="20,0,20,0" />
<StackPanel Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="5,10,0,0">
<TextBlock Grid.Row="4" Grid.Column="0" Text="Doses :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right" />
<StackPanel Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="5,10,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Name="HpDose07l" Width="200"/>
<TextBlock Name="HpDose07" />
@ -58,8 +62,8 @@
</StackPanel>
</StackPanel>
<TextBlock Grid.Row="6" Grid.Column="0" Text="Dose Treshold" Padding="20,0,20,0" />
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Vertical" >
<TextBlock Grid.Row="5" Grid.Column="0" Text="Dose Tresholds :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<StackPanel Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="0,20,0,20" >
<StackPanel Orientation="Horizontal">
<TextBlock Name="HP07AlarmDosel" Width="200" />
<TextBlock Name="HP07AlarmDose" />
@ -74,9 +78,9 @@
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" >
<telerik:RadButton Content="Close" Style="{StaticResource OkCancelButton}" Margin="0,20,0,20" Click="RadButton_Click" />
</StackPanel>
</Grid>
</DockPanel>
</Window>

View file

@ -36,12 +36,11 @@ namespace eDosStation
private void LoadDoses()
{
ep.GetStatus();
isIssued.Text = ep.Issued ? "Yes" : "no";
Wearer.Text = ep.WearerName;
EpdVisit.Text = ep.WearerID.ToString();
if ((ep.otherAlarms & 0x7f)!=0 || ep.alarmStatus>0)
if ((ep.otherAlarms & 0x7f) != 0 || ep.alarmStatus > 0)
{
hasAlarm.Text = "Yes";
} else
@ -66,74 +65,62 @@ namespace eDosStation
HP10AlarmDose2.Text = $"{ep.Hp10THDose2:0.00} µSv";
HP07AlarmDose.Text = $"{ep.Hp07THDose:0.00} µSv";
//ep.ReadExtraStatus();
//BatVolt.Text = $" {ep.BatADC * 16.0} mV";
//SupplyVolt.Text = $" {ep.SupplyADC* 16.0} mV";
//int Hp10THDose2;
//int Hp07THDose;
ep.Close();
}
private void GetEPD()
{
EpdFound = false;
int ConnectRV = 0;
try
{
ConnectRV = ep.Connect(false, thisStation.EPDTimeOut);
}
catch (System.Exception ex)
{
MessageBox.Show($"Error loading dll's {ex.Message}");
}
if (ConnectRV == 1 && ep.DeviceCount == 1)
{
EpdFound = true;
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
LoadDoses();
}
else endPage();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
int ConnectRV = 0;
System.Diagnostics.Debug.WriteLine(thisStation.ComPort.ToString());
try
{
//ep = new EpdBaseClr.Epd2(thisStation.ComPort);
ConnectRV = ep.Connect(false,thisStation.EPDTimeOut);
} catch (System.Exception ex)
{
MessageBox.Show($"Error loading dll's {ex.Message}");
}
if (ep.DeviceCount == 1 )
{
System.Diagnostics.Debug.WriteLine("found");
EpdFound = true;
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
LoadDoses();
}
if (!EpdFound)
{
statusEPD.Content = $"EPD: Wait ";
Search = 100;
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += DispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
dispatcherTimer.Start();
}
Dispatcher.InvokeAsync(GetEPD, DispatcherPriority.Background);
}
private void endPage()
{
dispatcherTimer?.Stop();
if (ep!=null) ep.Close();
this.Close();
}
private void DispatcherTimer_Tick(object sender, EventArgs e)
{
dispatcherTimer.Stop();
ep.Connect(false, thisStation.EPDTimeOut);
if (ep.DeviceCount == 1 )
if (ep.DeviceCount == 1)
{
EpdFound = true;
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
LoadDoses();
}
if (!EpdFound)
{ Search--;
if (Search > 0)
{
statusEPD.Content = $"Search {Search}";
dispatcherTimer.Start();
} else
{
statusEPD.Content = $"Search Timeout";
}
}
else endPage();
}
private void Window_Unloaded(object sender, RoutedEventArgs e)
{
dispatcherTimer?.Stop();
ep.Close();
endPage();
}
private void RadButton_Click(object sender, RoutedEventArgs e)
{
endPage();
}
}
}

View file

@ -198,9 +198,11 @@ namespace eDosStation
// cmd.Parameters.AddWithValue("TestCSN", TestCSN);
if (!string.IsNullOrEmpty(Reader))
cmd.Parameters.AddWithValue("@Reader", Reader);
cmd.Parameters.AddWithValue("Reader", Reader);
cmd.Parameters.AddWithValue("@checkUser", checkUser);
cmd.Parameters.AddWithValue("checkUser", checkUser);
cmd.Parameters.AddWithValue("useBeep", useBeep);
cmd.Parameters.AddWithValue("EPDTimeout", EPDTimeOut);
try
{