Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 55 additions & 11 deletions DVTk_Library/Assemblies/DVTk/Sessions/ScriptSession.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ------------------------------------------------------
// ------------------------------------------------------
// DVTk - The Healthcare Validation Toolkit (www.dvtk.org)
// Copyright © 2009 DVTk
// Copyright © 2009 DVTk
// ------------------------------------------------------
// This file is part of DVTk.
//
Expand Down Expand Up @@ -473,7 +473,7 @@ public interface IScriptExecution
/// - e.g., DICOMScript that makes an Association for CT Image Storage.
/// It is possible to repeat the DICOMScript execution a number of times using the<br></br>
/// <c>DO n dicomscript</c><br></br>
/// instruction where ‘n’ is the number of times that dicomscript is to be executed.
/// instruction where ‘n’ is the number of times that dicomscript is to be executed.
/// </p>
/// </remarks>
/// <param name="dicomScriptFileName">Script File of type DICOMScript (.DS) / DICOMSuperScript (.DSS)</param>
Expand Down Expand Up @@ -510,7 +510,7 @@ public interface IScriptExecution
System.Boolean TerminateConnection();
/// <summary>
/// Reset the state of the DULP Finite State Machine
/// (to allow new Associations – Presentation Context ID is reset to 1).
/// (to allow new Associations – Presentation Context ID is reset to 1).
/// </summary>
void ResetAssociation();
/// <summary>
Expand Down Expand Up @@ -683,8 +683,8 @@ public SendReturnCode Send(DicomMessage dicomMessage)

/// <summary>
/// <see cref="IDimseMessaging.Send(DicomMessage)"/>
/// With the new UPS SOP classes (Unified Procedure Step – Push SOP Class, Unified Procedure Step –
/// Watch SOP Class, Unified Procedure Step – Pull SOP Class, Unified Procedure Step – Event SOP Class),
/// With the new UPS SOP classes (Unified Procedure Step – Push SOP Class, Unified Procedure Step –
/// Watch SOP Class, Unified Procedure Step – Pull SOP Class, Unified Procedure Step – Event SOP Class),
/// fully specified in frozen supplement 96, it is now possible to send a DICOM message with an affected
/// or requested SOP Class UID attribute that is different from the abstract syntax UID in an accepted
/// presentation context.
Expand Down Expand Up @@ -1358,11 +1358,38 @@ static public void ConfirmInteractionAuto()
/// Results in a windows messagebox towards the user.
/// </summary>
/// <remarks>
/// The user needs to click the messagebox to continue the application.
/// The user can confirm to continue or reject to fail the current step.
/// </remarks>
static public void ConfirmInteractionForms()
{
System.Windows.Forms.MessageBox.Show("Click to continue.");
ConfirmInteractionForms("Continue this script step?");
}

/// <summary>
/// Stub callback implementation for <see cref="ConfirmInteractionCallBack"/>.
/// Results in a windows messagebox towards the user with a custom tester check instruction.
/// </summary>
/// <param name="testerCheckInstruction">Instruction describing what the tester should verify.</param>
static public void ConfirmInteractionForms(string testerCheckInstruction)
{
if (string.IsNullOrEmpty(testerCheckInstruction)) {
testerCheckInstruction = "Continue this script step?";
}

System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(
testerCheckInstruction,
"Confirm Step",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question,
System.Windows.Forms.MessageBoxDefaultButton.Button1);

if (result == System.Windows.Forms.DialogResult.No) {
throw new System.ApplicationException(
string.Format(
"Step rejected by tester input. Check: {0}",
testerCheckInstruction));
}

return;
}
/*delegated implementation*/
Expand Down Expand Up @@ -1443,10 +1470,27 @@ internal Confirmer(ScriptSession scriptSession)
#region Wrappers.IConfirmInteractionTarget
public void ConfirmInteraction()
{
// Call the delegate
this.m_parentSession.ConfirmInteraction();
try {
// Call the delegate.
this.m_parentSession.ConfirmInteraction();
}
catch (System.Exception ex) {
// Mark the step as failed, but keep the application running.
this.m_parentSession.WriteValidationError(ex.Message);
}
}

