entry dispatchertimer
This commit is contained in:
parent
f35159a76c
commit
fd98494094
7 changed files with 30 additions and 23 deletions
|
|
@ -126,7 +126,7 @@ int EpdBase::Epd2U::Open(DWORD DeviceID)
|
|||
|
||||
void EpdBase::Epd2U::Close()
|
||||
{
|
||||
if (port > 0) CloseDevice();
|
||||
if (port > 0) CloseDevice();
|
||||
CurrentDeviceID = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ EpdBaseClr::Epd2::Epd2(int port)
|
|||
Hp07Name = gcnew String(tHp07);
|
||||
isTitleNG = false;
|
||||
}
|
||||
|
||||
EpdBaseClr::Epd2::~Epd2()
|
||||
{
|
||||
if (epd != nullptr) {
|
||||
|
|
@ -31,6 +32,7 @@ EpdBaseClr::Epd2::~Epd2()
|
|||
EpdBaseClr::Epd2::!Epd2()
|
||||
{
|
||||
}
|
||||
|
||||
int EpdBaseClr::Epd2::SetFeedbackSound(byte sound, UINT16 sound3)
|
||||
{
|
||||
epd->EndSessionControl = sound;
|
||||
|
|
@ -490,7 +492,6 @@ int EpdBaseClr::Epd2::ReadTresholds()
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
int EpdBaseClr::Epd2::AfterReadTresholds(EpdBase::Epd2U* epd)
|
||||
{
|
||||
int rv = 0;
|
||||
|
|
@ -738,16 +739,18 @@ int EpdBaseClr::Epd2::SwitchCon()
|
|||
int rv = 0;
|
||||
if (isMK3) {
|
||||
if (epd3->epdComsHandle == INVALID_HANDLE_VALUE) {
|
||||
epd->EndCom(); rv=epd3->StartCom();
|
||||
epd->EndCom();
|
||||
Sleep(100);
|
||||
rv=epd3->StartCom();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (epd->CommsInitialized == 0) {
|
||||
epd3->EndCom();
|
||||
Sleep(100);
|
||||
rv = epd->StartCom(); //0=ok
|
||||
if (!rv) rv = epd->Open(EpdID);
|
||||
if (!rv) rv = epd->ReadStatus();
|
||||
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -378,7 +378,13 @@ namespace eDosStation
|
|||
u.UserComment = dr["Comment"].ToString();
|
||||
if (tb.Columns.Contains("hasEPD"))
|
||||
u.hasEPD = (bool)dr["hasEPD"]; else u.hasEPD = false;
|
||||
|
||||
|
||||
if (u.hasEPD) u.ReasonNoAccess = "EPD in use";
|
||||
|
||||
u.activeVisit = dr["activeVisit"] as int?;
|
||||
|
||||
|
||||
u.AllOk = ( !CheckUser || (u.AccessAllow == true && u.VisitIDLocked == 0));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ namespace eDosStation
|
|||
UserSeconds = 10;
|
||||
//UserScreen
|
||||
string ReasonNoAccess = string.Empty;
|
||||
dispatcherTimer?.Stop();
|
||||
dispatcherTimer = null;
|
||||
if (_User.PersID == 0)
|
||||
{
|
||||
|
|
@ -398,7 +399,7 @@ namespace eDosStation
|
|||
if (_User.VisitIDLocked > 0 || _User.AccessAllow == false)
|
||||
ReasonNoAccess = _User.ReasonNoAccess;
|
||||
else if (_User.hasEPD)
|
||||
ReasonNoAccess = "User has epd in use";
|
||||
ReasonNoAccess = "EPD in use";
|
||||
else ReasonNoAccess = getCommentOnEvent(string.Empty, 3);
|
||||
}
|
||||
|
||||
|
|
@ -413,7 +414,6 @@ namespace eDosStation
|
|||
if (!string.IsNullOrWhiteSpace(ReasonNoAccess))
|
||||
UserAccess.Text = ReasonNoAccess;
|
||||
|
||||
|
||||
Username.Text = _User.FullUserName();
|
||||
string msg = string.Empty;
|
||||
if (!_User.HasMessage() && string.IsNullOrEmpty(ReasonNoAccess))
|
||||
|
|
@ -439,7 +439,6 @@ namespace eDosStation
|
|||
dispatcherTimer.Start();
|
||||
thisStation.splunkLog?.WriteSplunkLog(taskName, LSWLib.CLog.iseverity.info, "Timer");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ;
|
||||
|
|
@ -453,6 +452,7 @@ namespace eDosStation
|
|||
}
|
||||
else
|
||||
{
|
||||
dispatcherTimer?.Stop();
|
||||
dispatcherTimer = null;
|
||||
if (_User.AllOk == true && !_User.hasEPD) Dispatcher.InvokeAsync(AskTask, DispatcherPriority.Normal);
|
||||
else Dispatcher.InvokeAsync(() => {endPage(); });
|
||||
|
|
@ -487,6 +487,9 @@ namespace eDosStation
|
|||
}
|
||||
public void endPage()
|
||||
{
|
||||
|
||||
dispatcherTimer?.Stop();
|
||||
dispatcherTimer = null;
|
||||
this.Close();
|
||||
}
|
||||
private void bClose_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -627,9 +630,8 @@ namespace eDosStation
|
|||
{
|
||||
dispatcherTimer.Stop();
|
||||
dispatcherTimer.Tick -= SwitchToTask;
|
||||
if (_User.AllOk == true)
|
||||
AskTask();
|
||||
else Close();
|
||||
if (_User.AllOk == true && !_User.hasEPD) AskTask();
|
||||
else endPage();
|
||||
}
|
||||
private void TaskCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using System.Windows.Threading;
|
|||
|
||||
namespace eDosStation
|
||||
{
|
||||
|
||||
public partial class EpdExit : Window
|
||||
{
|
||||
DataInterface dataInterface;
|
||||
|
|
@ -45,7 +44,7 @@ namespace eDosStation
|
|||
Progress.Value = v;
|
||||
else
|
||||
{
|
||||
dispatcherTimer.Stop();
|
||||
dispatcherTimer?.Stop();
|
||||
endPage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ namespace eDosStation
|
|||
|
||||
public int Error = 0;
|
||||
public string ErrorMessage;
|
||||
|
||||
|
||||
internal int? activeVisit;
|
||||
|
||||
public string FullUserName()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ namespace syncEdosLocal
|
|||
static LSWLib.Bulker Bulker;
|
||||
static cResult Result;
|
||||
|
||||
|
||||
|
||||
public static int? CreateStationID (SqlConnection eDosLocalCon, SqlConnection eDosCon )
|
||||
{
|
||||
var c1 = eDosCon.State;
|
||||
|
|
@ -121,7 +119,7 @@ namespace syncEdosLocal
|
|||
if (c1 != ConnectionState.Open) eDosCon.Close();
|
||||
return StationID;
|
||||
}
|
||||
public static bool DoorloopToDo(System.Data.SqlClient.SqlConnection fromConnection, string toConstr, System.Data.SqlClient.SqlInfoMessageEventHandler im, ref bool error, ref bool warning, ref StringBuilder messages)
|
||||
public static bool DoorloopToDo(System.Data.SqlClient.SqlConnection fromConnection, string toConstr, System.Data.SqlClient.SqlInfoMessageEventHandler im, ref bool error, ref bool warning)
|
||||
{
|
||||
ds = new DataSet();
|
||||
DataTable dtTables = new DataTable("Tables");
|
||||
|
|
@ -133,7 +131,7 @@ namespace syncEdosLocal
|
|||
{
|
||||
spLog.KvClear();
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
spLog.kvAddCommand(spl.skeys.sqlQuery, cmd);
|
||||
spLog.KvAddCommand(spl.skeys.sqlQuery, cmd);
|
||||
using (var ncta = new System.Data.SqlClient.SqlDataAdapter(cmd))
|
||||
{
|
||||
try
|
||||
|
|
@ -246,7 +244,7 @@ namespace syncEdosLocal
|
|||
int cnt = 0;
|
||||
qry = LSWLib.SqlCommands.getColumnsQry(fromConnection, src);
|
||||
SqlConnection[] curDests = new SqlConnection[] { toConnection };
|
||||
cnt = Bulker.Execute(Task, fromConnection, curDests, qry, CommandType.Text, dest, 0, ref error, ref messages);
|
||||
cnt = Bulker.Execute(Task, fromConnection, curDests, qry, CommandType.Text, dest, 0, ref error);
|
||||
ucmd.Parameters["lastRecords"].Value = cnt;
|
||||
if (dest.Contains("PersonInfo"))
|
||||
Result.Persons = cnt;
|
||||
|
|
@ -258,7 +256,7 @@ namespace syncEdosLocal
|
|||
{
|
||||
cmd.CommandType = CommandType.Text;
|
||||
spLog.KvClear();
|
||||
spLog.kvAddCommand(spl.skeys.sqlQuery, cmd);
|
||||
spLog.KvAddCommand(spl.skeys.sqlQuery, cmd);
|
||||
try
|
||||
{
|
||||
spLog.SeverityReset();
|
||||
|
|
@ -288,7 +286,6 @@ namespace syncEdosLocal
|
|||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
spLog = new spl("SynceDosLocal");
|
||||
Bulker = new LSWLib.Bulker(spLog, true);
|
||||
messages = Bulker.messages;
|
||||
|
|
@ -317,6 +314,8 @@ namespace syncEdosLocal
|
|||
spLog.WriteSplunkLog("init", spLog.splunkSeverity, null, spLog.splunkError);
|
||||
messages.AppendLine($"Error reading reg key");
|
||||
}
|
||||
|
||||
|
||||
messages.AppendLine($"Remote {SourceCoStr.DataSource} db {SourceCoStr.InitialCatalog} Logon= { SourceCoStr.UserID} alias:{ reDos }");
|
||||
messages.AppendLine($"Local {LocalCoStr.DataSource} db {LocalCoStr.InitialCatalog} Logon= { LocalCoStr.UserID} alias:{ reDosLocal }");
|
||||
|
||||
|
|
@ -327,7 +326,6 @@ namespace syncEdosLocal
|
|||
{
|
||||
eDosLocalCon.Open();
|
||||
int? StationID = Bulker.SqlCommands.ExecProcScalar("Get Station ID", eDosLocalCon, "GetID_LocalStation", true, ref error) as int?;
|
||||
|
||||
if (!StationID.HasValue)
|
||||
{
|
||||
System.Console.WriteLine($"No stationID for this computer [{Environment.MachineName}]");
|
||||
|
|
@ -338,7 +336,7 @@ namespace syncEdosLocal
|
|||
using (System.Data.SqlClient.SqlConnection eDosCon = new SqlConnection(SourceCoStr.ConnectionString))
|
||||
{
|
||||
eDosCon.InfoMessage += Connection_InfoMessage;
|
||||
DoorloopToDo(eDosCon, LocalCoStr.ConnectionString, iMessage, ref error, ref warning, ref messages);
|
||||
DoorloopToDo(eDosCon, LocalCoStr.ConnectionString, iMessage, ref error, ref warning);
|
||||
DoorloopVisits(eDosLocalCon, eDosCon, Bulker.spLog, ref error);
|
||||
}
|
||||
Result.Write();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue