-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScript.cs
50 lines (44 loc) · 1.37 KB
/
Script.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using VMS.TPS.Common.Model.API;
using VMS.TPS.Common.Model.Types;
[assembly: ESAPIScript(IsWriteable = true)]
namespace VMS.TPS
{
public class Script
{
[MethodImpl(MethodImplOptions.NoInlining)]
public void Execute(ScriptContext scriptcontext)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
if (scriptcontext.ExternalPlanSetup == null)
{
MessageBox.Show("No plan is open.", "Error");
return;
}
int i = 0;
foreach (var beam in scriptcontext.ExternalPlanSetup.Beams)
{
if (!beam.IsSetupField & beam.MLC != null & beam.MLCPlanType != MLCPlanType.Static)
{
++i;
}
}
if (i < 1)
{
MessageBox.Show("Plan does not contain dynamic fields.", "Error");
return;
}
scriptcontext.Patient.BeginModifications();
FieldEditor.MainWindow mainWindow = new FieldEditor.MainWindow(scriptcontext);
mainWindow.ShowDialog();
}
}
}