public void ConfirmInteraction(string checkText)
{
try {
ScriptSession.ConfirmInteractionForms(checkText);
}
catch (System.Exception ex) {
// Mark the step as failed, but keep the application running.
this.m_parentSession.WriteValidationError(ex.Message);
}
}
#endregion
}

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ------------------------------------------------------
// ------------------------------------------------------
// DVTk - The Healthcare Validation Toolkit (www.dvtk.org)
// Copyright © 2009 DVTk
// Copyright � 2009 DVTk
// ------------------------------------------------------
// This file is part of DVTk.
//
Expand Down Expand Up @@ -35,5 +35,13 @@ namespace Wrappers
{
// Translation from unmanaged -> managed CLR
m_pConfirmInteractionTarget->ConfirmInteraction();
}
}
}

void ConfirmInteractionAdapter::ConfirmInteraction(const char *checkText)
{
System::String^ managedText = (checkText != nullptr) ? gcnew System::String(checkText) : System::String::Empty;

// Translation from unmanaged -> managed CLR
m_pConfirmInteractionTarget->ConfirmInteraction(managedText);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ------------------------------------------------------
// ------------------------------------------------------
// DVTk - The Healthcare Validation Toolkit (www.dvtk.org)
// Copyright © 2009 DVTk
// Copyright � 2009 DVTk
// ------------------------------------------------------
// This file is part of DVTk.
//
Expand All @@ -27,6 +27,7 @@ namespace Wrappers
public interface class IConfirmInteractionTarget
{
void ConfirmInteraction();
void ConfirmInteraction(System::String^ checkText);
};

class ConfirmInteractionAdapter
Expand All @@ -39,8 +40,9 @@ namespace Wrappers
~ConfirmInteractionAdapter(void);

void ConfirmInteraction();
void ConfirmInteraction(const char *checkText);

private:
gcroot<IConfirmInteractionTarget^> m_pConfirmInteractionTarget;
};
}
}
13 changes: 12 additions & 1 deletion DVTk_Library/Libraries/Definition/definition_lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

%{
// Part of Dvtk Libraries - Internal Native Library Code
// Copyright © 2001-2006
// Copyright � 2001-2006
// Philips Medical Systems NL B.V., Agfa-Gevaert N.V.

#ifdef _WINDOWS
Expand Down Expand Up @@ -226,6 +226,17 @@ VALUE { RETURN(T_VALUE);}
RETURN(STRING);
}

INFO\([^\n]*\) {
if (yyleng >= sizeof(yylval.string))
{
yywarn("STRING too long!!! truncated") ;
yyleng = sizeof(yylval.string);
}
memcpy(yylval.string, yytext, yyleng);
yylval.string[yyleng] = '\0';
RETURN(STRING);
}


0(x|X)[0-9a-f]+ |
0(x|X)[0-9A-F]+ {
Expand Down
3 changes: 2 additions & 1 deletion DVTk_Library/Libraries/Log/base_confirmer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ------------------------------------------------------
// DVTk - The Healthcare Validation Toolkit (www.dvtk.org)
// Copyright © 2009 DVTk
// Copyright � 2009 DVTk
// ------------------------------------------------------
// This file is part of DVTk.
//
Expand Down Expand Up @@ -42,6 +42,7 @@ class BASE_CONFIRMER
{
public:
virtual void ConfirmInteraction() = 0;
virtual void ConfirmInteraction(const char *checkText) = 0;
public:
~BASE_CONFIRMER();
};
Expand Down
21 changes: 20 additions & 1 deletion DVTk_Library/Libraries/Scripting/script_parser.y
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%{
// Part of Dvtk Libraries - Internal Native Library Code
// Copyright © 2001-2006
// Copyright � 2001-2006
// Philips Medical Systems NL B.V., Agfa-Gevaert N.V.

//*****************************************************************************
Expand Down Expand Up @@ -428,6 +428,25 @@ ConfirmCommand : T_CONFIRM
}
}
}
| T_CONFIRM STRING
{
if (!scriptParseOnly)
{
LOG_CLASS *logger_ptr = scriptSession_ptr->getLogger();
BASE_CONFIRMER *confirmer_ptr = scriptSession_ptr->getConfirmer();

// ask user to confirm action through interaction with logger and confirmer
if ((logger_ptr) &&
(confirmer_ptr))
{
logger_ptr->text(LOG_SCRIPT, 2, "CONFIRM \"%s\"", $2);
confirmer_ptr->ConfirmInteraction($2);
}
}

// free malloced string buffer
free($2);
}
;

CopyCommand : T_COPY ObjectRef1 TagRef1 ObjectRef2 TagRef2
Expand Down
Loading
Loading