OTX-Runtime for C++  
Runtime API Sample Program

The Sample program demonstrates the main functionality of the OTX-Runtime API. It can be used as a reference for the expected runtime behavior of the API and the source code below is like a reference guide about the proper programming of the API.

Code Example CPP-File

Code example (.\otxruntime\ReferenceApplication\src\Gui\SampleForm.cpp) of the OTX-Runtime API Sample Program.

1 #include "SampleForm.h"
2 using namespace OpenTestSystem::Otx::Runtime2::Api::Sample;
3 
4 #include "HmiWindow.h"
5 #include "LicenseForm.h"
6 #include "SampleConstants.h"
7 #include "Util/LicenseUtil.h"
8 #include "Util/Util.h"
9 #include "CallbackToAction.h"
10 #include "Setting/UserSettings.h"
11 #include "IpcTypes.h"
12 #include "Util/OtxDiagUtil.h"
13 
14 #include "OutputCustomImplementation/BasicScreenOutputImpl.h"
15 #include "OutputCustomImplementation/CommonDialogsOutputImpl.h"
16 #include "OutputCustomImplementation/ContextVariableOutputImpl.h"
17 #include "OutputCustomImplementation/CustomScreenOutputImpl.h"
18 #include "OutputCustomImplementation/ExternalServiceProviderOutputImpl.h"
19 #include "OutputCustomImplementation/I18nOutputImpl.h"
20 #include "OutputCustomImplementation/LoggingOutputImpl.h"
21 #include "OutputCustomImplementation/MeasureOutputImpl.h"
22 #include "OutputCustomImplementation/SqlOutputImpl.h"
23 #include "OutputCustomImplementation/StateVariableOutputImpl.h"
24 using namespace OpenTestSystem::Otx::Runtime2::Api::Sample::OutputCustomImplementation;
25 
26 #include <RuntimeManagerFactory.h>
27 #include <RuntimeConfig.h>
28 #include <License/LicenseManager.h>
29 #include <Project/IProject.h>
30 #include <Project/IPlayerProject.h>
31 #include <IRuntimeContext.h>
32 #include <DiagConnectionState.h>
33 #include <Otx/IProcedureParameter.h>
34 #include <Otx/IProcedureInOutParameter.h>
35 #include <Otx/IProcedureInParameter.h>
36 #include <Otx/IProcedureOutParameter.h>
37 #include <DataTypes/ValueConverter.h>
38 #include <Otx/IContextVariable.h>
39 #include <Otx/IStateVariable.h>
40 
41 #include <Custom/ICustomScreenImplementation.h>
42 #include <DefaultCustomScreenImplementation.h>
43 #include <WpfKeyEventArgs.h>
44 #include <FormKeyEventArgs.h>
45 #include <ContextVariableImplementation.h>
46 
47 #include <StateVariableImplementation.h>
48 #include <DefaultMeasureImplementation.h>
49 #include <DefaultExternalServiceProviderImplementation.h>
50 
51 #include <DataTypes/TranslationKey.h>
52 #include <DataTypes/EnumerationElement.h>
53 #include "Otx/Signature/IEnumerationSignature.h"
54 
55 #include <IOtxDiag.h>
56 #include <IDiagConfiguration.h>
57 
58 #include <msclr/auto_gcroot.h>
59 #include <msclr/lock.h>
60 #include <vector>
61 #include <map>
62 #include <memory>
63 
64 struct OpenTestSystem::Otx::Runtime2::Api::Sample::SampleFormImpl
65 {
66 public:
67  SampleFormImpl(msclr::auto_gcroot<SampleForm^> owner)
68  {
69  Owner = owner;
70 
71  _ProcedurePending = nullptr;
72  _ProcedureStarted = nullptr;
73  _ProcedurePaused = nullptr;
74  _ProcedureContinued = nullptr;
75  _ProcedureFinished = nullptr;
76  _ProcedureStopped = nullptr;
77  _ProcedureAborted = nullptr;
78  _ProcedureTimeout = nullptr;
79  _DiagConnectionStateChanged = nullptr;
80  _InOutParameterValueChanged = nullptr;
81 
82  _KeyDown = nullptr;
83  _ContextVariableRead = nullptr;
84 
85  CreatorForm = nullptr;
86  HmiWindow = nullptr;
87  WebServerTimer = nullptr;
88 
89  GlobalRuntimeManager = nullptr;
90  RuntimeContexts.clear();
91  LockRuntimeContexts = gcnew System::Object();
92  EventListenerLock = gcnew System::Object();
93  PrintTextLock = gcnew System::Object();
94 
95  RuntimeContextIdsExecutionStartTick.clear();
96 
97  ErrorProvider = nullptr;
98 
99  Project = nullptr;
100  PlayerProject = nullptr;
101  ProcedureToExecute = nullptr;
102 
103  StartUpNode = nullptr;
104 
105  ProcedureExecutionCount = 0;
106 
107  LastTime = System::DateTime::Now;
108 
109  Title = SampleConstants::MAIN_INSTANCE_NAME;
110 
111  UseConnectionState = false;
112 
113  IsPathChanging = false;
114 
115  IsLoadding = false;
116 
117  DefaultDiagPort = SampleConstants::DEFAULT_DM_PORT;
118  DefaultRuntimePort = SampleConstants::DEFAULT_RT_PORT;
119  DefaultDiagPipeName = SampleConstants::DEFAULT_DM_PIPE_NAME;
120  DefaultRuntimePipeName = SampleConstants::DEFAULT_RT_PIPE_NAME;
121 
122  IsStartWebSever = -1;
123  RuntimeContextName = "";
124  CyclicExecutionCount = 0;
125  CyclicExecuteAsyncIsProcessing = false;
126  ExpectedConnectionState = ExpectedState::None;
127 
128  KL15State = -1;
129 
130  CustomScreenImplementation = nullptr;
131  ContextVariableImplementation = nullptr;
132 
133  StateVariableImplementation = nullptr;
134  MeasureImplementation = nullptr;
135  ServiceProviderImplementation = nullptr;
136 
137  _BasicScreenOutputImpl = nullptr;
138  _CommonDialogsOutputImpl = nullptr;
139  _ContextVariableOutputImpl = nullptr;
140  _CustomScreenOutputImpl = nullptr;
141  _ServiceProviderOutputImpl = nullptr;
142  _I18nOutputImpl = nullptr;
143  _LoggingOutputImpl = nullptr;
144  _MeasureOutputImpl = nullptr;
145  _SqlOutputImpl = nullptr;
146  _StateVariableOutputImpl = nullptr;
147 
148  WebServerTimer = gcnew System::Windows::Forms::Timer();
149  ErrorProvider = gcnew System::Windows::Forms::ErrorProvider();
150  }
151 
152  static bool IsRegistered;
153  static std::string FileVersion;
154  static std::vector<msclr::auto_gcroot<SampleForm^>> ListForms;
155 
156  msclr::auto_gcroot<SampleForm^> CreatorForm;
157  msclr::auto_gcroot<HmiWindow^> HmiWindow;
158  msclr::auto_gcroot<System::Windows::Forms::Timer^> WebServerTimer;
159  msclr::auto_gcroot<System::DateTime^> LastTime;
160  std::shared_ptr<IRuntimeManager> GlobalRuntimeManager;
161  std::vector<OpenTestSystem::Otx::Runtime::Api::IRuntimeContext*> RuntimeContexts;
162  msclr::auto_gcroot<System::Object^> LockRuntimeContexts;
163  msclr::auto_gcroot<System::Object^> EventListenerLock;
164  msclr::auto_gcroot<System::Object^> PrintTextLock;
165  std::map<long long, long long> RuntimeContextIdsExecutionStartTick;
166  msclr::auto_gcroot<System::Windows::Forms::ErrorProvider^> ErrorProvider;
167 
168  std::shared_ptr<OpenTestSystem::Otx::Runtime::Api::Project::IProject> Project;
169  std::shared_ptr<OpenTestSystem::Otx::Runtime::Api::Project::IPlayerProject> PlayerProject;
170  std::shared_ptr<OpenTestSystem::Otx::Runtime::Api::Otx::IProcedure> ProcedureToExecute;
171 
172  msclr::auto_gcroot<System::Windows::Forms::TreeNode^> StartUpNode;
173 
174  long ProcedureExecutionCount;
175 
176  std::string Title;
177 
178  bool IsPathChanging;
179 
180  bool UseConnectionState;
181 
182  bool IsLoadding;
183 
184  int DefaultDiagPort;
185  int DefaultRuntimePort;
186  std::string DefaultDiagPipeName;
187  std::string DefaultRuntimePipeName;
188 
189  int IsStartWebSever;
190  std::string RuntimeContextName;
191  int CyclicExecutionCount;
192  bool CyclicExecuteAsyncIsProcessing;
193  ExpectedState ExpectedConnectionState;
194 
195 #pragma region C++ for RAW-mode
196  std::string IpcInitializedBefore;
197 #pragma endregion
198 
199 
200  int KL15State; // There are 3 states -1, 0 and 1 which correspond to NULL, false and true in C#
201 
202  std::shared_ptr<Custom::DefaultCustomScreenImplementation> CustomScreenImplementation;
203  std::shared_ptr<Custom::ContextVariableImplementation> ContextVariableImplementation;
204 
205  std::shared_ptr<Custom::StateVariableImplementation> StateVariableImplementation;
206  std::shared_ptr<Custom::DefaultMeasureImplementation> MeasureImplementation;
207  std::shared_ptr<Custom::DefaultExternalServiceProviderImplementation> ServiceProviderImplementation;
208 
209  std::shared_ptr<BasicScreenOutputImpl> _BasicScreenOutputImpl;
210  std::shared_ptr<CommonDialogsOutputImpl> _CommonDialogsOutputImpl;
211  std::shared_ptr<ContextVariableOutputImpl> _ContextVariableOutputImpl;
212  std::shared_ptr<CustomScreenOutputImpl> _CustomScreenOutputImpl;
213  std::shared_ptr<ExternalServiceProviderOutputImpl> _ServiceProviderOutputImpl;
214  std::shared_ptr<I18nOutputImpl> _I18nOutputImpl;
215  std::shared_ptr<LoggingOutputImpl> _LoggingOutputImpl;
216  std::shared_ptr<MeasureOutputImpl> _MeasureOutputImpl;
217  std::shared_ptr<SqlOutputImpl> _SqlOutputImpl;
218  std::shared_ptr<StateVariableOutputImpl> _StateVariableOutputImpl;
219 
220  const int VALUE_STRING_MAX_LENGTH = 1024;
221  const int FORM_OFFSET = 25;
222  const int DEFAULT_POLLING_TIME = 500;
223  const int DEFAULT_BATTERY_VOLTAGE_THRESHOLD = 6000;
224 
225  void InitializeRuntimeEvents(std::shared_ptr<IRuntimeManager> runtimeManager)
226  {
227  REFAPP_START_METHOD();
228  if (runtimeManager == nullptr)
229  {
230  REFAPP_END_METHOD();
231  return;
232  }
233 
234  RemoveRuntimeEvents(runtimeManager);
235 
236  _ProcedurePending = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedurePending, this, std::placeholders::_1));
237  _ProcedureStarted = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureStarted, this, std::placeholders::_1));
238  _ProcedurePaused = std::make_shared<std::function<void(const IRuntimeContext&, ExecutionStateChangeReason)>>(std::bind(&SampleFormImpl::ProcedurePaused, this, std::placeholders::_1, std::placeholders::_2));
239  _ProcedureContinued = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureContinued, this, std::placeholders::_1));
240  _ProcedureFinished = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureFinished, this, std::placeholders::_1));
241  _ProcedureStopped = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureStopped, this, std::placeholders::_1));
242  _ProcedureAborted = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureAborted, this, std::placeholders::_1));
243  _ProcedureTimeout = std::make_shared<std::function<void(const IRuntimeContext&)>>(std::bind(&SampleFormImpl::ProcedureTimeout, this, std::placeholders::_1));
244  _DiagConnectionStateChanged = std::make_shared<std::function<void(ClampState, ClampState)>>(std::bind(&SampleFormImpl::DiagConnectionStateChanged, this, std::placeholders::_1, std::placeholders::_2));
245  _InOutParameterValueChanged = std::make_shared<std::function<void(const IRuntimeContext&, const IProcedureInOutParameter&)>>(std::bind(&SampleFormImpl::InOutParameterValueChanged, this, std::placeholders::_1, std::placeholders::_2));
246 
247  runtimeManager->AddProcedurePendingListener(_ProcedurePending);
248  runtimeManager->AddProcedureStartedListener(_ProcedureStarted);
249  runtimeManager->AddProcedurePausedListener(_ProcedurePaused);
250  runtimeManager->AddProcedureContinuedListener(_ProcedureContinued);
251  runtimeManager->AddProcedureFinishedListener(_ProcedureFinished);
252  runtimeManager->AddProcedureStoppedListener(_ProcedureStopped);
253  runtimeManager->AddProcedureAbortedListener(_ProcedureAborted);
254  runtimeManager->AddProcedureTimeoutListener(_ProcedureTimeout);
255  runtimeManager->AddDiagConnectionStateChangedListener(_DiagConnectionStateChanged);
256  runtimeManager->AddInOutParameterValueChangedListener(_InOutParameterValueChanged);
257  REFAPP_END_METHOD();
258  }
259 
260  void RemoveRuntimeEvents(std::shared_ptr<IRuntimeManager> runtimeManager)
261  {
262  REFAPP_START_METHOD();
263  if (_ProcedurePending != nullptr)
264  {
265  runtimeManager->RemoveProcedurePendingListener(_ProcedurePending);
266  }
267 
268  if (_ProcedureStarted != nullptr)
269  {
270  runtimeManager->RemoveProcedureStartedListener(_ProcedureStarted);
271  }
272 
273  if (_ProcedurePaused != nullptr)
274  {
275  runtimeManager->RemoveProcedurePausedListener(_ProcedurePaused);
276  }
277 
278  if (_ProcedureContinued != nullptr)
279  {
280  runtimeManager->RemoveProcedureContinuedListener(_ProcedureContinued);
281  }
282 
283  if (_ProcedureFinished != nullptr)
284  {
285  runtimeManager->RemoveProcedureFinishedListener(_ProcedureFinished);
286  }
287 
288  if (_ProcedureStopped != nullptr)
289  {
290  runtimeManager->RemoveProcedureStoppedListener(_ProcedureStopped);
291  }
292 
293  if (_ProcedureAborted != nullptr)
294  {
295  runtimeManager->RemoveProcedureAbortedListener(_ProcedureAborted);
296  }
297 
298  if (_ProcedureTimeout != nullptr)
299  {
300  runtimeManager->RemoveProcedureTimeoutListener(_ProcedureTimeout);
301  }
302 
303  if (_DiagConnectionStateChanged != nullptr)
304  {
305  runtimeManager->RemoveDiagConnectionStateChangedListener(_DiagConnectionStateChanged);
306  }
307 
308  if (_InOutParameterValueChanged != nullptr)
309  {
310  runtimeManager->RemoveInOutParameterValueChangedListener(_InOutParameterValueChanged);
311  }
312  REFAPP_END_METHOD();
313  }
314 
315  void ProcedurePending(const IRuntimeContext& context)
316  {
317  Owner->ProcedurePendingCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
318  }
319 
320  void ProcedureStarted(const IRuntimeContext& context)
321  {
322  Owner->ProcedureStartedCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
323  }
324 
325  void ProcedurePaused(const IRuntimeContext& context, ExecutionStateChangeReason reason)
326  {
327  IRuntimeContext* pContext = const_cast<IRuntimeContext*>(&context);
328  Owner->ProcedurePaused(pContext, reason);
329  }
330 
331  void ProcedureContinued(const IRuntimeContext& context)
332  {
333  Owner->ProcedureContinuedCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
334  }
335 
336  void ProcedureFinished(const IRuntimeContext& context)
337  {
338  Owner->ProcedureFinishedCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
339  }
340 
341  void ProcedureStopped(const IRuntimeContext& context)
342  {
343  Owner->ProcedureStoppedCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
344  }
345 
346  void ProcedureAborted(const IRuntimeContext& context)
347  {
348  Owner->ProcedureAbortedCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
349  }
350 
351  void ProcedureTimeout(const IRuntimeContext& context)
352  {
353  Owner->ProcedureTimeoutCallback(gcnew CLRWrapper<IRuntimeContext*>(const_cast<IRuntimeContext*>(&context)));
354  }
355 
356  void DiagConnectionStateChanged(ClampState batteryState, ClampState ignitionState)
357  {
358  Owner->DiagConnectionStateChanged(batteryState, ignitionState);
359  }
360 
361  void InOutParameterValueChanged(const IRuntimeContext& context, const IProcedureInOutParameter& parameter)
362  {
363  REFAPP_START_METHOD();
364  IRuntimeContext* pContext = const_cast<IRuntimeContext*>(&context);
365  IProcedureInOutParameter* pParameter = const_cast<IProcedureInOutParameter*>(&parameter);
366  Owner->InOutParameterValueChanged(pContext, pParameter);
367  REFAPP_END_METHOD();
368  }
369 
370  void SetDefaultCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
371  {
372  REFAPP_START_METHOD();
373  if (runtimeManager == nullptr)
374  {
375  REFAPP_END_METHOD();
376  return;
377  }
378 
379  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IBasicScreenImplementation>)nullptr);
380  runtimeManager->SetCustomImplementation(CustomScreenImplementation);
381  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ILoggingImplementation>)nullptr);
382  runtimeManager->SetCustomImplementation(ContextVariableImplementation);
383 
384  runtimeManager->SetCustomImplementation(StateVariableImplementation);
385  runtimeManager->SetCustomImplementation(MeasureImplementation);
386  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::Ii18nImplementation>)nullptr);
387  runtimeManager->SetCustomImplementation(ServiceProviderImplementation);
388 
389  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ISqlImplementation>)nullptr);
390  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ICommonDialogsImplementation>)nullptr);
391  REFAPP_END_METHOD();
392  }
393 
394  void RemoveCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
395  {
396  REFAPP_START_METHOD();
397  if (runtimeManager == nullptr)
398  {
399  REFAPP_END_METHOD();
400  return;
401  }
402 
403  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IBasicScreenImplementation>)nullptr);
404  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ICustomScreenImplementation>)nullptr);
405  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ICommonDialogsImplementation>)nullptr);
406  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IContextVariableImplementation>)nullptr);
407  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IExternalServiceProviderImplementation>)nullptr);
408  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::Ii18nImplementation>)nullptr);
409  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ILoggingImplementation>)nullptr);
410  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IMeasureImplementation>)nullptr);
411  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::ISqlImplementation>)nullptr);
412  runtimeManager->SetCustomImplementation((std::shared_ptr<Custom::IStateVariableImplementation>)nullptr);
413  REFAPP_END_METHOD();
414  }
415 
416  void ClearCustomImplemetationCaches()
417  {
418  REFAPP_START_METHOD();
419  if (IS_NOT_NULL(ContextVariableImplementation))
420  {
421  ContextVariableImplementation->ResetAllValues();
422  }
423 
424  if (IS_NOT_NULL(_ContextVariableOutputImpl))
425  {
426  _ContextVariableOutputImpl->ResetAllValues();
427  }
428 
429  if (IS_NOT_NULL(StateVariableImplementation))
430  {
431  StateVariableImplementation->ResetAllValues();
432  }
433 
434  //TODO: if (StateVariableOutputImpl != null)
435  REFAPP_END_METHOD();
436  }
437 
438  void CreateDefaultCustomImpl()
439  {
440  REFAPP_START_METHOD();
441  CustomScreenImplementation = std::make_shared<Custom::DefaultCustomScreenImplementation>();
442  _KeyDown = std::make_shared<std::function<void(std::shared_ptr<Custom::KeyEventArgs>)>>(std::bind(&SampleFormImpl::CustomScreenImplementation_KeyDown, this, std::placeholders::_1));
443  CustomScreenImplementation->AddKeyDownListener(_KeyDown);
444 
445  ContextVariableImplementation = std::make_shared<Custom::ContextVariableImplementation>();
446  _ContextVariableRead = std::make_shared<std::function<void(std::shared_ptr<IContextVariable>, std::shared_ptr<DataTypes::Object>)>>(std::bind(&SampleFormImpl::ContextVariableRead, this, std::placeholders::_1, std::placeholders::_2));
447  ContextVariableImplementation->SetContextVariableReadHandler(_ContextVariableRead);
448 
449  StateVariableImplementation = std::make_shared<Custom::StateVariableImplementation>();
450  _StateVariableValueChanged = std::make_shared<std::function<void(std::shared_ptr<IStateVariable>, std::shared_ptr<DataTypes::Object>)>>(std::bind(&SampleFormImpl::StateVariableValueChanged, this, std::placeholders::_1, std::placeholders::_2));
451  StateVariableImplementation->SetStateVariableValueChangedHandler(_StateVariableValueChanged);
452 
453  MeasureImplementation = std::make_shared<Custom::DefaultMeasureImplementation>();
454  ServiceProviderImplementation = std::make_shared<Custom::DefaultExternalServiceProviderImplementation>();
455  REFAPP_END_METHOD();
456  }
457 
458  void CustomScreenImplementation_KeyDown(std::shared_ptr<Custom::KeyEventArgs> eventArgs)
459  {
460  Owner->CustomScreenImplementation_KeyDown(eventArgs);
461  }
462 
463  void ContextVariableRead(std::shared_ptr<IContextVariable> contextVariable, std::shared_ptr<DataTypes::Object> value)
464  {
465  Owner->ContextVariableRead(contextVariable, value);
466  }
467 
468  void StateVariableValueChanged(std::shared_ptr<IStateVariable> stateVariable, std::shared_ptr<DataTypes::Object> value)
469  {
470  Owner->StateVariableValueChanged(stateVariable, value);
471  }
472 
473  void CreateOutputWindowCustomImpl()
474  {
475  REFAPP_START_METHOD();
476  _BasicScreenOutputImpl = std::make_shared<BasicScreenOutputImpl>();
477  _CustomScreenOutputImpl = std::make_shared<CustomScreenOutputImpl>();
478  _LoggingOutputImpl = std::make_shared<LoggingOutputImpl>();
479  _ContextVariableOutputImpl = std::make_shared<ContextVariableOutputImpl>();
480 
481  _StateVariableOutputImpl = std::make_shared<StateVariableOutputImpl>();
482  _MeasureOutputImpl = std::make_shared<MeasureOutputImpl>();
483  _I18nOutputImpl = std::make_shared<I18nOutputImpl>();
484  _ServiceProviderOutputImpl = std::make_shared<ExternalServiceProviderOutputImpl>();
485 
486  _CommonDialogsOutputImpl = std::make_shared<CommonDialogsOutputImpl>();
487  _SqlOutputImpl = std::make_shared<SqlOutputImpl>();
488 
489  _BasicScreenOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
490  _CustomScreenOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
491  _LoggingOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
492  _ContextVariableOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
493 
494  _StateVariableOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
495  _MeasureOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
496  _I18nOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
497  _ServiceProviderOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
498 
499  _CommonDialogsOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
500  _SqlOutputImpl->_logEventHandler = std::make_shared<std::function<void(const std::string&)>>(std::bind(&SampleFormImpl::WriteLogEvent, this, std::placeholders::_1));
501  REFAPP_END_METHOD();
502  }
503 
504  void RemoveOutputImplLogEventHandler()
505  {
506  REFAPP_START_METHOD();
507  if (_BasicScreenOutputImpl != nullptr)
508  _BasicScreenOutputImpl->_logEventHandler = nullptr;
509  if (_CustomScreenOutputImpl != nullptr)
510  _CustomScreenOutputImpl->_logEventHandler = nullptr;
511  if (_LoggingOutputImpl != nullptr)
512  _LoggingOutputImpl->_logEventHandler = nullptr;
513  if (_ContextVariableOutputImpl != nullptr)
514  _ContextVariableOutputImpl->_logEventHandler = nullptr;
515 
516  if (_StateVariableOutputImpl != nullptr)
517  _StateVariableOutputImpl->_logEventHandler = nullptr;
518  if (_MeasureOutputImpl != nullptr)
519  _MeasureOutputImpl->_logEventHandler = nullptr;
520  if (_I18nOutputImpl != nullptr)
521  _I18nOutputImpl->_logEventHandler = nullptr;
522  if (_ServiceProviderOutputImpl != nullptr)
523  _ServiceProviderOutputImpl->_logEventHandler = nullptr;
524 
525  if (_CommonDialogsOutputImpl != nullptr)
526  _CommonDialogsOutputImpl->_logEventHandler = nullptr;
527  if (_SqlOutputImpl != nullptr)
528  _SqlOutputImpl->_logEventHandler = nullptr;
529 
530  _BasicScreenOutputImpl = nullptr;
531  _CustomScreenOutputImpl = nullptr;
532  _LoggingOutputImpl = nullptr;
533  _ContextVariableOutputImpl = nullptr;
534 
535  _StateVariableOutputImpl = nullptr;
536  _MeasureOutputImpl = nullptr;
537  _I18nOutputImpl = nullptr;
538  _ServiceProviderOutputImpl = nullptr;
539 
540  _CommonDialogsOutputImpl = nullptr;
541  _SqlOutputImpl = nullptr;
542  REFAPP_END_METHOD();
543  }
544 
545  void WriteLogEvent(const std::string& text)
546  {
547  Owner->PrintTextCallback(Util::Util::ToString(text));
548  }
549 
550  void SetOutputWindowImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
551  {
552  REFAPP_START_METHOD();
553  if (runtimeManager == nullptr)
554  {
555  return;
556  }
557 
558  runtimeManager->SetCustomImplementation(_BasicScreenOutputImpl);
559  runtimeManager->SetCustomImplementation(_CommonDialogsOutputImpl);
560  runtimeManager->SetCustomImplementation(_ContextVariableOutputImpl);
561  runtimeManager->SetCustomImplementation(_CustomScreenOutputImpl);
562  runtimeManager->SetCustomImplementation(_ServiceProviderOutputImpl);
563  runtimeManager->SetCustomImplementation(_I18nOutputImpl);
564  runtimeManager->SetCustomImplementation(_LoggingOutputImpl);
565  runtimeManager->SetCustomImplementation(_MeasureOutputImpl);
566  runtimeManager->SetCustomImplementation(_SqlOutputImpl);
567  runtimeManager->SetCustomImplementation(_StateVariableOutputImpl);
568  REFAPP_END_METHOD();
569  }
570 
571 private:
572  msclr::auto_gcroot<SampleForm^> Owner;
573  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedurePending;
574  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureStarted;
575  std::shared_ptr<std::function<void(const IRuntimeContext&, ExecutionStateChangeReason)>> _ProcedurePaused;
576  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureContinued;
577  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureFinished;
578  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureStopped;
579  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureAborted;
580  std::shared_ptr<std::function<void(const IRuntimeContext&)>> _ProcedureTimeout;
581  std::shared_ptr<std::function<void(ClampState, ClampState)>> _DiagConnectionStateChanged;
582  std::shared_ptr<std::function<void(const IRuntimeContext&, const IProcedureInOutParameter&)>> _InOutParameterValueChanged;
583 
584  std::shared_ptr<std::function<void(std::shared_ptr<Custom::KeyEventArgs>)>> _KeyDown;
585  std::shared_ptr<std::function<void(std::shared_ptr<IContextVariable>, std::shared_ptr<DataTypes::Object>)>> _ContextVariableRead;
586  std::shared_ptr<std::function<void(std::shared_ptr<IStateVariable>, std::shared_ptr<DataTypes::Object>)>> _StateVariableValueChanged;
587 };
588 
589 bool SampleFormImpl::IsRegistered = false;
590 std::string SampleFormImpl::FileVersion = "";
591 std::vector<msclr::auto_gcroot<SampleForm^>> SampleFormImpl::ListForms;
592 
593 void SampleForm::RegisterSettingsEvent()
594 {
595  REFAPP_START_METHOD();
596  if (!SampleFormImpl::IsRegistered)
597  {
598  SampleFormImpl::IsRegistered = true;
599 
600  SampleFormImpl::FileVersion = RuntimeConfig::GetInstance().GetVersion();
601  // Reason: See #15223. Only implement at Sample Dotnet
602  //String^ licenseKeyFromOTForOTPLicense = OpenTestSystem::Common::LicensingV5::Util::CreateLicenseKeyFromOTForOTPLicense();
603  System::String^ licenseKeyFromOTForOTPLicense;
604  // isAcceptEmptyLicenseValue = licenseKeyFromOTForOTPLicense.Equals("") ? false : true;
605 
606  if (!System::String::IsNullOrEmpty(licenseKeyFromOTForOTPLicense) && Util::LicenseUtil::CheckLicenseFormat(Util::Util::ToString(licenseKeyFromOTForOTPLicense)))
607  {
608  OpenTestSystem::Otx::Runtime::Api::License::LicenseManager::SetLicenseKey(Util::Util::ToString(licenseKeyFromOTForOTPLicense));
609  }
610  else
611  {
612  std::string licenseKey = Setting::UserSettings::GetInstance().GetLicenseKey();
613  licenseKey = Util::LicenseUtil::Decrypt(licenseKey);
614  if (Util::LicenseUtil::CheckLicenseFormat(licenseKey))
615  {
617  }
618  else
619  {
620  System::Windows::Forms::MessageBox::Show("There is an invalid license key format. Please set your new key in license box.", "Warning!", System::Windows::Forms::MessageBoxButtons::OK, System::Windows::Forms::MessageBoxIcon::Warning);
621  }
622  }
623 
624  Microsoft::Win32::SystemEvents::DisplaySettingsChanged += gcnew System::EventHandler(this, &OpenTestSystem::Otx::Runtime2::Api::Sample::SampleForm::SystemEvents_DisplaySettingsChanged);
625  }
626  REFAPP_END_METHOD();
627 }
628 
629 void SampleForm::SystemEvents_DisplaySettingsChanged(System::Object^ sender, System::EventArgs^ e)
630 {
631  REFAPP_START_METHOD();
632  try
633  {
634  for (int i = 0; i < SampleFormImpl::ListForms.size(); i++)
635  {
636  msclr::auto_gcroot<SampleForm^> frm = SampleFormImpl::ListForms.at(i);
637  try
638  {
639  if (frm.get()->InvokeRequired)
640  {
641  frm.get()->Invoke(gcnew System::Action(frm.get(), &SampleForm::Refresh));
642  }
643  else
644  {
645  frm.get()->Refresh();
646  }
647  }
648  catch (...) {}
649  }
650  }
651  catch (...) {}
652  REFAPP_END_METHOD();
653 }
654 
655 void SampleForm::InitializeInternalComponent()
656 {
657  REFAPP_START_METHOD();
658  piml = new SampleFormImpl(this);
659  RegisterSettingsEvent();
660  REFAPP_END_METHOD();
661 }
662 
663 SampleForm::SampleForm(System::String^ title, SampleForm^ creatorForm)
664 {
665  REFAPP_START_METHOD();
666  ShowInTaskbar = false;
667  InitializeInternalComponent();
668 
669  piml->Title = System::String::IsNullOrEmpty(title) ? SampleConstants::MAIN_INSTANCE_NAME : Util::Util::ToString(title);
670  piml->CreatorForm = creatorForm;
671 
672  piml->WebServerTimer->Interval = 1000;
673  piml->WebServerTimer->Enabled = true;
674  piml->WebServerTimer->Tick += gcnew System::EventHandler(this, &SampleForm::WebServerTimer_Tick);
675 
676  InitializeComponent();
677 
678  piml->ListForms.push_back(this);
679 
680  PrintTextCallback("Application started");
681  REFAPP_END_METHOD();
682 }
683 
684 System::Void SampleForm::SampleForm_Load(System::Object^ sender, System::EventArgs^ e)
685 {
686  REFAPP_START_METHOD();
687  Visible = false;
688  PrintTextCallback("Start Initialization...");
689 
690  CreateCustomImpl();
691  InitializeSampleDefaultValues();
692  UpdateWebServerButtonCallback();
693 
694  if (IS_NOT_NULL(piml->CreatorForm))
695  {
696  checkBoxStartAllParents->Visible = true;
697  checkBoxStartAllParents->Checked = piml->CreatorForm->checkBoxStartAllParents->Checked;
698  }
699 
700  SetRuntimeContextName();
701  SetTitle(Util::Util::ToString(piml->Title));
702  SetLocation(piml->CreatorForm.get());
703 
704  toolTip1->SetToolTip(labelProcedureExecutionTimes, "Total procedure execution time.");
705  toolTip1->SetToolTip(textBoxTimeout, "Timeout for procedure execution in milliseconds. The default value 0 means without timeout.");
706  toolTip1->SetToolTip(checkBoxUseConnectionState, "Use expected connection state during procedure execution.");
707  toolTip1->SetToolTip(labelBatteryState, "State of the battery (KL 30)");
708  toolTip1->SetToolTip(checkBoxIgnition, "Expected ignition (KL 15) state during procedure execution");
709  toolTip1->SetToolTip(labelIgnitionState, "State of the ignition (KL 15)");
710  toolTip1->SetToolTip(buttonCheckBatteryIgnition, "Check current battery (KL30) and ignition (KL15) state.");
711  toolTip1->SetToolTip(textBoxPollingTime, "Time in milliseconds between the next check of the connection state during the procedure execution (Polling). The default value is 500 ms.");
712  toolTip1->SetToolTip(textBoxVoltageThreshold, "Voltage threshold in millivolt from which the battery voltage, see GetBatteryVoltage is enough for KL30 = On. The default value is 6000 mV.");
713 
714  LoadContextFile(piml->GlobalRuntimeManager);
715 
716  PrintTextCallback("... Initialization finished.");
717  ShowInTaskbar = true;
718 #pragma region Only Cpp: See issue 15942 - bug 7
719  WindowState = System::Windows::Forms::FormWindowState::Normal;
720 #pragma endregion
721  REFAPP_END_METHOD();
722 }
723 
724 System::Void SampleForm::SampleForm_Shown(System::Object^ sender, System::EventArgs^ e)
725 {
726  cbFilePath->SelectionLength = 0;
727  Visible = true;
728 }
729 
730 void SampleForm::SetRuntimeContextName()
731 {
732  REFAPP_START_METHOD();
733  if (IS_NOT_NULL(piml->CreatorForm) && !System::String::IsNullOrEmpty(Util::Util::ToString(piml->CreatorForm->piml->RuntimeContextName)))
734  {
735  System::String^ contextName = Util::Util::ToString(piml->CreatorForm->piml->RuntimeContextName);
736  System::Text::RegularExpressions::Match^ regExpMatch = System::Text::RegularExpressions::Regex::Match(contextName, "\d*$");
737  int number;
738  if (System::Int32::TryParse(regExpMatch->Value, number))
739  {
740  number++;
741 
742  if (Util::Util::IsInstance<System::Windows::Forms::TextBox^>(textBoxRuntimeContextName))
743  {
744  textBoxRuntimeContextName->Text = Util::Util::ToString(piml->CreatorForm->piml->RuntimeContextName.substr(0, regExpMatch->Index) + std::to_string(number));
745  }
746  }
747  }
748  REFAPP_END_METHOD();
749 }
750 
751 void SampleForm::SetTitle(System::String^ title)
752 {
753  REFAPP_START_METHOD();
754  if (System::String::IsNullOrWhiteSpace(title))
755  {
756  title = Util::Util::ToString(SampleConstants::MAIN_INSTANCE_NAME);
757  }
758 
759  bool runningAsAdmin = System::Security::Principal::WindowsIdentity::GetCurrent()->Owner->IsWellKnown(System::Security::Principal::WellKnownSidType::BuiltinAdministratorsSid);
760 
761  Text = System::String::Format(
762  "emotive OTX-Runtime API for Cpp - Reference Application - Version {0} - {1} Bit - {2} - Thread-ID {3}{4}",
763  Util::Util::ToString(piml->FileVersion),
764  System::Environment::Is64BitProcess ? "64" : "32",
765  Util::Util::ToString(piml->Title),
766  System::Threading::Thread::CurrentThread->ManagedThreadId,
767  runningAsAdmin ? " - Administrator" : System::String::Empty
768  );
769 
770  if (Util::Util::IsInstance<System::Windows::Forms::ComboBox^>(cbFilePath) && !System::String::IsNullOrEmpty(cbFilePath->Text))
771  {
772  Text = Text + " - " + System::IO::Path::GetFileName(cbFilePath->Text);
773  }
774 
775  System::String^ runtimeContextNameCliStr = Util::Util::ToString(piml->RuntimeContextName);
776  if (!System::String::IsNullOrEmpty(runtimeContextNameCliStr))
777  {
778  Text = Text + " - " + runtimeContextNameCliStr;
779  }
780  REFAPP_END_METHOD();
781 }
782 
783 void SampleForm::SetLocation(SampleForm^ creatorForm)
784 {
785  REFAPP_START_METHOD();
786  if (creatorForm != nullptr)
787  {
788  int xOffset = piml->FORM_OFFSET;
789  int yOffset = piml->FORM_OFFSET;
790 
791  if (IS_NOT_NULL(creatorForm->piml->CreatorForm))
792  {
793  xOffset = creatorForm->Location.X - creatorForm->piml->CreatorForm->Location.X;
794  yOffset = creatorForm->Location.Y - creatorForm->piml->CreatorForm->Location.Y;
795  }
796 
797  Location = Point(creatorForm->Location.X + xOffset, creatorForm->Location.Y + yOffset);
798  Size = creatorForm->Size;
799  }
800  REFAPP_END_METHOD();
801 }
802 
803 void SampleForm::CreateCustomImpl()
804 {
805  REFAPP_START_METHOD();
806  CreateDefaultCustomImpl();
807  CreateOutputWindowCustomImpl();
808  REFAPP_END_METHOD();
809 }
810 
811 void SampleForm::CreateDefaultCustomImpl()
812 {
813  REFAPP_START_METHOD();
814  PrintTextCallback("Create default custom implementation");
815 
816  piml->CreateDefaultCustomImpl();
817  REFAPP_END_METHOD();
818 }
819 
820 void SampleForm::CreateOutputWindowCustomImpl()
821 {
822  REFAPP_START_METHOD();
823  PrintTextCallback("Create output window custom implementation");
824 
825  piml->CreateOutputWindowCustomImpl();
826  REFAPP_END_METHOD();
827 }
828 
829 void SampleForm::InitializeSampleDefaultValues()
830 {
831  REFAPP_START_METHOD();
832  PrintTextCallback("Initialize default values");
833 
834  comboBoxTraceLevel->Items->AddRange(Util::Util::ArrayTraceLevels2String());
835 
836  // Avoid changing order
837  treeViewOtxProject->ImageList = imageList1;
838 
839  textBoxRtPortPipe->Name = Util::Util::ToString(SampleConstants::RT_PORT_PIPE_TEXT_BOX_NAME);
840  textBoxDiagPortPipe->Name = Util::Util::ToString(SampleConstants::DM_PORT_PIPE_TEXT_BOX_NAME);
841 
842  LoadSetting();
843 
844  EnableConnectionState();
845  REFAPP_END_METHOD();
846 }
847 
848 void SampleForm::LoadSetting()
849 {
850  REFAPP_START_METHOD();
851  Setting::UserSettings::GetInstance().Reload();
852  try
853  {
854  SetupTraceLevel();
855  SetupTraceFolder();
856  SetupTraceFileProfilerMaxCountAndSize();
857 
858  // Avoid changing order of the time
859  SetupDefaultPortAndPipeName();
860 
861  cbFilePath->Text = Util::Util::ToString(Setting::UserSettings::GetInstance().GetPtxPpxDirectory());
862  if (!Setting::UserSettings::GetInstance().GetPtxPpxDirectoryList().empty())
863  {
864  cbFilePath->Items->AddRange(Util::Util::ToString(Setting::UserSettings::GetInstance().GetPtxPpxDirectoryList())->Split(';'));
865  }
866  AddComboBoxFileOrPath(cbFilePath);
867 
868  SetupCustomImplType();
869  SetupWindowSize();
870  SetupWindowLocation();
871 
872  checkBoxAsyncExecution->Checked = Setting::UserSettings::GetInstance().GetAsynchron();
873  checkBoxCyclicExecution->Checked = Setting::UserSettings::GetInstance().GetCyclic();
874  checkBoxCyclicReload->Checked = Setting::UserSettings::GetInstance().GetCyclicReload();
875  checkBoxNewRuntimeManager->Checked = Setting::UserSettings::GetInstance().GetNewRuntimeManager();
876  checkBoxAdd2Output->Checked = Setting::UserSettings::GetInstance().GetAddMessageToOutput();
877  checkBoxStartAllParents->Checked = Setting::UserSettings::GetInstance().GetStartAllParents();
878 
879  SetupTimeOut();
880  checkBoxUseConnectionState->Checked = Setting::UserSettings::GetInstance().GetConnectionState();
881  checkBoxIgnition->CheckState = Setting::UserSettings::GetInstance().GetIgnition() == 1 ? System::Windows::Forms::CheckState::Checked
882  : (Setting::UserSettings::GetInstance().GetIgnition() == 0 ? System::Windows::Forms::CheckState::Unchecked
883  : System::Windows::Forms::CheckState::Indeterminate);
884  SetupPollingTime();
885  SetupVoltageThreshold();
886 
887  textBoxRuntimeContextName->Text = Util::Util::ToString(Setting::UserSettings::GetInstance().GetRuntimeContextName());
888 
889 #pragma region C++ for RAW-Mode
890  textBoxDiagManagerLicenseKey->Text = Util::Util::ToString(Util::LicenseUtil::Decrypt(Setting::UserSettings::GetInstance().GetDiagManagerLicenseKey()));
891  checkBoxIncludedDiagLogging->Checked = Setting::UserSettings::GetInstance().GetIncludeTraceDiagLogging();
892 
893  std::string traceFolder = Setting::UserSettings::GetInstance().GetDiagTraceDirectory();
894  textBoxDiagManagerTraceFolder->Text = Util::Util::ToString(traceFolder.empty() ? Util::OtxDiagUtil::GetPathLoggerDefault() : traceFolder);
895 #pragma endregion
896 
897  }
898  catch (const std::exception& e)
899  {
900  PrintTextCallback(Util::Util::ToString(e.what()));
901  Setting::UserSettings::GetInstance().Reset();
902  }
903  catch (System::Exception^ e)
904  {
905  PrintTextCallback(e->Message);
906  Setting::UserSettings::GetInstance().Reset();
907  }
908  REFAPP_END_METHOD();
909 }
910 
911 void SampleForm::AddComboBoxFileOrPath(System::Windows::Forms::ComboBox^ comboBox)
912 {
913  REFAPP_START_METHOD();
914  if (comboBox != nullptr && !piml->IsPathChanging)
915  {
916  piml->IsPathChanging = true;
917 
918  System::String^ path = comboBox->Text;
919 
920  if (System::IO::Directory::Exists(path) || System::IO::File::Exists(path))
921  {
922  while (comboBox->Items->Contains(path))
923  {
924  comboBox->Items->Remove(path);
925  }
926 
927  while (comboBox->Items->Contains(path->TrimEnd(gcnew cli::array<wchar_t>(2) { '/', '\\' })))
928  {
929  comboBox->Items->Remove(path->TrimEnd(gcnew cli::array<wchar_t>(2) { '/', '\\' }));
930  }
931 
932  path = path->TrimEnd(gcnew cli::array<wchar_t>(2) { '/', '\\' });
933 
934  comboBox->Items->Insert(0, path);
935  comboBox->Text = path;
936  comboBox->SelectAll();
937  }
938 
939  piml->IsPathChanging = false;
940  }
941  REFAPP_END_METHOD();
942 }
943 
944 void SampleForm::SetupTraceFileProfilerMaxCountAndSize()
945 {
946  REFAPP_START_METHOD();
947  RuntimeConfig::GetInstance().SetTraceFileMaxCount(Setting::UserSettings::GetInstance().GetTraceFileMaxCount());
948  textBoxTraceFileMaxCount->Text = Setting::UserSettings::GetInstance().GetTraceFileMaxCount().ToString();
949 
950  RuntimeConfig::GetInstance().SetTraceFileMaxSize(Setting::UserSettings::GetInstance().GetTraceFileMaxSize());
951  textBoxTraceFileMaxSize->Text = Setting::UserSettings::GetInstance().GetTraceFileMaxSize().ToString();
952 
953  RuntimeConfig::GetInstance().SetProfiling(Setting::UserSettings::GetInstance().GetProfiling());
954  checkBoxProfiling->Checked = Setting::UserSettings::GetInstance().GetProfiling();
955 
956  RuntimeConfig::GetInstance().SetProfilingMaxFileSize(Setting::UserSettings::GetInstance().GetProfilingMaxFileSize());
957  textBoxProfilingSize->Text = Setting::UserSettings::GetInstance().GetProfilingMaxFileSize().ToString();
958  REFAPP_END_METHOD();
959 }
960 
961 void SampleForm::SetupDefaultPortAndPipeName()
962 {
963  REFAPP_START_METHOD();
964  piml->DefaultDiagPort = Setting::UserSettings::GetInstance().GetDiagManagerPort();
965  piml->DefaultRuntimePort = Setting::UserSettings::GetInstance().GetRuntimePort();
966 
967  piml->DefaultDiagPipeName = Setting::UserSettings::GetInstance().GetDiagManagerPipeName();
968  piml->DefaultRuntimePipeName = Setting::UserSettings::GetInstance().GetRuntimePipeName();
969 
970  IpcTypes ipcType = IpcTypes::Socket;
971  ipcType = Setting::UserSettings::GetInstance().GetIpcType();
972 
973  if (comboBoxIpcType->Items->Count == 0)
974  {
975  // Mode: Raw (Only C++), Socket, Pipe
976  comboBoxIpcType->Items->AddRange(Util::Util::ArrayIpcTypes2String());
977  }
978 
979  comboBoxIpcType->SelectedItem = Util::Util::ToString(ipcType);
980  REFAPP_END_METHOD();
981 }
982 
983 void SampleForm::SetupTraceLevel()
984 {
985  REFAPP_START_METHOD();
986  TraceLevels traceLevels = Setting::UserSettings::GetInstance().GetTraceLevels();
988 
990  comboBoxTraceLevel->SelectedItem = Util::Util::ToString(traceLevels);
991  REFAPP_END_METHOD();
992 }
993 
994 void SampleForm::SetupTraceFolder()
995 {
996  REFAPP_START_METHOD();
997  if (Setting::UserSettings::GetInstance().GetTracingDirectory().empty() != true)
998  {
999  OpenTestSystem::Otx::Runtime::Api::RuntimeConfig::GetInstance().SetTraceFolder(Setting::UserSettings::GetInstance().GetTracingDirectory());
1000  }
1001 
1002  textBoxTraceFolder->Text = Util::Util::ToString(RuntimeConfig::GetInstance().GetTraceFolder());
1003  REFAPP_END_METHOD();
1004 }
1005 
1006 void SampleForm::SetupCustomImplType()
1007 {
1008  REFAPP_START_METHOD();
1009  if (Setting::UserSettings::GetInstance().GetCustomImplTypes() == CustomImplTypes::OutputImpl)
1010  {
1011  radioButtonOuputWindow->Checked = true;
1012  }
1013  else if (Setting::UserSettings::GetInstance().GetCustomImplTypes() == CustomImplTypes::NoCustom)
1014  {
1015  radioButtonNoCustomImplementation->Checked = true;
1016  }
1017  else
1018  {
1019  radioButtonDefaultImplementation->Checked = true;
1020  }
1021  REFAPP_END_METHOD();
1022 }
1023 
1024 void SampleForm::SetupWindowSize()
1025 {
1026  REFAPP_START_METHOD();
1027  int width = Setting::UserSettings::GetInstance().GetWindowWidth();
1028  int height = Setting::UserSettings::GetInstance().GetWindowHeight();
1029  Size = System::Drawing::Size(width, height);
1030  REFAPP_END_METHOD();
1031 }
1032 
1033 void SampleForm::SetupWindowLocation()
1034 {
1035  REFAPP_START_METHOD();
1036  int locationX = Setting::UserSettings::GetInstance().GetWindowLocationX();
1037  int locationY = Setting::UserSettings::GetInstance().GetWindowLocationY();
1038  System::Drawing::Point location = System::Drawing::Point(locationX, locationY);
1039 
1040  if (CheckFormIsInBound(location))
1041  {
1042  Location = location;
1043  REFAPP_END_METHOD();
1044  return;
1045  }
1046 
1047  CenterToScreen();
1048  REFAPP_END_METHOD();
1049 }
1050 
1051 bool SampleForm::CheckFormIsInBound(System::Drawing::Point location)
1052 {
1053  REFAPP_START_METHOD();
1054  try
1055  {
1056 #pragma region C++ can not use Linq
1057  cli::array<System::Windows::Forms::Screen^>^ formContainScreens = System::Windows::Forms::Screen::AllScreens;
1058  for (int i = 0; i < formContainScreens->Length; i++)
1059  {
1060  if (formContainScreens[i]->Bounds.Contains(location))
1061  {
1062  REFAPP_END_METHOD();
1063  return true;
1064  }
1065  }
1066 
1067  REFAPP_END_METHOD();
1068  return false;
1069 #pragma endregion
1070  }
1071  catch (...)
1072  {
1073  REFAPP_END_METHOD();
1074  return false;
1075  }
1076 }
1077 
1078 void SampleForm::SetupTimeOut()
1079 {
1080  REFAPP_START_METHOD();
1081  System::String^ timeOutString = Setting::UserSettings::GetInstance().GetTimeOut().ToString();
1082  textBoxTimeout->Text = timeOutString;
1083  REFAPP_END_METHOD();
1084 }
1085 
1086 void SampleForm::SetupPollingTime()
1087 {
1088  REFAPP_START_METHOD();
1089  std::string pollingTimeString = std::to_string(Setting::UserSettings::GetInstance().GetPollingTime());
1090  textBoxPollingTime->Text = Util::Util::ToString(pollingTimeString);
1091  REFAPP_END_METHOD();
1092 }
1093 
1094 void SampleForm::SetupVoltageThreshold()
1095 {
1096  REFAPP_START_METHOD();
1097  std::string voltageThreshold = std::to_string(Setting::UserSettings::GetInstance().GetVoltageThreshold());
1098  textBoxVoltageThreshold->Text = Util::Util::ToString(voltageThreshold);
1099  REFAPP_END_METHOD();
1100 }
1101 
1102 System::Void SampleForm::comboBoxIpcType_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
1103 {
1104  REFAPP_START_METHOD();
1105  // Avoid RuntimeManager creation on DiagManager's port changed in this method
1106  textBoxDiagPortPipe->TextChanged -= gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
1107  IpcTypes ipcType = Util::Util::ToIpcType(comboBoxIpcType->SelectedItem->ToString());
1108 
1109 #pragma region C++ for design has RAW-mode
1110  // hide some input when initialize runtime manager
1111  textBoxDiagPortPipe->Hide();
1112  textBoxRtPortPipe->Hide();
1113  comboBoxODXProject->Hide();
1114  label13->Hide();
1115  comboBoxODXVehicle->Hide();
1116  portPipeLabel->Hide();
1117  labelOdxProject->Hide();
1118 
1119  // collapse content configuration DiagManager
1120  panel1->Size = System::Drawing::Size(panel1->Size.Width, 61);
1121  portPipeLabel->Location = System::Drawing::Point(portPipeLabel->Location.X, 34);
1122  textBoxDiagPortPipe->Location = System::Drawing::Point(Width - 95, 31);
1123  textBoxDiagPortPipe->Size = System::Drawing::Size(55, 22);
1124 #pragma endregion
1125 
1126  switch (ipcType)
1127  {
1128 #pragma region C++ for RAW-mode
1129  case IpcTypes::Raw:
1130  // expand content configuration DiagManager
1131  panel1->Size = System::Drawing::Size(panel1->Size.Width, 116);
1132 
1133  SetupDiagManagerControls();
1134 
1135  comboBoxDiagIpcType_SelectedValueChanged(comboBoxDiagIpcType, nullptr);
1136 
1137  break;
1138 #pragma endregion
1139 
1140  case IpcTypes::Socket:
1141 
1142  portPipeLabel->Show();
1143  portPipeLabel->Text = "Runner / DiagManager Ports";
1144 
1145 #pragma region C++ for design has RAW-mode
1146  textBoxRtPortPipe->Show();
1147  label13->Show();
1148  textBoxDiagPortPipe->Show();
1149 #pragma endregion
1150 
1151  textBoxDiagPortPipe->Text = piml->DefaultDiagPort.ToString();
1152  textBoxDiagPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
1153 
1154  textBoxRtPortPipe->Text = piml->DefaultRuntimePort.ToString();
1155  break;
1156 
1157  case IpcTypes::Pipe:
1158 
1159  portPipeLabel->Show();
1160  portPipeLabel->Text = "Runner / DiagManager Pipes";
1161 
1162 #pragma region C++ for design has RAW-mode
1163  textBoxRtPortPipe->Show();
1164  label13->Show();
1165  textBoxDiagPortPipe->Show();
1166 #pragma endregion
1167 
1168  textBoxDiagPortPipe->Text = Util::Util::ToString(piml->DefaultDiagPipeName);
1169  textBoxDiagPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
1170 
1171  textBoxRtPortPipe->Text = Util::Util::ToString(piml->DefaultRuntimePipeName);
1172  break;
1173 
1174  default:
1175  break;
1176  }
1177  REFAPP_END_METHOD();
1178 }
1179 
1180 System::Void SampleForm::textBoxPortPipe_TextChanged(System::Object^ sender, System::EventArgs^ e)
1181 {
1182  REFAPP_START_METHOD();
1183  PrintTextCallback("Create RuntimeManager...");
1184 
1185  try
1186  {
1187  piml->GlobalRuntimeManager = CreateRuntimeManager();
1188  }
1189  catch (const std::exception& ex)
1190  {
1191  PrintException(ex);
1192  PrintTextCallback("No RuntimeManager created");
1193  }
1194  catch (System::Exception^ ex)
1195  {
1196  System::String^ senderName = (dynamic_cast<System::Windows::Forms::TextBox^>(sender))->Name;
1197  if (senderName->Equals(Util::Util::ToString(SampleConstants::RT_PORT_PIPE_TEXT_BOX_NAME)))
1198  {
1199  PrintTextCallback(System::String::Format("Invalid Otx Runtime {0}", IpcPortPipeString()));
1200  }
1201  else if (senderName->Equals(Util::Util::ToString(SampleConstants::DM_PORT_PIPE_TEXT_BOX_NAME)))
1202  {
1203  PrintTextCallback(System::String::Format("Invalid Diag Manager {0}", IpcPortPipeString()));
1204  }
1205 
1206  PrintException(ex);
1207  PrintTextCallback("No RuntimeManager created");
1208  }
1209  catch (...)
1210  {
1211  PrintTextCallback("No RuntimeManager created");
1212  }
1213 
1214  if (piml->GlobalRuntimeManager == nullptr)
1215  {
1216  PrintTextCallback("RuntimeManager is null.");
1217  }
1218  REFAPP_END_METHOD();
1219 }
1220 
1221 std::shared_ptr<IRuntimeManager> SampleForm::CreateRuntimeManager()
1222 {
1223  REFAPP_START_METHOD();
1224  std::shared_ptr<IRuntimeManager> runtimeManager = nullptr;
1225  try
1226  {
1227  System::String^ ipcType = "";
1228  switch (Util::Util::ToIpcType(comboBoxIpcType->SelectedItem->ToString()))
1229  {
1230 #pragma region C++ for RAW-mode
1231  case IpcTypes::Raw:
1232 
1233  runtimeManager = CreateRawRuntimeManager();
1234 
1235  if (runtimeManager == nullptr)
1236  {
1237  REFAPP_END_METHOD();
1238  return piml->GlobalRuntimeManager;
1239  }
1240 
1241  ipcType = Util::Util::ToString(IpcTypes::Raw);
1242 
1243  break;
1244 #pragma endregion
1245 
1246  case IpcTypes::Socket:
1247 
1248  runtimeManager = CreateSocketRuntimeManager();
1249  ipcType = Util::Util::ToString(IpcTypes::Socket);
1250  break;
1251 
1252  case IpcTypes::Pipe:
1253 
1254  runtimeManager = CreatePipeRuntimeManager();
1255  ipcType = Util::Util::ToString(IpcTypes::Pipe);
1256  break;
1257  }
1258 
1259  PrintTextCallback(System::String::Format("... {0} RuntimeManager created (MinBinVersion: {1})", ipcType, Util::Util::ToString(RuntimeConfig::GetInstance().GetMinBinVersion())));
1260 
1261  InitializeRuntimeEvents(runtimeManager);
1262  SetCustomImplementation(runtimeManager);
1263  }
1264  catch (const std::exception& ex)
1265  {
1266  PrintException(ex);
1267  PrintTextCallback("... No RuntimeManager created.");
1268 
1269  REFAPP_END_METHOD();
1270  return runtimeManager;
1271  }
1272  catch (System::Exception^ ex)
1273  {
1274  PrintException(ex);
1275  PrintTextCallback("... No RuntimeManager created.");
1276 
1277  REFAPP_END_METHOD();
1278  return runtimeManager;
1279  }
1280  catch (...)
1281  {
1282  PrintTextCallback("... No RuntimeManager created.");
1283 
1284  REFAPP_END_METHOD();
1285  return runtimeManager;
1286  }
1287 
1288  REFAPP_END_METHOD();
1289  return runtimeManager;
1290 }
1291 
1292 System::String^ SampleForm::IpcPortPipeString()
1293 {
1294  IpcTypes ipcType = Util::Util::ToIpcType(comboBoxIpcType->SelectedItem->ToString());
1295  switch (ipcType)
1296  {
1297  case IpcTypes::Socket:
1298  return Util::Util::ToString(SampleConstants::PORT_STRING);
1299  case IpcTypes::Pipe:
1300  return Util::Util::ToString(SampleConstants::PIPE_STRING);
1301  default:
1302  // Should not reach here
1303  return System::String::Empty;
1304  }
1305 }
1306 
1307 std::shared_ptr<IRuntimeManager> SampleForm::CreateSocketRuntimeManager()
1308 {
1309  REFAPP_START_METHOD();
1310  unsigned short rtPort = System::Convert::ToUInt16(textBoxRtPortPipe->Text);
1311 
1312  if (NoDiag())
1313  {
1314  return RuntimeManagerFactory::CreateSocketRuntimeManager(rtPort);
1315  }
1316  else
1317  {
1318  unsigned short diagPort = System::Convert::ToUInt16(textBoxDiagPortPipe->Text);
1319  return RuntimeManagerFactory::CreateSocketRuntimeManager(rtPort, diagPort);
1320  }
1321  REFAPP_END_METHOD();
1322 }
1323 
1324 std::shared_ptr<IRuntimeManager> SampleForm::CreatePipeRuntimeManager()
1325 {
1326  REFAPP_START_METHOD();
1327  if (NoDiag())
1328  {
1329  return RuntimeManagerFactory::CreatePipeRuntimeManager(Util::Util::ToString(textBoxRtPortPipe->Text));
1330  }
1331  else
1332  {
1333  return RuntimeManagerFactory::CreatePipeRuntimeManager(Util::Util::ToString(textBoxRtPortPipe->Text), Util::Util::ToString(textBoxDiagPortPipe->Text));
1334  }
1335  REFAPP_END_METHOD();
1336 }
1337 
1338 bool SampleForm::NoDiag()
1339 {
1340  return System::String::IsNullOrWhiteSpace(textBoxDiagPortPipe->Text);
1341 }
1342 
1343 void SampleForm::InitializeRuntimeEvents(std::shared_ptr<IRuntimeManager> runtimeManager)
1344 {
1345  REFAPP_START_METHOD();
1346  if (runtimeManager == nullptr)
1347  {
1348  return;
1349  }
1350 
1351  piml->InitializeRuntimeEvents(runtimeManager);
1352 
1353  PrintTextCallback("Initialization of runtime events finished");
1354  REFAPP_END_METHOD();
1355 }
1356 
1357 System::Void SampleForm::radioButtonCustomImpl_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
1358 {
1359  REFAPP_START_METHOD();
1360  if (piml->GlobalRuntimeManager == nullptr)
1361  {
1362  REFAPP_END_METHOD();
1363  return;
1364  }
1365 
1366  if (sender != nullptr && (dynamic_cast<System::Windows::Forms::RadioButton^>(sender))->Checked == false)
1367  {
1368  REFAPP_END_METHOD();
1369  return;
1370  }
1371 
1372  SetCustomImplementation(piml->GlobalRuntimeManager);
1373  REFAPP_END_METHOD();
1374 }
1375 
1376 void SampleForm::SetCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
1377 {
1378  REFAPP_START_METHOD();
1379  if (runtimeManager == nullptr)
1380  {
1381  REFAPP_END_METHOD();
1382  return;
1383  }
1384 
1385  System::String^ type = "";
1386  CustomImplTypes currentCustomImpl = GetCurrentCustomImpl();
1387  switch (currentCustomImpl)
1388  {
1389  case OutputImpl:
1390 
1391  SetOutputWindowImplementation(runtimeManager);
1392  type = "output ";
1393  break;
1394 
1395  case DefaultCustomImpl:
1396 
1397  SetDefaultCustomImplementation(runtimeManager);
1398  type = "default ";
1399  break;
1400 
1401  case NoCustom:
1402 
1403  RemoveCustomImplementation(runtimeManager);
1404  type = "no ";
1405  break;
1406 
1407  default:
1408  break;
1409  }
1410 
1411  if (currentCustomImpl != CustomImplTypes::None)
1412  {
1413  PrintTextCallback("Set up " + type + "custom implementation finished");
1414  }
1415  REFAPP_END_METHOD();
1416 }
1417 
1418 CustomImplTypes SampleForm::GetCurrentCustomImpl()
1419 {
1420  if (radioButtonOuputWindow->Checked)
1421  {
1422  return CustomImplTypes::OutputImpl;
1423  }
1424  else if (radioButtonDefaultImplementation->Checked)
1425  {
1426  return CustomImplTypes::DefaultCustomImpl;
1427  }
1428  else if (radioButtonNoCustomImplementation->Checked)
1429  {
1430  return CustomImplTypes::NoCustom;
1431  }
1432 
1433  return CustomImplTypes::None;
1434 }
1435 
1436 void SampleForm::SetOutputWindowImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
1437 {
1438  if (runtimeManager == nullptr)
1439  {
1440  return;
1441  }
1442 
1443  piml->SetOutputWindowImplementation(runtimeManager);
1444 }
1445 
1446 void SampleForm::SetDefaultCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
1447 {
1448  if (runtimeManager == nullptr)
1449  {
1450  return;
1451  }
1452 
1453  piml->SetDefaultCustomImplementation(runtimeManager);
1454 }
1455 
1456 void SampleForm::RemoveCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager)
1457 {
1458  if (runtimeManager == nullptr)
1459  {
1460  return;
1461  }
1462 
1463  piml->RemoveCustomImplementation(runtimeManager);
1464 }
1465 
1466 void SampleForm::ProcedurePendingCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1467 {
1468  REFAPP_START_METHOD();
1469  if (InvokeRequired)
1470  {
1471  Invoke(gcnew System::Action<CLRWrapper< IRuntimeContext*>^>(this, &SampleForm::ProcedurePendingCallback), clrContext);
1472  REFAPP_END_METHOD();
1473  return;
1474  }
1475 
1476  msclr::lock l(piml->EventListenerLock.get());
1477  {
1478  IRuntimeContext* context = clrContext->GetPtr();
1479  PrintTextCallback(System::String::Format("Event ProcedurePending occurred - {0} - ExecutionState = {1}",
1480  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1481  Util::Util::ToString(context->GetExecutionState())));
1482  UpdateExecutionState(context);
1483  ShowConnectionStateMessage(context);
1484  }
1485  REFAPP_END_METHOD();
1486 }
1487 
1488 void SampleForm::ProcedureStartedCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1489 {
1490  REFAPP_START_METHOD();
1491  if (InvokeRequired)
1492  {
1493  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureStartedCallback), clrContext);
1494  REFAPP_END_METHOD();
1495  return;
1496  }
1497 
1498  msclr::lock l(piml->EventListenerLock.get());
1499  {
1500  IRuntimeContext* context = clrContext->GetPtr();
1501  PrintTextCallback(System::String::Format("Event ProcedureStarted occurred - {0} - ExecutionState = {1} - RuntimeId = {2} - ProcessId = {3}",
1502  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1503  Util::Util::ToString(context->GetExecutionState()),
1504  context->GetRuntimeId().ToString(),
1505  context->GetProcessId().ToString()));
1506  UpdateExecutionState(context);
1507  }
1508  REFAPP_END_METHOD();
1509 }
1510 
1511 void SampleForm::ProcedurePaused(IRuntimeContext* context, ExecutionStateChangeReason reason)
1512 {
1513  REFAPP_START_METHOD();
1514  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
1515  arr[0] = gcnew CLRWrapper<IRuntimeContext*>(context);
1516  arr[1] = gcnew CLRWrapper<ExecutionStateChangeReason>(reason);
1517  if (InvokeRequired)
1518  {
1519  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::ProcedurePausedCallback), gcnew cli::array<System::Object^>{arr});
1520  }
1521  else
1522  {
1523  ProcedurePausedCallback(arr);
1524  }
1525  REFAPP_END_METHOD();
1526 }
1527 
1528 void SampleForm::ProcedurePausedCallback(cli::array<System::Object^>^ arr)
1529 {
1530  REFAPP_START_METHOD();
1531  if (arr == nullptr || arr->Length != 2)
1532  {
1533  REFAPP_END_METHOD();
1534  return;
1535  }
1536 
1537  IRuntimeContext* context = Util::Util::CastTo<IRuntimeContext*>(arr[0]);
1538  ExecutionStateChangeReason reason = Util::Util::CastToEnum<ExecutionStateChangeReason>(arr[1]);
1539 
1540  if (context == nullptr)
1541  {
1542  REFAPP_END_METHOD();
1543  return;
1544  }
1545 
1546  msclr::lock l(piml->EventListenerLock.get());
1547  {
1548  PrintTextCallback(System::String::Format("Event ProcedurePaused occurred - {0} - ExecutionState = {1} - ExecutionStateChangeReason = {2}",
1549  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1550  Util::Util::ToString(context->GetExecutionState()),
1551  Util::Util::ToString(reason)));
1552  UpdateExecutionState(context, reason);
1553  if (reason == ExecutionStateChangeReason::UnexpectedDiagConnectionState)
1554  {
1555  ShowConnectionStateMessage(context);
1556  }
1557  }
1558  REFAPP_END_METHOD();
1559 }
1560 
1561 void SampleForm::ProcedureContinuedCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1562 {
1563  REFAPP_START_METHOD();
1564  if (InvokeRequired)
1565  {
1566  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureContinuedCallback), clrContext);
1567  REFAPP_END_METHOD();
1568  return;
1569  }
1570 
1571  msclr::lock l(piml->EventListenerLock.get());
1572  {
1573  IRuntimeContext* context = clrContext->GetPtr();
1574  PrintTextCallback(System::String::Format("Event ProcedureContinued occurred - {0} - ExecutionState = {1}",
1575  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1576  Util::Util::ToString(context->GetExecutionState())));
1577  UpdateExecutionState(context);
1578  }
1579  REFAPP_END_METHOD();
1580 }
1581 
1582 void SampleForm::ProcedureStoppedCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1583 {
1584  REFAPP_START_METHOD();
1585  if (InvokeRequired)
1586  {
1587  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureStoppedCallback), clrContext);
1588  REFAPP_END_METHOD();
1589  return;
1590  }
1591 
1592  msclr::lock l(piml->EventListenerLock.get());
1593  {
1594  IRuntimeContext* context = clrContext->GetPtr();
1595  PrintTextCallback(System::String::Format("Event ProcedureStopped occurred - {0} - ExecutionState = {1}",
1596  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1597  Util::Util::ToString(context->GetExecutionState())));
1598  UpdateExecutionState(context);
1599  }
1600  REFAPP_END_METHOD();
1601 }
1602 
1603 void SampleForm::ProcedureTimeoutCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1604 {
1605  REFAPP_START_METHOD();
1606  if (InvokeRequired)
1607  {
1608  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureTimeoutCallback), clrContext);
1609  REFAPP_END_METHOD();
1610  return;
1611  }
1612 
1613  msclr::lock l(piml->EventListenerLock.get());
1614  {
1615  IRuntimeContext* context = clrContext->GetPtr();
1616  PrintTextCallback(System::String::Format("Event ProcedureTimeout occurred - {0} - ExecutionState = {1}",
1617  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1618  Util::Util::ToString(context->GetExecutionState())));
1619 
1620  UpdateExecutionState(context);
1621  }
1622  REFAPP_END_METHOD();
1623 }
1624 
1625 void SampleForm::DiagConnectionStateChanged(ClampState batteryState, ClampState ignitionState)
1626 {
1627  REFAPP_START_METHOD();
1628  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
1629  arr[0] = gcnew CLRWrapper<ClampState>(batteryState);
1630  arr[1] = gcnew CLRWrapper<ClampState>(ignitionState);
1631  if (InvokeRequired)
1632  {
1633  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::DiagConnectionStateChangedCallback), gcnew cli::array<System::Object^>{arr});
1634  }
1635  else
1636  {
1637  DiagConnectionStateChangedCallback(arr);
1638  }
1639  REFAPP_END_METHOD();
1640 }
1641 
1642 void SampleForm::DiagConnectionStateChangedCallback(cli::array<System::Object^>^ arr)
1643 {
1644  REFAPP_START_METHOD();
1645 
1646  if (arr == nullptr || arr->Length != 2)
1647  {
1648  REFAPP_END_METHOD();
1649  return;
1650  }
1651 
1652  ClampState batteryState = Util::Util::CastToEnum<ClampState>(arr[0]);
1653  ClampState ignitionState = Util::Util::CastToEnum<ClampState>(arr[1]);
1654 
1655 
1656  msclr::lock l(piml->EventListenerLock.get());
1657  {
1658  PrintTextCallback(System::String::Format("Event DiagConnectionStateChanged occurred - BatteryState = {0}, IgnitionState = {1}",
1659  Util::Util::ToString(batteryState),
1660  Util::Util::ToString(ignitionState)));
1661  System::Media::SystemSounds::Beep->Play();
1662 
1663  SetBatteryIgnitionState(batteryState, ignitionState);
1664  }
1665  REFAPP_END_METHOD();
1666 }
1667 
1668 // TODO: refactor. handle multithread?
1669 void SampleForm::ProcedureFinishedCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1670 {
1671  REFAPP_START_METHOD();
1672 
1673  if (InvokeRequired)
1674  {
1675  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureFinishedCallback), clrContext);
1676  REFAPP_END_METHOD();
1677  return;
1678  }
1679 
1680  msclr::lock l(piml->EventListenerLock.get());
1681  {
1682  IRuntimeContext* context = clrContext->GetPtr();
1683  std::shared_ptr<IProcedureParameter> procedureParameter;
1684  std::string procedureName = context->GetProcedure()->GetFullName();
1685  std::string parameterOutput;
1686 
1687  for (int i = 0; i < context->GetProcedure()->GetParameters().size(); i++)
1688  {
1689  procedureParameter = context->GetProcedure()->GetParameters().at(i);
1690  parameterOutput = "Parameter Changed - " + procedureParameter->GetName() + "(" + procedureParameter->GetDataType() + ") = ";
1691 
1692  if (IS_NOT_NULL(procedureParameter->GetValue()))
1693  {
1694  parameterOutput += ShortenedValueString(procedureParameter->GetValue());
1695  }
1696  else
1697  {
1698  parameterOutput += "";
1699  }
1700 
1701  PrintTextCallback(Util::Util::ToString(parameterOutput));
1702  }
1703  System::DateTime duration = System::DateTime::Now.Subtract(System::TimeSpan(piml->RuntimeContextIdsExecutionStartTick[context->GetRuntimeId()]));
1704  UpdateGridviewParameter(context->GetProcedure());
1705 
1706  System::String^ stringRunningTime;
1707  double runningTime;
1708  if (System::Double::TryParse(context->GetExecutionTime().ToString(), runningTime) == false)
1709  {
1710  runningTime = 0;
1711  }
1712  stringRunningTime = System::DateTime().AddMilliseconds(runningTime).ToString("HH':'mm':'ss','fff");
1713 
1714  PrintTextCallback(System::String::Format("ProcedureFinished({0}) ExecutionState({1}) - Execution duration {2} - Running time {3} - Used memory {4})",
1715  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1716  Util::Util::ToString(context->GetExecutionState()),
1717  duration.ToString("HH':'mm':'ss','fff"),
1718  stringRunningTime,
1719  System::String::Format("{0:0,0} kB", context->GetProcessMemory() / 1024))
1720  );
1721 
1722  UpdateExecutionState(context);
1723 
1724  piml->CyclicExecuteAsyncIsProcessing = false;
1725  }
1726  REFAPP_END_METHOD();
1727 }
1728 
1729 void SampleForm::ProcedureAbortedCallback(CLRWrapper<IRuntimeContext*>^ clrContext)
1730 {
1731  REFAPP_START_METHOD();
1732  if (InvokeRequired)
1733  {
1734  Invoke(gcnew System::Action<CLRWrapper<IRuntimeContext*>^>(this, &SampleForm::ProcedureAbortedCallback), clrContext);
1735  REFAPP_END_METHOD();
1736  return;
1737  }
1738 
1739  IRuntimeContext* context = clrContext->GetPtr();
1740  PrintTextCallback(System::String::Format("ProcedureAborted({0}) ExecutionState({1})",
1741  Util::Util::ToString(context->GetProcedure()->GetFullName()),
1742  Util::Util::ToString(context->GetExecutionState())));
1743 
1744  if (context->HasRuntimeException())
1745  {
1746  PrintException(context->GetRuntimeException(), "Reason: API ");
1747  }
1748 
1749  if (context->HasOtxException())
1750  {
1751  PrintException(context->GetOtxException(), "Reason: OTX ");
1752  }
1753  piml->CyclicExecuteAsyncIsProcessing = false;
1754  UpdateExecutionState(context);
1755  REFAPP_END_METHOD();
1756 }
1757 
1758 void SampleForm::UpdateExecutionState(IRuntimeContext* context, ExecutionStateChangeReason reason)
1759 {
1760  REFAPP_START_METHOD();
1761  if (context->GetExecutionState() == OpenTestSystem::Otx::Runtime::Api::ExecutionState::Paused)
1762  {
1763  piml->ProcedureExecutionCount--;
1764  if (reason == ExecutionStateChangeReason::Explicit)
1765  {
1766  DisplayProcedureExecutionState(context);
1767  }
1768 
1769  UpdatePauseButton(false, reason == ExecutionStateChangeReason::Explicit);
1770  }
1771  else
1772  {
1773  UpdateExecutionState(context);
1774  }
1775  REFAPP_END_METHOD();
1776 }
1777 
1778 void SampleForm::UpdateExecutionState(IRuntimeContext* context)
1779 {
1780  REFAPP_START_METHOD();
1781  if (context != nullptr)
1782  {
1783  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
1784 
1785  switch (context->GetExecutionState())
1786  {
1787  case ExecutionState::Running:
1788 
1789  piml->ProcedureExecutionCount++;
1790 
1791  AddRuntimeContext(context);
1792  DisplayProcedureExecutionState(context);
1793 
1794  buttonExecuteMain->Enabled = checkBoxAsyncExecution->Checked;
1795  buttonExecuteSelectedProcedure->Enabled = checkBoxAsyncExecution->Checked;
1796 
1797  UpdateExecutionStateButtons(true);
1798  UpdatePauseButton(true);
1799 
1800  break;
1801 
1802  case ExecutionState::Paused:
1803 
1804  piml->ProcedureExecutionCount--;
1805  UpdatePauseButton(false);
1806 
1807  break;
1808 
1809  case ExecutionState::Pending:
1810 
1811  DisplayProcedureExecutionState(context);
1812  UpdateExecutionStateButtons(true);
1813  UpdatePauseButton(true, false);
1814 
1815  break;
1816 
1817  case ExecutionState::Finished:
1818 
1819  piml->ProcedureExecutionCount--;
1820 
1821  RemoveRuntimeContext(context);
1822  DisplayProcedureExecutionState(context);
1823 
1824  buttonExecuteMain->Enabled = !checkBoxCyclicExecution->Checked;
1825  buttonExecuteSelectedProcedure->Enabled = !checkBoxCyclicExecution->Checked;
1826 
1827  UpdateExecutionStateButtons(false);
1828  UpdatePauseButton(true, false);
1829 
1830  labelBatteryState->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16"));
1831  labelVoltageThreshold->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16"));
1832 
1833  break;
1834 
1835  case ExecutionState::Stopped:
1836 
1837  piml->ProcedureExecutionCount--;
1838 
1839  RemoveRuntimeContext(context);
1840  DisplayProcedureExecutionState(context);
1841 
1842  buttonExecuteMain->Enabled = true;
1843  buttonExecuteSelectedProcedure->Enabled = true;
1844 
1845  UpdateExecutionStateButtons(false);
1846  UpdatePauseButton(true, false);
1847 
1848  labelBatteryState->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16"));
1849  labelVoltageThreshold->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16"));
1850 
1851  break;
1852 
1853  case ExecutionState::Aborted:
1854 
1855  piml->ProcedureExecutionCount--;
1856 
1857  RemoveRuntimeContext(context);
1858  DisplayProcedureExecutionState(context);
1859 
1860  buttonExecuteMain->Enabled = true;
1861  buttonExecuteSelectedProcedure->Enabled = true;
1862 
1863  UpdateExecutionStateButtons(false);
1864  UpdatePauseButton(true, false);
1865 
1866  labelBatteryState->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16"));
1867  labelVoltageThreshold->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16"));
1868 
1869  break;
1870  case ExecutionState::Timeout:
1871 
1872  System::Media::SystemSounds::Hand->Play();
1873 
1874  piml->ProcedureExecutionCount--;
1875 
1876  RemoveRuntimeContext(context);
1877  DisplayProcedureExecutionState(context);
1878 
1879  buttonExecuteMain->Enabled = true;
1880  buttonExecuteSelectedProcedure->Enabled = true;
1881 
1882  UpdateExecutionStateButtons(false);
1883  UpdatePauseButton(true, false);
1884 
1885  labelBatteryState->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16"));
1886  labelVoltageThreshold->Image = cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16"));
1887 
1888  break;
1889  }
1890 
1891  StartStopUpdateGuiTimer();
1892  }
1893  REFAPP_END_METHOD();
1894 }
1895 
1896 void SampleForm::StartStopUpdateGuiTimer()
1897 {
1898  if (piml->ProcedureExecutionCount <= 0)
1899  {
1900  updateGuiTimer->Enabled = false;
1901  labelSeparator1->Visible = false;
1902  labelProcedureExecutionTimes->Visible = false;
1903  }
1904  else if (!updateGuiTimer->Enabled)
1905  {
1906  updateGuiTimer->Enabled = true;
1907  }
1908 }
1909 
1910 System::Void SampleForm::updateGuiTimer_Tick(System::Object^ sender, System::EventArgs^ e)
1911 {
1912  DisplayProcedureExecutionTimes();
1913 }
1914 
1915 void SampleForm::DisplayProcedureExecutionTimes()
1916 {
1917  REFAPP_START_METHOD();
1918  System::String^ text = System::String::Empty;
1919 
1920  if (piml->RuntimeContextIdsExecutionStartTick.size() > 0)
1921  {
1922  for (std::map<long long, long long>::iterator itr = piml->RuntimeContextIdsExecutionStartTick.begin();
1923  itr != piml->RuntimeContextIdsExecutionStartTick.end(); ++itr)
1924  {
1925  System::TimeSpan duration = System::TimeSpan(System::DateTime::Now.Ticks - itr->second);
1926  text += System::String::Format("{0}: {1} |",
1927  Util::Util::ToString(GetRuntimeContext(itr->first)->GetProcedure()->GetName()),
1928  duration.ToString("hh':'mm':'ss"));
1929  }
1930  text = text->TrimEnd(gcnew cli::array<wchar_t>{' ', '|'});
1931  }
1932 
1933  labelProcedureExecutionTimes->Text = text;
1934  labelSeparator1->Visible = true;
1935  labelProcedureExecutionTimes->Visible = true;
1936  REFAPP_END_METHOD();
1937 }
1938 
1939 void SampleForm::InOutParameterValueChanged(IRuntimeContext* context, IProcedureInOutParameter* parameter)
1940 {
1941  REFAPP_START_METHOD();
1942  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
1943  arr[0] = gcnew CLRWrapper<IRuntimeContext*>(context);
1944  arr[1] = gcnew CLRWrapper<IProcedureInOutParameter*>(parameter);
1945  if (InvokeRequired)
1946  {
1947  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::InOutParameterValueChangedCallback), gcnew cli::array<System::Object^>{arr});
1948  }
1949  else
1950  {
1951  InOutParameterValueChangedCallback(arr);
1952  }
1953  REFAPP_END_METHOD();
1954 }
1955 
1956 void SampleForm::InOutParameterValueChangedCallback(cli::array<System::Object^>^ arr)
1957 {
1958  REFAPP_START_METHOD();
1959 
1960  if (arr == nullptr || arr->Length != 2)
1961  {
1962  REFAPP_END_METHOD();
1963  return;
1964  }
1965 
1966  IRuntimeContext* context = Util::Util::CastTo<IRuntimeContext*>(arr[0]);
1967  IProcedureInOutParameter* parameter = Util::Util::CastTo<IProcedureInOutParameter*>(arr[1]);
1968 
1969  if (context == nullptr || parameter == nullptr)
1970  {
1971  REFAPP_END_METHOD();
1972  return;
1973  }
1974 
1975  msclr::lock l(piml->EventListenerLock.get());
1976  {
1977  try
1978  {
1979  std::string valueStr = ShortenedValueString(parameter->GetValue());
1980  System::String^ message = System::String::Format("Parameter '{0}' new value = {1}",
1981  Util::Util::ToString(parameter->GetName()),
1982  Util::Util::ToString(valueStr));
1983  PrintTextCallback(message);
1984  UpdateGridviewParameter(context->GetProcedure());
1985  }
1986  catch (const std::exception& ex)
1987  {
1988  PrintTextCallback(Util::Util::ToString(ex.what()));
1989  }
1990  catch (System::InvalidCastException^ ex)
1991  {
1992  PrintTextCallback(ex->Message);
1993  }
1994  }
1995  REFAPP_END_METHOD();
1996 }
1997 
1998 std::string SampleForm::ShortenedValueString(std::shared_ptr<DataTypes::Object> value)
1999 {
2000  try
2001  {
2002  std::string valueStr = ValueConverter::Value2String(value);
2003  if (valueStr.size() > piml->VALUE_STRING_MAX_LENGTH)
2004  {
2005  return valueStr.substr(0, piml->VALUE_STRING_MAX_LENGTH) + "...";
2006  }
2007 
2008  return valueStr;
2009  }
2010  catch (...)
2011  {
2012  }
2013 
2014  return "";
2015 }
2016 
2017 void SampleForm::UpdatePauseButton(bool pauseAvailable)
2018 {
2019  UpdatePauseButton(pauseAvailable, true);
2020 }
2021 
2022 void SampleForm::UpdatePauseButton(bool pauseAvailable, bool enabled)
2023 {
2024  REFAPP_START_METHOD();
2025 #pragma region C++ for initialize resources
2026  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
2027 #pragma endregion
2028 
2029  buttonPause->Enabled = enabled;
2030  buttonPause->Checked = !pauseAvailable;
2031  buttonPause->Image = pauseAvailable ?
2032  (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonPause.Image"))) :
2033  (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonContinue.Image")));
2034  REFAPP_END_METHOD();
2035 }
2036 
2037 void SampleForm::UpdateExecutionStateButtons(bool wasExecuted)
2038 {
2039  if (piml->UseConnectionState)
2040  {
2041  labelTimeout->Enabled = !wasExecuted;
2042  textBoxTimeout->Enabled = !wasExecuted;
2043  checkBoxUseConnectionState->Enabled = !wasExecuted;
2044  labelExpectedState->Enabled = !wasExecuted;
2045  checkBoxIgnition->Enabled = !wasExecuted;
2046  labelPollingTime->Enabled = !wasExecuted;
2047  textBoxPollingTime->Enabled = !wasExecuted;
2048  labelVoltageThreshold->Enabled = !wasExecuted;
2049  textBoxVoltageThreshold->Enabled = !wasExecuted;
2050  }
2051 
2052  if (wasExecuted)
2053  {
2054  if (checkBoxAsyncExecution->Checked == false)
2055  {
2056  buttonExecuteMain->Enabled = false;
2057  buttonExecuteSelectedProcedure->Enabled = false;
2058  }
2059 
2060  buttonStop->Enabled = true;
2061  }
2062  else
2063  {
2064  if (IS_NOT_NULL(piml->Project) && IS_NOT_NULL(piml->Project->GetMainProcedure()))
2065  {
2066  buttonExecuteMain->Enabled = true;
2067  }
2068 
2069  buttonExecuteSelectedProcedure->Enabled = true;
2070 
2071  buttonStop->Enabled = false;
2072  }
2073 }
2074 
2075 void SampleForm::DisplayProcedureExecutionState(IRuntimeContext* context)
2076 {
2077  DisplayProcedureExecutionState(context, "");
2078 }
2079 
2080 void SampleForm::DisplayProcedureExecutionState(IRuntimeContext* context, System::String^ errorMessage)
2081 {
2082  REFAPP_START_METHOD();
2083 #pragma region C++ for intialize resource
2084  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
2085 #pragma endregion
2086 
2087  if (System::String::IsNullOrEmpty(errorMessage))
2088  {
2089  labelIconProcedureExecutionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"Info16")));
2090 
2091  if (piml->ProcedureExecutionCount <= 0)
2092  {
2093  piml->ProcedureExecutionCount = 0;
2094  if (context->GetExecutionState() == ExecutionState::Paused)
2095  {
2096  labelProcedureExecutionState->Text = "Execution is paused, click \"Continue\"...";
2097  }
2098  else
2099  {
2100  labelProcedureExecutionState->Text = "Select a procedure and click \"Start\"...";
2101  }
2102  }
2103  else if (piml->ProcedureExecutionCount == 1)
2104  {
2105  labelProcedureExecutionState->Text = "1 Procedure is running";
2106  }
2107  else
2108  {
2109  labelProcedureExecutionState->Text = System::String::Format("{0} Procedures are running", piml->ProcedureExecutionCount);
2110  }
2111  }
2112  else
2113  {
2114  labelIconProcedureExecutionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"Error16")));
2115  labelProcedureExecutionState->Text = errorMessage;
2116  }
2117  REFAPP_END_METHOD();
2118 }
2119 
2120 void SampleForm::SyncWithParent(System::Object^ parentControl)
2121 {
2122  REFAPP_START_METHOD();
2123  SyncWithParent(parentControl, nullptr);
2124  REFAPP_END_METHOD();
2125 }
2126 
2127 void SampleForm::SyncWithParent(System::Object^ parentControl, System::Object^ control)
2128 {
2129  REFAPP_START_METHOD();
2130  SyncWithParent(parentControl, control, false);
2131  REFAPP_END_METHOD();
2132 }
2133 
2134 void SampleForm::SyncWithParent(System::Object^ parentControl, System::Object^ control, bool newThread)
2135 {
2136  REFAPP_START_METHOD();
2137  if (parentControl != nullptr)
2138  {
2139  if (IS_NOT_NULL(piml->CreatorForm) && checkBoxStartAllParents->Checked)
2140  {
2141  if (Util::Util::IsInstance<System::Windows::Forms::Button^>(parentControl))
2142  {
2143  if (newThread)
2144  {
2145  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::ParentButtonClickCallback), parentControl);
2146  }
2147  else
2148  {
2149  ParentButtonClickCallback(parentControl);
2150  }
2151  }
2152  else if (Util::Util::IsInstance<System::Windows::Forms::TextBox^>(parentControl) && Util::Util::IsInstance<System::Windows::Forms::TextBox^>(control))
2153  {
2154  cli::array<System::Object^>^ state = gcnew cli::array<System::Object^>(2);
2155  state[0] = parentControl;
2156  state[1] = (dynamic_cast<System::Windows::Forms::TextBox^>(control))->Text;
2157  if (newThread)
2158  {
2159  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::ParentTextBoxSetTextCallback), state);
2160  }
2161  else
2162  {
2163  ParentTextBoxSetTextCallback(state);
2164  }
2165  }
2166  else if (Util::Util::IsInstance<System::Windows::Forms::CheckBox^>(parentControl) && Util::Util::IsInstance<System::Windows::Forms::CheckBox^>(control))
2167  {
2168  cli::array<System::Object^>^ state = gcnew cli::array<System::Object^>(2);
2169  state[0] = parentControl;
2170  state[1] = (dynamic_cast<System::Windows::Forms::CheckBox^> (control))->CheckState;
2171  if (newThread)
2172  {
2173  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::ParentCheckBoxSetCheckStateCallback), state);
2174  }
2175  else
2176  {
2177  ParentCheckBoxSetCheckStateCallback(state);
2178  }
2179  }
2180  else if (Util::Util::IsInstance<System::Windows::Forms::ComboBox^>(parentControl) && Util::Util::IsInstance<System::Windows::Forms::ComboBox^>(control))
2181  {
2182  cli::array<System::Object^>^ state = gcnew cli::array<System::Object^>(2);
2183  state[0] = parentControl;
2184  state[1] = (dynamic_cast<System::Windows::Forms::ComboBox^>(control))->SelectedIndex;
2185  if (newThread)
2186  {
2187  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::ParentComboBoxSetIndexCallback), state);
2188  }
2189  else
2190  {
2191  ParentComboBoxSetIndexCallback(state);
2192  }
2193  }
2194  else if (Util::Util::IsInstance<System::Windows::Forms::NumericUpDown^>(parentControl) && Util::Util::IsInstance<System::Windows::Forms::NumericUpDown^>(control))
2195  {
2196  cli::array<System::Object^>^ state = gcnew cli::array<System::Object^>(2);
2197  state[0] = parentControl;
2198  state[1] = System::Decimal::ToInt32((dynamic_cast<System::Windows::Forms::NumericUpDown^>(control))->Value);
2199  if (newThread)
2200  {
2201  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::ParentNumericUpDownSetValueCallback), state);
2202  }
2203  else
2204  {
2205  ParentNumericUpDownSetValueCallback(state);
2206  }
2207  }
2208  }
2209  }
2210  REFAPP_END_METHOD();
2211 }
2212 
2213 void SampleForm::ParentButtonClickCallback(System::Object^ state)
2214 {
2215  REFAPP_START_METHOD();
2216  System::Windows::Forms::Button^ parentButton = dynamic_cast<System::Windows::Forms::Button^> (state);
2217  if (parentButton == nullptr)
2218  {
2219  REFAPP_END_METHOD();
2220  return;
2221  }
2222 
2223  if (parentButton->InvokeRequired)
2224  {
2225  piml->CreatorForm->Invoke(gcnew System::Action<System::Object^>(this, &SampleForm::ParentButtonClickCallback), parentButton);
2226  }
2227  else
2228  {
2229  parentButton->PerformClick();
2230  }
2231  REFAPP_END_METHOD();
2232 }
2233 
2234 void SampleForm::TextBoxSetTextCallback(cli::array<System::Object^>^ arr)
2235 {
2236  REFAPP_START_METHOD();
2237  if (arr == nullptr || arr->Length != 2)
2238  {
2239  REFAPP_END_METHOD();
2240  return;
2241  }
2242 
2243  System::Windows::Forms::TextBox^ parentTextBox = dynamic_cast<System::Windows::Forms::TextBox^>(arr[0]);
2244  System::Windows::Forms::TextBox^ textBox = dynamic_cast<System::Windows::Forms::TextBox^>(arr[1]);
2245 
2246  if (parentTextBox == nullptr || textBox == nullptr)
2247  {
2248  REFAPP_END_METHOD();
2249  return;
2250  }
2251 
2252  parentTextBox->Text = textBox->Text;
2253  REFAPP_END_METHOD();
2254 }
2255 
2256 void SampleForm::ParentTextBoxSetTextCallback(System::Object^ state)
2257 {
2258  REFAPP_START_METHOD();
2259  cli::array<System::Object^>^ arr = dynamic_cast<cli::array<System::Object^>^>(state);
2260  if (arr == nullptr || arr->Length != 2)
2261  {
2262  REFAPP_END_METHOD();
2263  return;
2264  }
2265 
2266  System::Windows::Forms::TextBox^ parentTextBox = dynamic_cast<System::Windows::Forms::TextBox^>(arr[0]);
2267  System::Windows::Forms::TextBox^ textBox = dynamic_cast<System::Windows::Forms::TextBox^>(arr[1]);
2268 
2269  if (parentTextBox == nullptr || textBox == nullptr)
2270  {
2271  REFAPP_END_METHOD();
2272  return;
2273  }
2274 
2275  if (parentTextBox->InvokeRequired)
2276  {
2277  piml->CreatorForm->Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::TextBoxSetTextCallback), gcnew cli::array<System::Object^>{arr});
2278  }
2279  else
2280  {
2281  TextBoxSetTextCallback(arr);
2282  }
2283  REFAPP_END_METHOD();
2284 }
2285 
2286 void SampleForm::CheckBoxSetCheckStateCallback(cli::array<System::Object^>^ arr)
2287 {
2288  REFAPP_START_METHOD();
2289  if (arr == nullptr || arr->Length != 2)
2290  {
2291  REFAPP_END_METHOD();
2292  return;
2293  }
2294 
2295  System::Windows::Forms::CheckBox^ parentCheckBox = dynamic_cast<System::Windows::Forms::CheckBox^>(arr[0]);
2296  System::Windows::Forms::CheckBox^ checkBox = dynamic_cast<System::Windows::Forms::CheckBox^>(arr[1]);
2297  if (parentCheckBox == nullptr || checkBox == nullptr)
2298  {
2299  REFAPP_END_METHOD();
2300  return;
2301  }
2302 
2303  parentCheckBox->CheckState = checkBox->CheckState;
2304  REFAPP_END_METHOD();
2305 }
2306 
2307 void SampleForm::ParentCheckBoxSetCheckStateCallback(System::Object^ state)
2308 {
2309  REFAPP_START_METHOD();
2310  cli::array<System::Object^>^ arr = dynamic_cast<cli::array<System::Object^>^>(state);
2311  if (arr == nullptr || arr->Length != 2)
2312  {
2313  REFAPP_END_METHOD();
2314  return;
2315  }
2316 
2317  System::Windows::Forms::CheckBox^ parentCheckBox = dynamic_cast<System::Windows::Forms::CheckBox^>(arr[0]);
2318  System::Windows::Forms::CheckBox^ checkBox = dynamic_cast<System::Windows::Forms::CheckBox^>(arr[1]);
2319 
2320  if (parentCheckBox == nullptr || checkBox == nullptr)
2321  {
2322  REFAPP_END_METHOD();
2323  return;
2324  }
2325 
2326  if (checkBox->InvokeRequired)
2327  {
2328  piml->CreatorForm->Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::CheckBoxSetCheckStateCallback), gcnew cli::array<System::Object^>{arr});
2329  }
2330  else
2331  {
2332  CheckBoxSetCheckStateCallback(arr);
2333  }
2334  REFAPP_END_METHOD();
2335 }
2336 
2337 void SampleForm::ComboBoxSetIndexCallback(cli::array<System::Object^>^ arr)
2338 {
2339  REFAPP_START_METHOD();
2340  if (arr == nullptr || arr->Length != 2)
2341  {
2342  REFAPP_END_METHOD();
2343  return;
2344  }
2345 
2346  System::Windows::Forms::ComboBox^ parentComboBox = dynamic_cast<System::Windows::Forms::ComboBox^>(arr[0]);
2347  System::Windows::Forms::ComboBox^ comboBox = dynamic_cast<System::Windows::Forms::ComboBox^>(arr[1]);
2348 
2349  if (parentComboBox == nullptr || comboBox == nullptr)
2350  {
2351  REFAPP_END_METHOD();
2352  return;
2353  }
2354 
2355  parentComboBox->SelectedIndex = comboBox->SelectedIndex;
2356  REFAPP_END_METHOD();
2357 }
2358 
2359 void SampleForm::ParentComboBoxSetIndexCallback(System::Object^ state)
2360 {
2361  REFAPP_START_METHOD();
2362  cli::array<System::Object^>^ arr = dynamic_cast<cli::array<System::Object^>^>(state);
2363  if (arr == nullptr || arr->Length != 2)
2364  {
2365  REFAPP_END_METHOD();
2366  return;
2367  }
2368 
2369  System::Windows::Forms::ComboBox^ parentComboBox = dynamic_cast<System::Windows::Forms::ComboBox^>(arr[0]);
2370  System::Windows::Forms::ComboBox^ comboBox = dynamic_cast<System::Windows::Forms::ComboBox^>(arr[1]);
2371 
2372  if (parentComboBox == nullptr || comboBox == nullptr)
2373  {
2374  return;
2375  }
2376 
2377  if (parentComboBox->InvokeRequired)
2378  {
2379  piml->CreatorForm->Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::ComboBoxSetIndexCallback), gcnew cli::array<System::Object^>{arr});
2380  }
2381  else
2382  {
2383  ComboBoxSetIndexCallback(arr);
2384  }
2385  REFAPP_END_METHOD();
2386 }
2387 
2388 System::Void SampleForm::buttonBrowseTraceFolder_Click(System::Object^ sender, System::EventArgs^ e)
2389 {
2390  REFAPP_START_METHOD();
2391  folderBrowserDialog1->SelectedPath = textBoxTraceFolder->Text;
2392  folderBrowserDialog1->ShowNewFolderButton = true;
2393 
2394  System::Windows::Forms::DialogResult result = folderBrowserDialog1->ShowDialog();
2395  if (result == System::Windows::Forms::DialogResult::OK)
2396  {
2397  textBoxTraceFolder->Text = folderBrowserDialog1->SelectedPath;
2398  }
2399  REFAPP_END_METHOD();
2400 }
2401 
2402 System::Void SampleForm::buttonOpenTraceFolder_Click(System::Object^ sender, System::EventArgs^ e)
2403 {
2404  REFAPP_START_METHOD();
2405  System::String^ path = textBoxTraceFolder->Text;
2406  if (System::IO::Directory::Exists(path))
2407  {
2408  System::Diagnostics::Process::Start(path);
2409  }
2410  REFAPP_END_METHOD();
2411 }
2412 
2413 // This will not automatically update GUI if it is modified internally
2414 System::Void SampleForm::textBoxTraceFolder_TextChanged(System::Object^ sender, System::EventArgs^ e)
2415 {
2416  REFAPP_START_METHOD();
2417  if (piml == nullptr || piml->GlobalRuntimeManager == nullptr)
2418  {
2419  REFAPP_END_METHOD();
2420  return;
2421  }
2422 
2423  std::string path = Util::Util::ToString(textBoxTraceFolder->Text);
2424 
2425  if (path._Equal(RuntimeConfig::GetInstance().GetTraceFolder()) == false)
2426  {
2427  if (System::IO::Directory::Exists(Util::Util::ToString(path)))
2428  {
2429  RuntimeConfig::GetInstance().SetTraceFolder(Util::Util::ToString(textBoxTraceFolder->Text));
2430  buttonOpenTraceFolder->Enabled = true;
2431 
2432  PrintTextCallback("Set trace folder to " + Util::Util::ToString(RuntimeConfig::GetInstance().GetTraceFolder()));
2433  }
2434  else
2435  {
2436  buttonOpenTraceFolder->Enabled = false;
2437  }
2438  }
2439  else
2440  {
2441  buttonOpenTraceFolder->Enabled = true;
2442  }
2443 
2444  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm.get()->textBoxTraceFolder : nullptr, textBoxTraceFolder);
2445  REFAPP_END_METHOD();
2446 }
2447 
2448 // This will not automatically update GUI if it is modified internally
2449 System::Void SampleForm::comboBoxTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
2450 {
2451  REFAPP_START_METHOD();
2452  if (piml->GlobalRuntimeManager == nullptr)
2453  {
2454  REFAPP_END_METHOD();
2455  return;
2456  }
2457 
2458  TraceLevels traceLevel = Util::Util::ToTraceLevel(comboBoxTraceLevel->SelectedItem->ToString());
2459  if (traceLevel == RuntimeConfig::GetInstance().GetTraceLevel())
2460  {
2461  REFAPP_END_METHOD();
2462  return;
2463  }
2464 
2465  RuntimeConfig::GetInstance().SetTraceLevel(traceLevel);
2466  PrintTextCallback("Updated trace level");
2467  REFAPP_END_METHOD();
2468 }
2469 
2470 System::Void SampleForm::buttonBrowseFile_Click(System::Object^ sender, System::EventArgs^ e)
2471 {
2472  REFAPP_START_METHOD();
2473  System::Windows::Forms::DialogResult result = openFileDialog1->ShowDialog();
2474  if (result == System::Windows::Forms::DialogResult::OK)
2475  {
2476  cbFilePath->Text = openFileDialog1->FileName;
2477 
2478  buttonReload->PerformClick();
2479  }
2480  REFAPP_END_METHOD();
2481 }
2482 
2483 System::Void SampleForm::cbFilePath_TextChanged(System::Object^ sender, System::EventArgs^ e)
2484 {
2485  REFAPP_START_METHOD();
2486  AddComboBoxFileOrPath(cbFilePath);
2487 
2488  if (System::String::IsNullOrWhiteSpace(cbFilePath->Text) || !System::IO::File::Exists(cbFilePath->Text->Trim()))
2489  {
2490  buttonReload->Enabled = false;
2491  }
2492  else
2493  {
2494  buttonReload->Enabled = true;
2495  }
2496 
2497  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->cbFilePath : nullptr, cbFilePath);
2498  REFAPP_END_METHOD();
2499 }
2500 
2501 System::Void SampleForm::cbFilePath_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
2502 {
2503  REFAPP_START_METHOD();
2504  if (System::String::IsNullOrWhiteSpace(cbFilePath->Text) || !System::IO::File::Exists(cbFilePath->Text->Trim()))
2505  {
2506  buttonReload->Enabled = false;
2507  }
2508  else
2509  {
2510  buttonReload->Enabled = true;
2511  if (piml->IsPathChanging == false)
2512  {
2513  buttonReload->PerformClick();
2514  }
2515  }
2516 
2517  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->cbFilePath : nullptr, cbFilePath);
2518  REFAPP_END_METHOD();
2519 }
2520 
2521 System::Void SampleForm::buttonReload_Click(System::Object^ sender, System::EventArgs^ e)
2522 {
2523  REFAPP_START_METHOD();
2524  LoadContextFile(piml->GlobalRuntimeManager);
2525 
2526  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonReload : nullptr);
2527  REFAPP_END_METHOD();
2528 }
2529 
2530 void SampleForm::LoadContextFile(std::shared_ptr<IRuntimeManager> runtimeManager)
2531 {
2532  REFAPP_START_METHOD();
2533  if (System::String::IsNullOrWhiteSpace(cbFilePath->Text))
2534  {
2535  REFAPP_END_METHOD();
2536  return;
2537  }
2538 
2539  PrintTextCallback("Load '" + cbFilePath->Text + "'...");
2540 
2541  if (runtimeManager == nullptr)
2542  {
2543  PrintTextCallback("... No RuntimeManager exists!");
2544  REFAPP_END_METHOD();
2545  return;
2546  }
2547 
2548  if (System::String::IsNullOrWhiteSpace(cbFilePath->Text->Trim()))
2549  {
2550  PrintTextCallback(".. wrong file name.");
2551  REFAPP_END_METHOD();
2552  return;
2553  }
2554 
2555  SetTitle(Util::Util::ToString(piml->Title));
2556 
2557  try
2558  {
2559  // TODO: move these 3 set up away
2560  piml->IsLoadding = true;
2561  piml->PlayerProject = nullptr;
2562  piml->Project = nullptr;
2563  piml->ContextVariableImplementation->ResetAllValues();
2564  piml->StateVariableImplementation->ResetAllValues();
2565  ClearSampleGUI();
2566 
2567  System::String^ filePathExtension = System::IO::Path::GetExtension(cbFilePath->Text->Trim());
2568  if (filePathExtension->Contains("ptx"))
2569  {
2570  piml->Project = LoadPtx(runtimeManager);
2571 
2572  if (IS_NOT_NULL(piml->Project)) // TODO: might be obsolete in the future
2573  {
2574  PrintTextCallback("... Project '" + Util::Util::ToString(piml->Project->GetName()) + "' successfully loaded.");
2575 
2576  ClearCustomImplemetationCaches();
2577 
2578  LoadPackage(piml->Project);
2579 
2580  ReadSettings(piml->Project->GetSettings());
2581 
2582  piml->IsLoadding = false;
2583  REFAPP_END_METHOD();
2584  return;
2585  }
2586  }
2587  else if (filePathExtension->Contains("ppx"))
2588  {
2589  piml->PlayerProject = LoadPpx(runtimeManager);
2590 
2591  if (IS_NOT_NULL(piml->PlayerProject)) // TODO: might be obsolete in the future
2592  {
2593  ClearCustomImplemetationCaches();
2594 
2595  PrintTextCallback("... Player '" + Util::Util::ToString(piml->PlayerProject->GetName()) + "' successfully loaded.");
2596 
2597  std::vector<std::shared_ptr<Project::IProject>> projects = piml->PlayerProject->GetProjects();
2598  for (int i = 0; i < projects.size(); i++)
2599  {
2600  piml->Project = projects[i]; // TODO: what is this?
2601  LoadPackage(projects[i]);
2602  }
2603 
2604  ReadSettings(piml->PlayerProject->GetSettings());
2605 
2606  piml->IsLoadding = false;
2607  REFAPP_END_METHOD();
2608  return;
2609  }
2610  }
2611  }
2612  catch (const std::exception& ex)
2613  {
2614  PrintException(ex);
2615  }
2616  catch (System::Exception^ ex)
2617  {
2618  PrintException(ex);
2619  }
2620 
2621  piml->IsLoadding = false;
2622  REFAPP_END_METHOD();
2623 }
2624 
2625 void SampleForm::ClearSampleGUI()
2626 {
2627  treeViewOtxProject->Nodes->Clear();
2628  gridViewParameter->Rows->Clear();
2629  gridViewContext->Rows->Clear();
2630  gridViewState->Rows->Clear();
2631  gridViewSettings->Rows->Clear();
2632 }
2633 
2634 void SampleForm::ClearCustomImplemetationCaches()
2635 {
2636  piml->ClearCustomImplemetationCaches();
2637 }
2638 
2639 // TODO: refactor
2640 std::shared_ptr<Project::IProject> SampleForm::LoadPtx(std::shared_ptr<IRuntimeManager> runtimeManager)
2641 {
2642  REFAPP_START_METHOD();
2643  std::shared_ptr<Project::IProject> project = nullptr;
2644 
2645  if (runtimeManager->IsProtected(Util::Util::ToString(cbFilePath->Text)))
2646  {
2647  project = runtimeManager->LoadPtx(Util::Util::ToString(cbFilePath->Text),
2648  Util::Util::ToString(txtPassword->Text->Trim()));
2649  }
2650  else
2651  {
2652  project = runtimeManager->LoadPtx(Util::Util::ToString(cbFilePath->Text));
2653  }
2654 
2655  if (project->GetMainProcedure() != nullptr)
2656  {
2657  buttonExecuteMain->Enabled = true;
2658  }
2659 
2660  REFAPP_END_METHOD();
2661  return project;
2662 }
2663 
2664 // TODO: refactor
2665 std::shared_ptr<Project::IPlayerProject> SampleForm::LoadPpx(std::shared_ptr<IRuntimeManager> runtimeManager)
2666 {
2667  REFAPP_START_METHOD();
2668  std::shared_ptr<Project::IPlayerProject> playerProject = nullptr;
2669 
2670  if (runtimeManager->IsProtected(Util::Util::ToString(cbFilePath->Text)))
2671  {
2672  playerProject = runtimeManager->LoadPpx(
2673  Util::Util::ToString(cbFilePath->Text),
2674  Util::Util::ToString(txtPassword->Text->Trim()));
2675  }
2676  else
2677  {
2678  playerProject = runtimeManager->LoadPpx(
2679  Util::Util::ToString(cbFilePath->Text));
2680  }
2681 
2682  REFAPP_END_METHOD();
2683  return playerProject;
2684 }
2685 
2686 // TODO: refactor
2687 void SampleForm::LoadPackage(std::shared_ptr<Project::IProject> project)
2688 {
2689  REFAPP_START_METHOD();
2690  PrintTextCallback("Browse project...");
2691 
2692  std::vector<std::shared_ptr<Otx::Runtime::Api::Otx::IPackage>> packages = project->GetPackages();
2693  if (packages.size() == 0)
2694  {
2695  std::shared_ptr<IDocument> document = project->GetStartupDocument();
2696  treeViewOtxProject->Nodes->Add(CreateDocumentNode(document));
2697  }
2698  else
2699  {
2700  System::String^ treeNodeText = Util::Util::ToString(project->GetName());
2701  if (!System::String::IsNullOrWhiteSpace(Util::Util::ToString(piml->Project->GetVersion())))
2702  {
2703  treeNodeText = System::String::Format("{0} ({1})", treeNodeText, Util::Util::ToString(project->GetVersion()));
2704  }
2705 
2706  System::Windows::Forms::TreeNode^ root = gcnew System::Windows::Forms::TreeNode(treeNodeText);
2707  root->ImageKey = "ODFProject.bmp"; // TODO: move
2708  root->SelectedImageKey = "Package.bmp"; // TODO: move
2709  for (int i = 0; i < packages.size(); i++)
2710  {
2711  root->Nodes->Add(CreatePackageNode(packages[i]));
2712  }
2713 
2714  treeViewOtxProject->Nodes->Add(root);
2715  }
2716 
2717  treeViewOtxProject->Enabled = true;
2718  gridViewParameter->Enabled = true;
2719  treeViewOtxProject->ExpandAll();
2720  treeViewOtxProject->SelectedNode = piml->StartUpNode.get();
2721  treeViewOtxProject->Focus();
2722 
2723  PrintTextCallback("... project browsing finished.");
2724  REFAPP_END_METHOD();
2725 }
2726 
2727 // TODO: refactor
2728 System::Windows::Forms::TreeNode^ SampleForm::CreateDocumentNode(std::shared_ptr<Otx::Runtime::Api::Otx::IDocument> doc)
2729 {
2730  REFAPP_START_METHOD();
2731  System::Windows::Forms::TreeNode^ documentNode = gcnew System::Windows::Forms::TreeNode(Util::Util::ToString(doc->GetName()));
2732  documentNode->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IDocument>>(doc);
2733  documentNode->ImageKey = "DocumentOTX16.bmp";
2734  documentNode->SelectedImageKey = "DocumentOTX16.bmp";
2735  if (doc->IsStartup())
2736  {
2737  documentNode->Text += " (StartUp)";
2738  }
2739 
2740  std::vector<std::shared_ptr<Otx::Runtime::Api::Otx::IProcedure>> procedures = doc->GetProcedures();
2741  for (int i = 0; i < procedures.size(); i++)
2742  {
2743  System::Windows::Forms::TreeNode^ procedureNode = CreateProcedureName(procedures[i]);
2744  documentNode->Nodes->Add(procedureNode);
2745  if (doc->IsStartup() && procedures[i]->GetName()._Equal("main"))
2746  {
2747  piml->StartUpNode = procedureNode;
2748  buttonExecuteMain->Enabled = true;
2749  }
2750  else if (IS_NULL(piml->StartUpNode))
2751  {
2752  piml->StartUpNode = procedureNode;
2753  }
2754  }
2755 
2756  REFAPP_END_METHOD();
2757  return documentNode;
2758 }
2759 
2760 // TODO: refactor
2761 System::Windows::Forms::TreeNode^ SampleForm::CreateProcedureName(std::shared_ptr<Otx::Runtime::Api::Otx::IProcedure> proc)
2762 {
2763  REFAPP_START_METHOD();
2764  if (checkBoxCyclicReload->Checked &&
2765  IS_NOT_NULL(piml->ProcedureToExecute) &&
2766  piml->ProcedureToExecute->GetFullName()._Equal(proc->GetFullName()))
2767  {
2768  piml->ProcedureToExecute = proc;
2769  }
2770 
2771  System::Windows::Forms::TreeNode^ procedureNode = gcnew System::Windows::Forms::TreeNode(Util::Util::ToString(proc->GetName()));
2772  procedureNode->ImageKey = "Procedure.bmp"; // TODO: move
2773  procedureNode->SelectedImageKey = "Procedure.bmp"; // TODO: move
2774  procedureNode->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IProcedure>>(proc);
2775  REFAPP_END_METHOD();
2776  return procedureNode;
2777 }
2778 
2779 System::Windows::Forms::TreeNode^ SampleForm::CreatePackageNode(std::shared_ptr<Otx::Runtime::Api::Otx::IPackage> pack)
2780 {
2781  REFAPP_START_METHOD();
2782  System::Windows::Forms::TreeNode^ packageNode = gcnew System::Windows::Forms::TreeNode(Util::Util::ToString(pack->GetName()));
2783  packageNode->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IPackage>>(pack);
2784  packageNode->ImageKey = "Package.bmp"; // TODO: move
2785  packageNode->SelectedImageKey = "Package.bmp"; // TODO: move
2786 
2787  std::vector<std::shared_ptr<Otx::Runtime::Api::Otx::IDocument>> documents = pack->GetDocuments();
2788  for (int i = 0; i < documents.size(); i++)
2789  {
2790  packageNode->Nodes->Add(CreateDocumentNode(documents[i]));
2791  }
2792 
2793  std::vector<std::shared_ptr<IPackage>> packages = pack->GetPackages();
2794  for (int i = 0; i < packages.size(); i++)
2795  {
2796  packageNode->Nodes->Add(CreatePackageNode(packages[i]));
2797  }
2798 
2799  REFAPP_END_METHOD();
2800  return packageNode;
2801 }
2802 
2803 System::Void SampleForm::gridView_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
2804 {
2805  REFAPP_START_METHOD();
2806  try
2807  {
2808  if (e != nullptr)
2809  {
2810  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2811  System::Windows::Forms::DataGridViewComboBoxCell^ comboBoxCell = dynamic_cast<System::Windows::Forms::DataGridViewComboBoxCell^>(gridView->Rows[e->RowIndex]->Cells[e->ColumnIndex]);
2812  if (comboBoxCell != nullptr)
2813  {
2814  gridView->BeginEdit(true);
2815  dynamic_cast<System::Windows::Forms::DataGridViewComboBoxEditingControl^>(gridView->EditingControl)->DroppedDown = true;
2816  REFAPP_END_METHOD();
2817  return;
2818  }
2819  }
2820  }
2821  catch (...) {}
2822 
2823  gridView_CellValueChanged(sender, e);
2824  REFAPP_END_METHOD();
2825 }
2826 
2827 // Commit new value for gridView's data source (only apply for DataGridViewCheckBoxCell and DataGridViewComboBoxCell)
2828 System::Void SampleForm::gridView_CellValueChanged(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
2829 {
2830  REFAPP_START_METHOD();
2831  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2832  System::String^ columnName;
2833 
2834  if (gridView == gridViewParameter)
2835  {
2836  columnName = dataGridViewTextBoxColumnValue->Name;
2837  }
2838  else if (gridView == gridViewContext)
2839  {
2840  columnName = dataGridViewTextBoxColumnContextValue->Name;
2841  }
2842  else
2843  {
2844  REFAPP_END_METHOD();
2845  return;
2846  }
2847 
2848  if (piml != nullptr &&
2849  !piml->IsLoadding &&
2850  e->RowIndex >= 0 &&
2851  gridView->Columns[e->ColumnIndex]->Name == columnName &&
2852  (
2853  Util::Util::IsInstance<System::Windows::Forms::DataGridViewCheckBoxCell^>(gridView->Rows[e->RowIndex]->Cells[columnName]) ||
2854  Util::Util::IsInstance<System::Windows::Forms::DataGridViewComboBoxCell^>(gridView->Rows[e->RowIndex]->Cells[columnName])
2855  )
2856  )
2857  {
2858  // Force a validation to set the value after CheckBox click
2859  Validate(false);
2860  }
2861  REFAPP_END_METHOD();
2862 }
2863 
2864 // Convert parameter's value into valid string then display it on gridview
2865 System::Void SampleForm::gridViewParameter_CellValidated(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
2866 {
2867  REFAPP_START_METHOD();
2868  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2869  if (piml != nullptr &&
2870  !piml->IsLoadding &&
2871  gridView != nullptr &&
2872  e->RowIndex >= 0 &&
2873  gridView->Columns[e->ColumnIndex]->Name == dataGridViewTextBoxColumnValue->Name)
2874  {
2875  std::shared_ptr<IProcedureParameter> parameter = Util::Util::CastTo<std::shared_ptr<IProcedureParameter>>(gridView->Rows[e->RowIndex]->Tag);
2876 
2877  if (parameter->GetValue() != nullptr)
2878  {
2879  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnValue->Name]->Value = ConvertValue2String(parameter->GetValue());
2880  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnDetails->Name]->Value = GetDetails(parameter->GetValue());
2881  }
2882  }
2883  REFAPP_END_METHOD();
2884 }
2885 
2886 // Trigger if the "value" cell is changed, convert new string into new value,
2887 // then set into corresponding parameter (only apply for IProcedureInParameter and IProcedureInOutParameter)
2888 System::Void SampleForm::gridViewParameter_CellValidating(System::Object^ sender, System::Windows::Forms::DataGridViewCellValidatingEventArgs^ e)
2889 {
2890  REFAPP_START_METHOD();
2891  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2892  if (piml != nullptr &&
2893  !piml->IsLoadding &&
2894  gridView != nullptr &&
2895  e->RowIndex >= 0 &&
2896  gridView->Columns[e->ColumnIndex]->Name == dataGridViewTextBoxColumnValue->Name &&
2897  !gridView->Rows[e->RowIndex]->ReadOnly &&
2898  e->FormattedValue != nullptr)
2899  {
2900  std::shared_ptr<IProcedureParameter> parameter = Util::Util::CastTo<std::shared_ptr<IProcedureParameter>>(gridView->Rows[e->RowIndex]->Tag);
2901  if (e->FormattedValue->ToString() == Util::Util::ToString(DataTypes::ValueConverter::Value2String(parameter->GetValue())) ||
2902  e->FormattedValue->ToString() == ConvertValue2String(parameter->GetValue()))
2903  {
2904  REFAPP_END_METHOD();
2905  return;
2906  }
2907 
2908  std::shared_ptr<DataTypes::Object> value = nullptr;
2909 
2910  try
2911  {
2912  value = DataTypes::ValueConverter::String2Value(Util::Util::ToString(e->FormattedValue->ToString()), parameter->GetDataType());
2913  }
2914  catch (const std::exception& ex)
2915  {
2916  //string errorMsg = ex.GetType().FullName;
2917  //errorMsg += Environment.NewLine;
2918  //errorMsg += ex.Message;
2919  //gridView.Rows[e.RowIndex].Cells[1].ErrorText = errorMsg;
2920  PrintException(ex);
2921  // e.Cancel = true;
2922  REFAPP_END_METHOD();
2923  return;
2924  }
2925  catch (System::Exception^ ex)
2926  {
2927  //string errorMsg = ex.GetType().FullName;
2928  //errorMsg += Environment.NewLine;
2929  //errorMsg += ex.Message;
2930  //gridView.Rows[e.RowIndex].Cells[1].ErrorText = errorMsg;
2931  PrintException(ex);
2932  // e.Cancel = true;
2933  REFAPP_END_METHOD();
2934  return;
2935  }
2936 
2937  if (value == nullptr)
2938  {
2939  System::Media::SystemSounds::Exclamation->Play();
2940  }
2941  else
2942  {
2943  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnDataType->Name]->ErrorText = System::String::Empty;
2944  if (std::shared_ptr<IProcedureInParameter> inParam = std::dynamic_pointer_cast<IProcedureInParameter>(parameter))
2945  {
2946  inParam->SetValue(value);
2947  }
2948  else if (std::shared_ptr<IProcedureInOutParameter> inOutParam = std::dynamic_pointer_cast<IProcedureInOutParameter>(parameter))
2949  {
2950  inOutParam->SetValue(value);
2951  }
2952  }
2953  }
2954  REFAPP_END_METHOD();
2955 }
2956 
2957 System::Void SampleForm::gridViewContextVariable_CellValidated(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
2958 {
2959  REFAPP_START_METHOD();
2960  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2961  if (piml != nullptr &&
2962  !piml->IsLoadding &&
2963  gridView != nullptr &&
2964  e->RowIndex >= 0 &&
2965  gridView->Columns[e->ColumnIndex]->Name == dataGridViewTextBoxColumnContextValue->Name)
2966  {
2967  std::shared_ptr<IContextVariable> context = Util::Util::CastTo<std::shared_ptr<IContextVariable>>(gridView->Rows[e->RowIndex]->Tag);
2968  if (gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag != nullptr)
2969  {
2970  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Value = ConvertValue2String(Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag));
2971  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextDetails->Name]->Value = GetDetails(Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag));
2972  }
2973  }
2974  REFAPP_END_METHOD();
2975 }
2976 
2977 // TODO: refactor. consider update to use together with Parameter validating?
2978 System::Void SampleForm::gridViewContextVariable_CellValidating(System::Object^ sender, System::Windows::Forms::DataGridViewCellValidatingEventArgs^ e)
2979 {
2980  REFAPP_START_METHOD();
2981  System::Windows::Forms::DataGridView^ gridView = dynamic_cast<System::Windows::Forms::DataGridView^>(sender);
2982  if (piml != nullptr &&
2983  !piml->IsLoadding &&
2984  gridView != nullptr &&
2985  e->RowIndex >= 0 &&
2986  gridView->Columns[e->ColumnIndex]->Name == dataGridViewTextBoxColumnContextValue->Name &&
2987  !gridView->Rows[e->RowIndex]->ReadOnly &&
2988  e->FormattedValue != nullptr)
2989  {
2990  std::shared_ptr<IContextVariable> context = Util::Util::CastTo<std::shared_ptr<IContextVariable>>(gridView->Rows[e->RowIndex]->Tag);
2991 
2992  if (e->FormattedValue->ToString() == Util::Util::ToString(DataTypes::ValueConverter::Value2String(Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag))) ||
2993  e->FormattedValue->ToString() == ConvertValue2String(Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag)))
2994  {
2995  REFAPP_END_METHOD();
2996  return;
2997  }
2998 
2999  std::shared_ptr<DataTypes::Object> value = nullptr;
3000 
3001  try
3002  {
3003  value = DataTypes::ValueConverter::String2Value(Util::Util::ToString(e->FormattedValue->ToString()), context->GetDataType());
3004  }
3005  catch (System::Exception^ ex)
3006  {
3007  //string errorMsg = ex.GetType().FullName;
3008  //errorMsg += Environment.NewLine;
3009  //errorMsg += ex.Message;
3010  //gridView.Rows[e.RowIndex].Cells[1].ErrorText = errorMsg;
3011  PrintException(ex);
3012  // e.Cancel = true;
3013  REFAPP_END_METHOD();
3014  return;
3015  }
3016 
3017  if (value == nullptr)
3018  {
3019  System::Media::SystemSounds::Exclamation->Play();
3020  }
3021  else
3022  {
3023  //we will save value with fullName of context, if not the bug of #10798 occurs.
3024  //Because the name of context variable in imported document may have the same name.
3025  std::string fullNameContextVariable = context->GetDocument()->GetFullName() + "." + context->GetName();
3026  piml->ContextVariableImplementation->SetValue(fullNameContextVariable, value);
3027  piml->_ContextVariableOutputImpl->SetValue(fullNameContextVariable, value);
3028  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(value); // used at gridViewContextVariable_CellValidated
3029  gridView->Rows[e->RowIndex]->Cells[dataGridViewTextBoxColumnContextDataType->Name]->ErrorText = System::String::Empty; //refresh error text
3030  }
3031  }
3032  REFAPP_END_METHOD();
3033 }
3034 
3035 System::Void SampleForm::treeViewOtxProject_AfterSelect(System::Object^ sender, System::Windows::Forms::TreeViewEventArgs^ e)
3036 {
3037  REFAPP_START_METHOD();
3038  System::Windows::Forms::TreeNode^ node = e->Node;
3039  if (node != nullptr)
3040  {
3041  // TODO: move to different method
3042  gridViewParameter->Rows->Clear();
3043  gridViewContext->Rows->Clear();
3044  gridViewState->Rows->Clear();
3045 
3046  if (Util::Util::IsInstance<CLRWrapper<std::shared_ptr<IProcedure>>^>(node->Tag))
3047  {
3048  std::shared_ptr<IProcedure> procedure = Util::Util::CastTo<std::shared_ptr<IProcedure>>(node->Tag);
3049  ClearCustomImplemetationCaches();
3050  UpdateGridView(procedure);
3051 
3052  buttonExecuteSelectedProcedure->Enabled = true;
3053  piml->Project = GetProject(procedure); // TODO: why update this???
3054  REFAPP_END_METHOD();
3055  return;
3056  }
3057  }
3058 
3059  buttonExecuteSelectedProcedure->Enabled = false;
3060  REFAPP_END_METHOD();
3061 }
3062 
3063 // TODO: refactor
3064 std::shared_ptr<Project::IProject> SampleForm::GetProject(std::shared_ptr<IProcedure> procedure)
3065 {
3066  REFAPP_START_METHOD();
3067  if (procedure != nullptr)
3068  {
3069  std::shared_ptr<IPackage> package = procedure->GetDocument()->GetPackage();
3070  if (package != nullptr)
3071  {
3072  while (package->GetParent() != nullptr)
3073  {
3074  package = package->GetParent();
3075  }
3076  REFAPP_END_METHOD();
3077  return package->GetProject();
3078  }
3079  }
3080  REFAPP_END_METHOD();
3081  return nullptr;
3082 }
3083 
3084 System::Void SampleForm::treeViewOtxProject_DrawNode(System::Object^ sender, System::Windows::Forms::DrawTreeNodeEventArgs^ e)
3085 {
3086  e->DrawDefault = true;
3087 }
3088 
3089 System::Void SampleForm::buttonReadSettings_Click(System::Object^ sender, System::EventArgs^ e)
3090 {
3091  REFAPP_START_METHOD();
3092  std::map<std::string, std::string> settings;
3093  if (piml->PlayerProject != nullptr)
3094  {
3095  settings = piml->PlayerProject->GetSettings();
3096  }
3097  else
3098  {
3099  settings = piml->Project->GetSettings();
3100  }
3101  ReadSettings(settings);
3102  REFAPP_END_METHOD();
3103 }
3104 
3105 void SampleForm::ReadSettings(std::map<std::string, std::string> settings)
3106 {
3107  REFAPP_START_METHOD();
3108  PrintTextCallback("Read settings");
3109 
3110  gridViewSettings->Rows->Clear();
3111 
3112  for (std::pair<std::string, std::string> it : settings)
3113  {
3114  cli::array<System::String^>^ values = {
3115  Util::Util::ToString(it.first),
3116  Util::Util::ToString(it.second)
3117  };
3118  gridViewSettings->Rows->Add(values);
3119  }
3120  REFAPP_END_METHOD();
3121 }
3122 
3123 // TODO: refactor
3124 System::Void SampleForm::buttonWriteSettings_Click(System::Object^ sender, System::EventArgs^ e)
3125 {
3126  REFAPP_START_METHOD();
3127  System::String^ nameSetting;
3128  System::String^ valueSetting;
3129  int selectedSettingPosition = 0;
3130  std::map<std::string, std::string> newSettings;
3131 
3132  if (gridViewSettings->SelectedRows->Count != 0)
3133  {
3134  selectedSettingPosition = gridViewSettings->SelectedRows[0]->Index;
3135  }
3136 
3137  try
3138  {
3139  if (IS_NOT_NULL(piml->Project) || IS_NOT_NULL(piml->PlayerProject))
3140  {
3141  for (int i = 0; i < gridViewSettings->Rows->Count; i++)
3142  {
3143  nameSetting = gridViewSettings->Rows[i]->Cells[dataGridViewTextBoxColumnSettingName->Name]->Value->ToString();
3144 
3145  System::Object^ cellSettingValueValue = gridViewSettings->Rows[i]->Cells[dataGridViewTextBoxColumnSettingValue->Name]->Value;
3146  valueSetting = cellSettingValueValue == nullptr ? nullptr : cellSettingValueValue->ToString();
3147 
3148  newSettings.insert({ Util::Util::ToString(nameSetting),Util::Util::ToString(valueSetting) });
3149  }
3150 
3151  if (piml->PlayerProject != nullptr)
3152  {
3153  piml->PlayerProject->SetSettings(newSettings);
3154  ReadSettings(piml->PlayerProject->GetSettings()); //Refresh gridViewSettings
3155  }
3156  else
3157  {
3158  piml->Project->SetSettings(newSettings);
3159  ReadSettings(piml->Project->GetSettings()); //Refresh gridViewSettings
3160  }
3161  // focus on previous selected row
3162  gridViewSettings->Rows[selectedSettingPosition]->Selected = true;
3163  gridViewSettings->Rows[selectedSettingPosition]->Cells[dataGridViewTextBoxColumnSettingValue->Name]->Selected = true;
3164 
3165  PrintTextCallback("Write setting finished");
3166  }
3167  }
3168  catch (const std::exception& ex)
3169  {
3170  PrintException(ex);
3171  }
3172  catch (System::Exception^ ex)
3173  {
3174  PrintException(ex);
3175  }
3176  REFAPP_END_METHOD();
3177 }
3178 
3179 System::Void SampleForm::checkBoxCyclicExecution_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
3180 {
3181  REFAPP_START_METHOD();
3182  checkBoxCyclicReload->Enabled = checkBoxCyclicExecution->Checked;
3183  checkBoxNewRuntimeManager->Enabled = checkBoxCyclicExecution->Checked;
3184 
3185  if (!checkBoxCyclicExecution->Checked)
3186  {
3187  checkBoxCyclicReload->Checked = false;
3188  checkBoxNewRuntimeManager->Checked = false;
3189  }
3190 
3191  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxCyclicExecution : nullptr, checkBoxCyclicExecution);
3192  REFAPP_END_METHOD();
3193 }
3194 
3195 System::Void SampleForm::checkBoxAsyncExecution_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
3196 {
3197  REFAPP_START_METHOD();
3198  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxAsyncExecution : nullptr, checkBoxAsyncExecution);
3199  REFAPP_END_METHOD();
3200 }
3201 
3202 System::Void SampleForm::checkBoxNewRuntimeManager_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
3203 {
3204  REFAPP_START_METHOD();
3205  if (checkBoxNewRuntimeManager->Checked)
3206  {
3207  checkBoxCyclicReload->Checked = true;
3208  }
3209 
3210  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxNewRuntimeManager : nullptr, checkBoxNewRuntimeManager);
3211  REFAPP_END_METHOD();
3212 }
3213 
3214 System::Void SampleForm::checkBoxCyclicReload_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
3215 {
3216  REFAPP_START_METHOD();
3217  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxCyclicReload : nullptr, checkBoxCyclicReload);
3218  REFAPP_END_METHOD();
3219 }
3220 
3221 System::Void SampleForm::buttonExecuteSelectedProcedure_Click(System::Object^ sender, System::EventArgs^ e)
3222 {
3223  REFAPP_START_METHOD();
3224  try
3225  {
3226  if (treeViewOtxProject->SelectedNode != nullptr && Util::Util::IsInstance<CLRWrapper<std::shared_ptr<IProcedure>>^>(treeViewOtxProject->SelectedNode->Tag))
3227  {
3228  std::shared_ptr<IDocument> document = Util::Util::CastTo<std::shared_ptr<IDocument>>(treeViewOtxProject->SelectedNode->Parent->Tag);
3229 
3230  piml->ProcedureToExecute = Util::Util::CastTo<std::shared_ptr<IProcedure>>(treeViewOtxProject->SelectedNode->Tag);
3231  ExecuteProcedure();
3232  }
3233  else
3234  {
3235  PrintTextCallback("Please select Procedure to execute");
3236  }
3237  }
3238  catch (const std::exception& ex)
3239  {
3240  PrintException(ex);
3241  }
3242  catch (System::Exception^ ex)
3243  {
3244  PrintException(ex);
3245  }
3246 
3247  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonExecuteSelectedProcedure : nullptr, nullptr, true);
3248  REFAPP_END_METHOD();
3249 }
3250 
3251 // TODO: refactor
3252 System::Void SampleForm::buttonExecuteMain_Click(System::Object^ sender, System::EventArgs^ e)
3253 {
3254  REFAPP_START_METHOD();
3255  try
3256  {
3257  if (IS_NOT_NULL(piml->Project))
3258  {
3259  treeViewOtxProject->SelectedNode = piml->StartUpNode.get();
3260  piml->ProcedureToExecute = piml->Project->GetMainProcedure();
3261  ExecuteProcedure();
3262  }
3263  else
3264  {
3265  PrintTextCallback("There is no project has been loaded. Please reload the project");
3266  }
3267  }
3268  catch (const std::exception& ex)
3269  {
3270  PrintException(ex);
3271  }
3272  catch (System::Exception^ ex)
3273  {
3274  PrintException(ex);
3275  }
3276 
3277  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonExecuteMain : nullptr, nullptr, true);
3278  REFAPP_END_METHOD();
3279 }
3280 
3281 // TODO: refactor
3282 void SampleForm::ExecuteProcedure()
3283 {
3284  REFAPP_START_METHOD();
3285  unsigned long long timeOut = 0;
3286  PrintTextCallback("Start procedure execution...");
3287 
3288  if (checkBoxAsyncExecution->Checked == false)
3289  {
3290  buttonExecuteMain->Enabled = false;
3291  buttonExecuteSelectedProcedure->Enabled = false;
3292  }
3293 
3294  try
3295  {
3296  if (IS_NOT_NULL(piml->GlobalRuntimeManager) && IS_NOT_NULL(piml->ProcedureToExecute))
3297  {
3298  buttonStop->Enabled = true;
3299 
3300  CheckBatteryIgnitionState(piml->GlobalRuntimeManager);
3301 
3302  if (checkBoxCyclicExecution->Checked)
3303  {
3304  System::Threading::ThreadPool::QueueUserWorkItem(gcnew System::Threading::WaitCallback(this, &SampleForm::DoCyclic), nullptr);
3305  }
3306  else
3307  {
3308  if (System::UInt64::TryParse(textBoxTimeout->Text->Trim(), timeOut) == false) {
3309  timeOut = 0;
3310  }
3311 
3312  //OtxDiagManager.OtxDiagApi.License.LicenseManager.SetLicenseKey(SampleConstants.LICENSE_KEY);
3313  if (checkBoxAsyncExecution->Checked)
3314  {
3315  piml->GlobalRuntimeManager->ExecuteAsync(
3316  Util::Util::ToString(textBoxRuntimeContextName->Text->Trim()),
3317  piml->ProcedureToExecute,
3318  piml->ExpectedConnectionState,
3319  timeOut
3320  );
3321  }
3322  else
3323  {
3324  cli::array<System::Object^>^ args = gcnew cli::array<System::Object^>(4);
3325  args[0] = textBoxRuntimeContextName->Text->Trim();
3326  args[1] = gcnew CLRWrapper<std::shared_ptr<IProcedure>>(piml->ProcedureToExecute);
3327  args[2] = (int)piml->ExpectedConnectionState;
3328  args[3] = timeOut;
3329 
3330  System::Threading::Tasks::Task::Factory->StartNew(
3331  CallbackToAction::Convert(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::ExecuteProcedureSync),
3332  args));
3333  }
3334  }
3335  }
3336  else
3337  {
3338  PrintTextCallback("RuntimeManager is null or no Procedure is selected to run.");
3339  }
3340  }
3341  catch (System::Exception^ ex)
3342  {
3343  PrintException(ex);
3344 
3345  UpdateButtonStateAfterThrowException();
3346  }
3347  REFAPP_END_METHOD();
3348 }
3349 
3350 void SampleForm::ExecuteProcedureSync(cli::array<System::Object^>^ args)
3351 {
3352  REFAPP_START_METHOD();
3353  if (args->Length != 4)
3354  {
3355  REFAPP_END_METHOD();
3356  return;
3357  }
3358 
3359  System::String^ runtimeContextName = dynamic_cast<System::String^>(args[0]);
3360  std::shared_ptr<IProcedure> procedureWrapper = Util::Util::CastTo<std::shared_ptr<IProcedure>>(args[1]);
3361  int expectedState = safe_cast<int>(args[2]);
3362  unsigned long long timeout = safe_cast<unsigned long long>(args[3]);
3363 
3364  if (procedureWrapper == nullptr)
3365  {
3366  REFAPP_END_METHOD();
3367  return;
3368  }
3369 
3370  piml->GlobalRuntimeManager->Execute(
3371  Util::Util::ToString(runtimeContextName),
3372  procedureWrapper,
3373  (ExpectedState)expectedState,
3374  timeout);
3375  REFAPP_END_METHOD();
3376 }
3377 
3378 void SampleForm::UpdateButtonStateAfterThrowException()
3379 {
3380  REFAPP_START_METHOD();
3381 #pragma region C++ for initialize resource
3382  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
3383 #pragma endregion
3384 
3385  buttonExecuteMain->Enabled = !checkBoxAsyncExecution->Checked;
3386  buttonExecuteSelectedProcedure->Enabled = !checkBoxAsyncExecution->Checked;
3387 
3388  UpdateExecutionStateButtons(false);
3389  UpdatePauseButton(true, false);
3390 
3391  labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16")));
3392  labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16")));
3393  REFAPP_END_METHOD();
3394 }
3395 
3396 // TODO: refactor
3397 void SampleForm::DoCyclic(System::Object^ args)
3398 {
3399  REFAPP_START_METHOD();
3400  System::DateTime^ startTime = System::DateTime::Now;
3401  unsigned long long timeOut = 0;
3402 
3403  int cyclic = 0;
3404  try
3405  {
3406  while (checkBoxCyclicExecution->Checked)
3407  {
3408  std::shared_ptr<IRuntimeManager> runtimeManager = nullptr;
3409  std::shared_ptr<IRuntimeContext> runtimeContext = nullptr;
3410 
3411  cyclic++;
3412  piml->CyclicExecutionCount++;
3413 
3414  if (checkBoxNewRuntimeManager->Checked)
3415  {
3416  runtimeManager = CreateRuntimeManager();
3417  }
3418  else
3419  {
3420  runtimeManager = piml->GlobalRuntimeManager;
3421  }
3422 
3423  CheckCyclicReloadOrNewRuntimeManager(runtimeManager);
3424 
3425  piml->CyclicExecuteAsyncIsProcessing = true;
3426  CheckBatteryIgnitionState(piml->GlobalRuntimeManager);
3427 
3428  if (System::UInt64::TryParse(textBoxTimeout->Text->Trim(), timeOut) == false)
3429  {
3430  timeOut = 0;
3431  }
3432 
3433  if (checkBoxAsyncExecution->Checked)
3434  {
3435  runtimeContext = runtimeManager->ExecuteAsync(
3436  Util::Util::ToString(textBoxRuntimeContextName->Text->Trim()),
3437  piml->ProcedureToExecute,
3438  piml->ExpectedConnectionState,
3439  timeOut
3440  );
3441  if (runtimeContext != nullptr)
3442  {
3443  //Let it break for a little bit to avoid freezing the GUI
3444  System::Windows::Forms::Application::DoEvents();
3445  System::Threading::Thread::Sleep(50);
3446  }
3447  }
3448  else
3449  {
3450  runtimeContext = runtimeManager->Execute(
3451  Util::Util::ToString(textBoxRuntimeContextName->Text->Trim()),
3452  piml->ProcedureToExecute,
3453  piml->ExpectedConnectionState,
3454  timeOut
3455  );
3456  }
3457 
3458  if (runtimeContext->GetExecutionState() == ExecutionState::Stopped)
3459  {
3460  piml->CyclicExecutionCount = 0;
3461  break;
3462  }
3463  }
3464  }
3465  catch (System::Exception^ ex)
3466  {
3467  PrintException(ex);
3468 
3469  UpdateButtonStateAfterThrowException();
3470  }
3471 
3472  //TODO: Do we need to load this again?
3473  Invoke(gcnew System::Action<CLRWrapper<std::shared_ptr<IRuntimeManager>>^>(this, &SampleForm::ReloadContextFileCallback), gcnew CLRWrapper<std::shared_ptr<IRuntimeManager>>(piml->GlobalRuntimeManager));
3474 
3475  PrintTextCallback("Cyclic execution finished");
3476 
3477  System::TimeSpan duration = System::TimeSpan(System::DateTime::Now.Ticks - startTime->Ticks);
3478  System::String^ text = System::String::Format("Execution Statistics: Duration {0} (hh:mm:ss) with {1} cycles and {2:0} ms per cycle",
3479  duration.ToString("hh':'mm':'ss"), cyclic, duration.TotalMilliseconds / cyclic);
3480 
3481  piml->CyclicExecutionCount -= cyclic;
3482  if (piml->CyclicExecutionCount < 0)
3483  {
3484  piml->CyclicExecutionCount = 0;
3485  }
3486 
3487  if (checkBoxAdd2Output->Checked)
3488  {
3489  PrintTextCallback(text);
3490  }
3491  else
3492  {
3493  System::Windows::Forms::MessageBox::Show(text);
3494  }
3495  REFAPP_END_METHOD();
3496 }
3497 
3498 void SampleForm::WaitCyclicExecuteAsyncIsProcessing()
3499 {
3500  REFAPP_START_METHOD();
3501  if (checkBoxCyclicReload->Checked || checkBoxNewRuntimeManager->Checked)
3502  {
3503  // OR while(!piml->RuntimeContext->IsFinished() || piml->RuntimeContext->IsStopped())
3504  while (piml->CyclicExecuteAsyncIsProcessing)
3505  {
3506  //detail in #10461
3507  System::Windows::Forms::Application::DoEvents();
3508  System::Threading::Thread::Sleep(50);
3509  }
3510  }
3511  REFAPP_END_METHOD();
3512 }
3513 
3514 void SampleForm::CheckCyclicReloadOrNewRuntimeManager(std::shared_ptr<IRuntimeManager> runtimeManager)
3515 {
3516  REFAPP_START_METHOD();
3517  CheckCyclicReloadOrNewRuntimeManager(runtimeManager, true);
3518  REFAPP_END_METHOD();
3519 }
3520 
3521 void SampleForm::CheckCyclicReloadOrNewRuntimeManager(std::shared_ptr<IRuntimeManager> runtimeManager, bool waitCyclic)
3522 {
3523  REFAPP_START_METHOD();
3524  if (waitCyclic)
3525  {
3526  WaitCyclicExecuteAsyncIsProcessing();
3527  }
3528 
3529  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
3530  arr[0] = gcnew CLRWrapper<std::shared_ptr<IRuntimeManager>>(runtimeManager);
3531  arr[1] = waitCyclic;
3532 
3533  if (InvokeRequired)
3534  {
3535  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::CheckCyclicReloadOrNewRuntimeManagerCallback), gcnew cli::array<System::Object^>{arr});
3536  }
3537  else
3538  {
3539  CheckCyclicReloadOrNewRuntimeManagerCallback(arr);
3540  }
3541  REFAPP_END_METHOD();
3542 }
3543 
3544 void SampleForm::CheckCyclicReloadOrNewRuntimeManagerCallback(cli::array<System::Object^>^ arr)
3545 {
3546  REFAPP_START_METHOD();
3547  if (arr == nullptr || arr->Length != 2)
3548  {
3549  REFAPP_END_METHOD();
3550  return;
3551  }
3552 
3553  std::shared_ptr<IRuntimeManager> runtimeManager = Util::Util::CastTo<std::shared_ptr<IRuntimeManager>>(arr[0]);
3554  System::Boolean^ waitCyclic = dynamic_cast<System::Boolean^>(arr[1]);
3555 
3556  if (runtimeManager == nullptr || waitCyclic == nullptr)
3557  {
3558  REFAPP_END_METHOD();
3559  return;
3560  }
3561 
3562  if (checkBoxCyclicReload->Checked || checkBoxNewRuntimeManager->Checked)
3563  {
3564  LoadContextFile(runtimeManager);
3565  }
3566 
3567  if (checkBoxCyclicExecution->Checked)
3568  {
3569  checkBoxCyclicExecution->Text = "Cyclic (" + piml->CyclicExecutionCount.ToString() + ")";
3570  }
3571  else
3572  {
3573  checkBoxCyclicExecution->Text = "Cyclic";
3574  }
3575  REFAPP_END_METHOD();
3576 }
3577 
3578 // TODO: refactor
3579 System::Void SampleForm::buttonStop_Click(System::Object^ sender, System::EventArgs^ e)
3580 {
3581  REFAPP_START_METHOD();
3582  if (piml->GlobalRuntimeManager != nullptr)
3583  {
3584  PrintTextCallback("Try to stop all running procedures...");
3585  piml->GlobalRuntimeManager->StopAll();
3586  piml->ProcedureExecutionCount = 0;
3587  }
3588 
3589  // To make sure that cyclic execution will stop in some cases
3590  checkBoxCyclicExecution->Checked = false;
3591 
3592  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonStop : nullptr);
3593  REFAPP_END_METHOD();
3594 }
3595 
3596 void SampleForm::PrintException(System::Exception^ ex)
3597 {
3598  PrintException(ex, "");
3599 }
3600 
3601 void SampleForm::PrintException(System::Exception^ ex, System::String^ additionalText)
3602 {
3603  PrintTextCallback(System::String::Format("!!! {2}{0}: {1}", ex->GetType()->Name, ex->Message, additionalText));
3604  System::Media::SystemSounds::Hand->Play();
3605 }
3606 
3607 void SampleForm::PrintException(const std::exception& ex)
3608 {
3609  PrintException(ex, "");
3610 }
3611 
3612 void SampleForm::PrintException(const std::exception& ex, System::String^ additionalText)
3613 {
3614  PrintTextCallback(System::String::Format("!!! {2}{0}: {1}",
3615  "Exception",
3616  Util::Util::ToString(ex.what()),
3617  additionalText));
3618  System::Media::SystemSounds::Hand->Play();
3619 }
3620 
3621 void SampleForm::PrintTextCallback(System::String^ text)
3622 {
3623  if (InvokeRequired)
3624  {
3625  Invoke(gcnew System::Action<System::String^>(this, &SampleForm::PrintTextCallback), text);
3626  return;
3627  }
3628 
3629  if (!checkBoxAdd2Output->Checked)
3630  {
3631  return;
3632  }
3633 
3634  // TODO: handle multithreading?
3635  msclr::lock l(piml->PrintTextLock.get());
3636  {
3637  if (listBoxOuput->Items->Count >= 10000)
3638  {
3639  buttonClearOutput_Click(nullptr, nullptr);
3640  }
3641 
3642  System::String^ prefixString = GetTimeAndDurationStringSinceLastTimeAndUpdateLastTime();
3643  System::String^ itemToAdd = prefixString + text + "\t\t";
3644 
3645  listBoxOuput->Items->Add(itemToAdd);
3646  listBoxOuput->SelectedItems->Clear();
3647  listBoxOuput->TopIndex = listBoxOuput->Items->Count - 1;
3648 
3649  if (listBoxOuput->Items->Count >= 7500)
3650  {
3651  labelOutputOverflow->Visible = true;
3652  }
3653 
3654  // If many procedures are running simultaneously,
3655  // Stop button or other controls cannot receive events. This code allows controls to receive events.
3656  System::Windows::Forms::Application::DoEvents();
3657  }
3658 }
3659 
3660 System::String^ SampleForm::GetTimeAndDurationStringSinceLastTimeAndUpdateLastTime()
3661 {
3662  System::DateTime^ now = System::DateTime::Now;
3663  System::TimeSpan duration = System::TimeSpan(now->Ticks - piml->LastTime.get()->Ticks);
3664 
3665  piml->LastTime = now;
3666 
3667  System::String^ timeDurationString = System::String::Format("{0:HH:mm:ss.fff} {1,6:#,##0} ms ", now, duration.TotalMilliseconds);
3668  return timeDurationString;
3669 }
3670 
3671 System::Void SampleForm::buttonCopyRow_Click(System::Object^ sender, System::EventArgs^ e)
3672 {
3673  REFAPP_START_METHOD();
3674  if (listBoxOuput->SelectedItems != nullptr)
3675  {
3676  System::String^ text = System::String::Empty;
3677  for (int i = 0; i < listBoxOuput->SelectedItems->Count; i++)
3678  {
3679  text += listBoxOuput->SelectedItems[i]->ToString()->Trim('\t') + "\n";
3680  }
3681 
3682  System::Windows::Forms::Clipboard::SetText(text);
3683  }
3684  REFAPP_END_METHOD();
3685 }
3686 
3687 System::Void SampleForm::buttonClearOutput_Click(System::Object^ sender, System::EventArgs^ e)
3688 {
3689  REFAPP_START_METHOD();
3690  listBoxOuput->Items->Clear();
3691  labelOutputOverflow->Visible = false;
3692  buttonCopyRow->Enabled = false;
3693  REFAPP_END_METHOD();
3694 }
3695 
3696 void SampleForm::UpdateGridView(std::shared_ptr<IProcedure> procedure)
3697 {
3698  REFAPP_START_METHOD();
3699  // || procedure->GetParameters() != nullptr
3700  if (procedure == nullptr)
3701  {
3702  REFAPP_END_METHOD();
3703  return;
3704  }
3705 
3706  UpdateGridviewParameter(procedure);
3707 
3708  std::shared_ptr<Otx::Runtime::Api::Otx::IDocument> document = procedure->GetDocument();
3709  if (IS_NOT_NULL(document))
3710  {
3711  std::vector<std::string> listItemReviewed;
3712  UpdateGridViewContextVariable(document, false, listItemReviewed);
3713 
3714  listItemReviewed.clear();
3715  UpdateGridViewStateVariable(document, false, listItemReviewed);
3716  }
3717  REFAPP_END_METHOD();
3718 }
3719 
3720 void SampleForm::UpdateGridviewParameter(std::shared_ptr<IProcedure> procedure)
3721 {
3722  REFAPP_START_METHOD();
3723  std::vector<std::shared_ptr<IProcedureParameter>> parameters = procedure->GetParameters();
3724  for (int i = 0; i < parameters.size(); i++)
3725  {
3726  UpdateGridviewParameter(parameters[i]);
3727  }
3728  REFAPP_END_METHOD();
3729 }
3730 
3731 // TODO: refactor
3732 void SampleForm::UpdateGridviewParameter(std::shared_ptr<IProcedureParameter> parameter)
3733 {
3734  REFAPP_START_METHOD();
3735  if (IS_NULL(parameter))
3736  {
3737  REFAPP_END_METHOD();
3738  return;
3739  }
3740 
3741  bool bValueWasSet = false;
3742 
3743  // Update existing value
3744  System::String^ collumnName = dataGridViewTextBoxColumnName->Name;
3745  System::String^ collumnValue = dataGridViewTextBoxColumnValue->Name;
3746  System::String^ collumnDetails = dataGridViewTextBoxColumnDetails->Name;
3747  System::Windows::Forms::DataGridViewRowCollection^ rows = gridViewParameter->Rows;
3748  for (int i = 0; i < rows->Count; i++)
3749  {
3750  System::Windows::Forms::DataGridViewRow^ row = rows[i];
3751  if (row->Cells[collumnName]->Value->Equals(Util::Util::ToString(parameter->GetName())))
3752  {
3753  try
3754  {
3755  if (parameter->GetValue() != nullptr)
3756  {
3757  row->Cells[collumnValue]->Value = Util::Util::ToString(ValueConverter::Value2String(parameter->GetValue()));
3758  }
3759  }
3760  catch (System::Exception^ ex)
3761  {
3762  row->Cells[collumnName]->ErrorText = ex->Message;
3763  }
3764 
3765  bValueWasSet = true;
3766  break;
3767  }
3768  }
3769 
3770  // Add value if not exist
3771  if (!bValueWasSet)
3772  {
3773  System::String^ directory = std::dynamic_pointer_cast<IProcedureInParameter>(parameter) ? "In" :
3774  (std::dynamic_pointer_cast<IProcedureInOutParameter>(parameter) ?
3775  "InOut" : "Out");
3776 
3777  cli::array<System::Object^>^ values = {
3778  Util::Util::ToString(parameter->GetName()),
3779  directory,
3780  Util::Util::ToString(parameter->GetDataType())
3781  };
3782  int index = gridViewParameter->Rows->Add(values);
3783 
3784  gridViewParameter->Rows[index]->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IProcedureParameter>>(parameter);
3785 
3786  gridViewParameter->Rows[index]->ReadOnly = std::dynamic_pointer_cast<IProcedureOutParameter>(parameter) != nullptr || parameter->GetInitValue() == nullptr;
3787 
3788  if (parameter->GetDataType()._Equal("Boolean"))
3789  {
3790  System::Windows::Forms::DataGridViewCheckBoxCell^ cell = gcnew System::Windows::Forms::DataGridViewCheckBoxCell();
3791  cell->Value = ConvertValue2String(parameter->GetValue());
3792  cell->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::DataTypes::Object>>(parameter->GetValue());
3793  cell->Style->NullValue = false;
3794  cell->TrueValue = true;
3795  cell->FalseValue = false;
3796  gridViewParameter->Rows[index]->Cells[collumnValue] = cell;
3797  }
3798  else if (std::shared_ptr<DataTypes::EnumerationElement> enumerationElement = std::dynamic_pointer_cast<DataTypes::EnumerationElement>(parameter->GetValue())) // Enumeration type
3799  {
3800  gridViewParameter->Rows[index]->Cells[collumnValue] = gcnew System::Windows::Forms::DataGridViewComboBoxCell();
3801  System::Windows::Forms::DataGridViewComboBoxCell^ cell = dynamic_cast<System::Windows::Forms::DataGridViewComboBoxCell^>(gridViewParameter->Rows[index]->Cells[collumnValue]);
3802  cell->DisplayStyle = System::Windows::Forms::DataGridViewComboBoxDisplayStyle::ComboBox;
3803  cell->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
3804  cell->DisplayMember = "Name";
3805  cell->ValueMember = "Name";
3806  cell->DataSource = Util::Util::ArrayEnumerationElements2String(enumerationElement->GetEnumeration()->GetElements());
3807  cell->Value = ConvertValue2String(parameter->GetValue());
3808  cell->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(parameter->GetValue());
3809  }
3810  else
3811  {
3812  try
3813  {
3814  if (parameter->GetValue() != nullptr)
3815  {
3816  gridViewParameter->Rows[index]->Cells[collumnValue]->Value = ConvertValue2String(parameter->GetValue());
3817  }
3818  }
3819  catch (System::Exception^ ex)
3820  {
3821  gridViewParameter->Rows[index]->Cells[collumnValue]->ErrorText = ex->Message;
3822  }
3823  }
3824 
3825  gridViewParameter->Rows[index]->Cells[collumnDetails]->Value = GetDetails(parameter->GetValue());
3826  }
3827  REFAPP_END_METHOD();
3828 }
3829 
3830 System::String^ SampleForm::ConvertValue2String(std::shared_ptr<DataTypes::Object> value)
3831 {
3832  if (value == nullptr)
3833  {
3834  return System::String::Empty;
3835  }
3836 
3837  return Util::Util::ToString(ValueConverter::Value2String(value));
3838 }
3839 
3840 System::String^ SampleForm::GetDetails(std::shared_ptr<DataTypes::Object> value)
3841 {
3842  REFAPP_START_METHOD();
3843  if (value == nullptr)
3844  {
3845  REFAPP_END_METHOD();
3846  return System::String::Empty;
3847  }
3848 
3849  if (std::shared_ptr<DataTypes::TranslationKey> translationKey = std::dynamic_pointer_cast<DataTypes::TranslationKey>(value))
3850  {
3851  if (!translationKey->GetTextIdMappingName().empty())
3852  {
3853  REFAPP_END_METHOD();
3854  return System::String::Format("MappingName: {0}", Util::Util::ToString(translationKey->GetTextIdMappingName()));
3855  }
3856  }
3857  else if (std::shared_ptr<DataTypes::EnumerationElement> enumerationElement = std::dynamic_pointer_cast<DataTypes::EnumerationElement>(value))
3858  {
3859  if (IS_NOT_NULL(enumerationElement->GetTranslationKey()))
3860  {
3861  if (!enumerationElement->GetTranslationKey()->GetTextId().empty() && !enumerationElement->GetTranslationKey()->GetTextIdMappingName().empty())
3862  {
3863  REFAPP_END_METHOD();
3864  return System::String::Format("TextId: {0}, MappingName: {1}",
3865  Util::Util::ToString(enumerationElement->GetTranslationKey()->GetTextId()),
3866  Util::Util::ToString(enumerationElement->GetTranslationKey()->GetTextIdMappingName()));
3867  }
3868  else if (!enumerationElement->GetTranslationKey()->GetTextId().empty())
3869  {
3870  REFAPP_END_METHOD();
3871  return System::String::Format("TextId: {0}",
3872  Util::Util::ToString(enumerationElement->GetTranslationKey()->GetTextId()));
3873  }
3874 
3875  REFAPP_END_METHOD();
3876  return System::String::Format("MappingName: {0}",
3877  Util::Util::ToString(enumerationElement->GetTranslationKey()->GetTextIdMappingName()));
3878  }
3879  }
3880 
3881  REFAPP_END_METHOD();
3882  return System::String::Empty;
3883 }
3884 
3885 // TODO: refactor
3886 void SampleForm::UpdateGridViewContextVariable(std::shared_ptr<IDocument> document, bool withPrefix, std::vector<std::string>& listItemReviewed)
3887 {
3888  REFAPP_START_METHOD();
3889  std::string documentFullName = document->GetPackage()->GetName() + "." + document->GetName();
3890  if (std::find(listItemReviewed.begin(), listItemReviewed.end(), documentFullName) != listItemReviewed.end())
3891  {
3892  REFAPP_END_METHOD();
3893  return;
3894  }
3895 
3896  listItemReviewed.push_back(documentFullName);
3897  for (int i = 0; i < document->GetContextVariables().size(); i++)
3898  {
3899  std::shared_ptr<IContextVariable> contextVariable = document->GetContextVariables().at(i);
3900 
3901  if (contextVariable == nullptr)
3902  {
3903  REFAPP_END_METHOD();
3904  return;
3905  }
3906 
3907  bool bValueWasSet = false;
3908 
3909  // Update existing value
3910  for (int iRow = 0; iRow < gridViewContext->Rows->Count; iRow++)
3911  {
3912  System::Windows::Forms::DataGridViewRow^ row = gridViewContext->Rows[iRow];
3913 
3914  if (row->Cells[dataGridViewTextBoxColumnContextName->Name]->Value != nullptr &&
3915  row->Cells[dataGridViewTextBoxColumnContextName->Name]->Value->Equals(withPrefix ?
3916  Util::Util::ToString(document->GetPackage()->GetFullName() + "." + document->GetName() + "." + contextVariable->GetName()) :
3917  Util::Util::ToString(contextVariable->GetName())))
3918  {
3919  if (radioButtonDefaultImplementation->Checked)
3920  {
3921  std::shared_ptr<DataTypes::Object> contextVariableValue = piml->ContextVariableImplementation->GetValue(nullptr, contextVariable, nullptr);
3922  row->Cells[dataGridViewTextBoxColumnContextValue->Name]->Value = IS_NOT_NULL(contextVariableValue) ?
3923  ConvertValue2String(contextVariableValue) :
3924  nullptr;
3925  }
3926  else
3927  {
3928  row->Cells[dataGridViewTextBoxColumnContextValue->Name]->Value = IS_NOT_NULL(contextVariable->GetInitValue()) ?
3929  ConvertValue2String(contextVariable->GetInitValue()) :
3930  nullptr;
3931  }
3932 
3933  bValueWasSet = true;
3934  break;
3935  }
3936  }
3937 
3938  // Add value if not exist
3939  if (!bValueWasSet)
3940  {
3941  cli::array<System::String^>^ values = nullptr;
3942  values = gcnew cli::array<System::String^>{
3943  withPrefix ? Util::Util::ToString(document->GetPackage()->GetFullName() + "." + document->GetName() + "." + contextVariable->GetName()) :
3944  Util::Util::ToString(contextVariable->GetName()),
3945  Util::Util::ToString(contextVariable->GetDataType())
3946  };
3947  int index = gridViewContext->Rows->Add(values);
3948 
3949  std::shared_ptr<DataTypes::Object> contextVariableValue = contextVariable->GetInitValue();
3950 
3951  gridViewContext->Rows[index]->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IContextVariable>>(contextVariable);
3952  gridViewContext->Rows[index]->ReadOnly = contextVariable->GetInitValue() == nullptr;
3953  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::DataTypes::Object>>(contextVariable->GetInitValue());
3954  if (contextVariable->GetDataType()._Equal("Boolean"))
3955  {
3956  System::Windows::Forms::DataGridViewCheckBoxCell^ cell = gcnew System::Windows::Forms::DataGridViewCheckBoxCell();
3957  cell->Value = ConvertValue2String(contextVariableValue);
3958  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name] = cell;
3959  cell->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(contextVariableValue);
3960  cell->Style->NullValue = false;
3961  cell->TrueValue = true;
3962  cell->FalseValue = false;
3963  }
3964  else if (std::shared_ptr<DataTypes::EnumerationElement> enumerationElement = std::dynamic_pointer_cast<DataTypes::EnumerationElement>(contextVariableValue)) // Enumeration type
3965  {
3966  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name] = gcnew System::Windows::Forms::DataGridViewComboBoxCell();
3967  System::Windows::Forms::DataGridViewComboBoxCell^ cell = dynamic_cast<System::Windows::Forms::DataGridViewComboBoxCell^>(gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name]);
3968  cell->DisplayStyle = System::Windows::Forms::DataGridViewComboBoxDisplayStyle::ComboBox;
3969  cell->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
3970  cell->DisplayMember = "Name";
3971  cell->ValueMember = "Name";
3972  cell->DataSource = Util::Util::ArrayEnumerationElements2String(enumerationElement->GetEnumeration()->GetElements());;
3973  cell->Value = ConvertValue2String(contextVariableValue);
3974  cell->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(contextVariableValue);
3975  }
3976  else
3977  {
3978  try
3979  {
3980  if (IS_NOT_NULL(contextVariableValue))
3981  {
3982  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Value = ConvertValue2String(contextVariableValue);
3983  }
3984  else
3985  {
3986  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name]->Value = nullptr;
3987  }
3988  }
3989  catch (System::Exception^ ex)
3990  {
3991  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextValue->Name]->ErrorText = ex->Message;
3992  }
3993  }
3994 
3995  gridViewContext->Rows[index]->Cells[dataGridViewTextBoxColumnContextDetails->Name]->Value = GetDetails(contextVariableValue);
3996  }
3997  }
3998 
3999  try
4000  {
4001  std::vector<std::shared_ptr<IDocument>> importDocs = document->GetImports();
4002  for (int i = 0; i < importDocs.size(); i++)
4003  {
4004  UpdateGridViewContextVariable(importDocs[i], true, listItemReviewed);
4005  }
4006  }
4007  catch (System::Exception^ ex)
4008  {
4009  PrintException(ex);
4010  }
4011  REFAPP_END_METHOD();
4012 }
4013 
4014 // TODO: refactor this
4015 void SampleForm::StateVariableValueChanged(std::shared_ptr<IStateVariable> stateVariable, std::shared_ptr<DataTypes::Object> value)
4016 {
4017  REFAPP_START_METHOD();
4018  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
4019  arr[0] = gcnew CLRWrapper<std::shared_ptr<IStateVariable>>(stateVariable);
4020  arr[1] = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(value);
4021 
4022  if (InvokeRequired)
4023  {
4024  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::StateVariableValueChangedCallback), gcnew cli::array<System::Object^>{arr});
4025  }
4026  else
4027  {
4028  StateVariableValueChangedCallback(arr);
4029  }
4030  REFAPP_END_METHOD();
4031 }
4032 
4033 // TODO: refactor this
4034 void SampleForm::StateVariableValueChangedCallback(cli::array<System::Object^>^ arr)
4035 {
4036  REFAPP_START_METHOD();
4037  if (arr == nullptr || arr->Length != 2)
4038  {
4039  REFAPP_END_METHOD();
4040  return;
4041  }
4042 
4043  std::shared_ptr<IStateVariable> stateVariable = Util::Util::CastTo<std::shared_ptr<IStateVariable>>(arr[0]);
4044  std::shared_ptr<DataTypes::Object> value = Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(arr[1]);
4045 
4046  if (stateVariable == nullptr || value == nullptr)
4047  {
4048  REFAPP_END_METHOD();
4049  return;
4050  }
4051 
4052  System::String^ mappingStr = System::String::Format("[MappedTo: {0}{1}",
4053  Util::Util::ToString(stateVariable->GetMappingName()),
4054  stateVariable->GetMappingIndex() > -1 ? ("[" + stateVariable->GetMappingIndex() + "]") : System::String::Empty);
4055  System::String^ strValue = "null";
4056  try
4057  {
4058  strValue = Util::Util::ToString(ValueConverter::Value2String(value));
4059  }
4060  catch (...)
4061  {
4062  }
4063 
4064  System::String^ outputLog = System::String::Format("StateVariableChanged({0} {1}.{2}{3} = {4})",
4065  Util::Util::ToString(stateVariable->GetDataType()),
4066  Util::Util::ToString(stateVariable->GetDocument()->GetFullName()),
4067  Util::Util::ToString(stateVariable->GetName()),
4068  mappingStr,
4069  strValue);
4070  PrintTextCallback(outputLog);
4071  UpdateGridViewStateVariable(stateVariable);
4072  REFAPP_END_METHOD();
4073 }
4074 
4075 void SampleForm::ContextVariableRead(std::shared_ptr<IContextVariable> contextVariable, std::shared_ptr<DataTypes::Object> value)
4076 {
4077  REFAPP_START_METHOD();
4078  cli::array<System::Object^>^ arr = gcnew cli::array<System::Object^>(2);
4079  arr[0] = gcnew CLRWrapper<std::shared_ptr<IContextVariable>>(contextVariable);
4080  arr[1] = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(value);
4081 
4082  if (InvokeRequired)
4083  {
4084  Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::ContextVariableReadCallback), gcnew cli::array<System::Object^>{arr});
4085  }
4086  else
4087  {
4088  ContextVariableReadCallback(arr);
4089  }
4090  REFAPP_END_METHOD();
4091 }
4092 
4093 void SampleForm::ContextVariableReadCallback(cli::array<System::Object^>^ arr)
4094 {
4095  REFAPP_START_METHOD();
4096  if (arr == nullptr || arr->Length != 2)
4097  {
4098  REFAPP_END_METHOD();
4099  return;
4100  }
4101 
4102  std::shared_ptr<IContextVariable> contextVariable = Util::Util::CastTo<std::shared_ptr<IContextVariable>>(arr[0]);
4103  std::shared_ptr<DataTypes::Object> value = Util::Util::CastTo<std::shared_ptr<DataTypes::Object>>(arr[1]);
4104 
4105  if (contextVariable == nullptr || value == nullptr)
4106  {
4107  REFAPP_END_METHOD();
4108  return;
4109  }
4110 
4111  System::String^ mappingStr = System::String::Format("[MappedTo: {0}{1}",
4112  Util::Util::ToString(contextVariable->GetMappingName()),
4113  (contextVariable->GetMappingIndex() > -1 ? ("[" + contextVariable->GetMappingIndex() + "]") : System::String::Empty));
4114  System::String^ strValue = "null";
4115  try
4116  {
4117  strValue = Util::Util::ToString(ValueConverter::Value2String(value));
4118  }
4119  catch (...)
4120  {
4121  }
4122  System::String^ outputLog = System::String::Format("ContextVariableRead({0} {1}.{2}{3} = {4})",
4123  Util::Util::ToString(contextVariable->GetDataType()),
4124  Util::Util::ToString(contextVariable->GetDocument()->GetFullName()),
4125  Util::Util::ToString(contextVariable->GetName()),
4126  mappingStr,
4127  strValue);
4128 
4129  PrintTextCallback(outputLog);
4130  REFAPP_END_METHOD();
4131 }
4132 
4133 void SampleForm::UpdateGridViewStateVariable(std::shared_ptr<IDocument> document, bool withPrefix, std::vector<std::string>& listItemReviewed)
4134 {
4135  REFAPP_START_METHOD();
4136  std::string documentFullName = document->GetPackage()->GetName() + "." + document->GetName();
4137  if (std::find(listItemReviewed.begin(), listItemReviewed.end(), documentFullName) != listItemReviewed.end())
4138  {
4139  REFAPP_END_METHOD();
4140  return;
4141  }
4142 
4143  listItemReviewed.push_back(documentFullName);
4144  std::vector<std::shared_ptr<IStateVariable>> stateVariables = document->GetStateVariables();
4145  for (int i = 0; i < stateVariables.size(); i++)
4146  {
4147  std::shared_ptr<IStateVariable> stateVariable = stateVariables[i];
4148  cli::array<System::String^>^ values = nullptr;
4149  values = gcnew cli::array<System::String^>{
4150  withPrefix ? Util::Util::ToString(document->GetPackage()->GetFullName() + "." + document->GetName() + "." + stateVariable->GetName()) :
4151  Util::Util::ToString(stateVariable->GetName()),
4152  Util::Util::ToString(stateVariable->GetDataType())
4153  };
4154  int index = gridViewState->Rows->Add(values);
4155 
4156  gridViewState->Rows[index]->Tag = gcnew CLRWrapper<std::shared_ptr<Otx::Runtime::Api::Otx::IStateVariable>>(stateVariable);
4157 
4158  if (stateVariable->GetDataType()._Equal("Boolean"))
4159  {
4160  gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name] = gcnew System::Windows::Forms::DataGridViewCheckBoxCell();
4161  System::Windows::Forms::DataGridViewCheckBoxCell^ cell = dynamic_cast<System::Windows::Forms::DataGridViewCheckBoxCell^>(gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name]);
4162  cell->Value = ConvertValue2String(stateVariable->GetInitValue());
4163  cell->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(stateVariable->GetInitValue());
4164  cell->Style->NullValue = false;
4165  cell->TrueValue = true;
4166  cell->FalseValue = false;
4167  }
4168  else if (std::shared_ptr<DataTypes::EnumerationElement> enumerationElement = std::dynamic_pointer_cast<DataTypes::EnumerationElement>(stateVariable->GetInitValue())) // Enumeration type
4169  {
4170  gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name] = gcnew System::Windows::Forms::DataGridViewComboBoxCell();
4171  System::Windows::Forms::DataGridViewComboBoxCell^ cell = dynamic_cast<System::Windows::Forms::DataGridViewComboBoxCell^>(gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name]);
4172  cell->DisplayStyle = System::Windows::Forms::DataGridViewComboBoxDisplayStyle::ComboBox;
4173  cell->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
4174  cell->DisplayMember = "Name";
4175  cell->ValueMember = "Name";
4176  cell->DataSource = Util::Util::ArrayEnumerationElements2String(enumerationElement->GetEnumeration()->GetElements());;
4177  cell->Value = ConvertValue2String(stateVariable->GetInitValue());
4178  cell->Tag = gcnew CLRWrapper<std::shared_ptr<DataTypes::Object>>(stateVariable->GetInitValue());
4179  }
4180  else
4181  {
4182  try
4183  {
4184  if (IS_NOT_NULL(stateVariable->GetInitValue()))
4185  {
4186  gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name]->Value = ConvertValue2String(stateVariable->GetInitValue());
4187  }
4188  }
4189  catch (System::Exception^ ex)
4190  {
4191  gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateValue->Name]->ErrorText = ex->Message;
4192  }
4193  }
4194 
4195  if (IS_NOT_NULL(stateVariable->GetInitValue()))
4196  {
4197  gridViewState->Rows[index]->Cells[dataGridViewTextBoxColumnStateDetails->Name]->Value = GetDetails(stateVariable->GetInitValue());
4198  }
4199  }
4200 
4201  try
4202  {
4203  std::vector<std::shared_ptr<IDocument>> importDocs = document->GetImports();
4204  for (int i = 0; i < importDocs.size(); i++)
4205  {
4206  UpdateGridViewStateVariable(importDocs[i], true, listItemReviewed);
4207  }
4208  }
4209  catch (const std::exception& ex)
4210  {
4211  PrintException(ex);
4212  }
4213  catch (System::Exception^ ex)
4214  {
4215  PrintException(ex);
4216  }
4217  REFAPP_END_METHOD();
4218 }
4219 
4220 // TODO: refactor
4221 void SampleForm::UpdateGridViewStateVariable(std::shared_ptr<IStateVariable> stateVariable)
4222 {
4223  REFAPP_START_METHOD();
4224  if (stateVariable == nullptr)
4225  {
4226  REFAPP_END_METHOD();
4227  return;
4228  }
4229 
4230  // Update existing value
4231  for (int i = 0; i < gridViewState->Rows->Count; i++)
4232  {
4233  System::Windows::Forms::DataGridViewRow^ row = gridViewState->Rows[i];
4234  if (row->Cells[dataGridViewTextBoxColumnStateName->Name]->Value != nullptr && Util::Util::CastTo<std::shared_ptr<IStateVariable>>(row->Tag) == stateVariable)
4235  {
4236  std::shared_ptr<DataTypes::Object> stateVariableValue = nullptr;
4237 
4238  if (radioButtonDefaultImplementation->Checked)
4239  {
4240  stateVariableValue = piml->StateVariableImplementation->GetValue(stateVariable);
4241  }
4242  else
4243  {
4244  stateVariableValue = stateVariable->GetInitValue();
4245  }
4246 
4247  if (IS_NOT_NULL(stateVariableValue))
4248  {
4249  try
4250  {
4251  row->Cells[dataGridViewTextBoxColumnStateValue->Name]->Value = ConvertValue2String(stateVariableValue);
4252  }
4253  catch (System::Exception^ ex)
4254  {
4255  row->Cells[dataGridViewTextBoxColumnStateValue->Name]->ErrorText = ex->Message;
4256  }
4257 
4258  row->Cells[dataGridViewTextBoxColumnStateDetails->Name]->Value = GetDetails(stateVariableValue);
4259  }
4260  else
4261  {
4262  row->Cells[dataGridViewTextBoxColumnStateValue->Name]->Value = nullptr;
4263  row->Cells[dataGridViewTextBoxColumnStateDetails->Name]->Value = System::String::Empty;
4264  }
4265  break;
4266  }
4267  }
4268 
4269  System::Windows::Forms::Application::DoEvents();
4270  REFAPP_END_METHOD();
4271 }
4272 
4273 System::Void SampleForm::buttonNewInstance_Click(System::Object^ sender, System::EventArgs^ e)
4274 {
4275  REFAPP_START_METHOD();
4276  SampleForm^ form = gcnew SampleForm();
4277  form->SetInstanceName(Util::Util::ToString(SampleConstants::CHILD_INSTANCE_NAME));
4278  form->SetCreatorForm(this);
4279  form->Show();
4280  REFAPP_END_METHOD();
4281 }
4282 
4283 System::Void SampleForm::buttonNewInstanceNewThread_Click(System::Object^ sender, System::EventArgs^ e)
4284 {
4285  REFAPP_START_METHOD();
4286  System::Threading::Thread^ thread = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(this, &SampleForm::NewInstanceInThread));
4287  thread->SetApartmentState(System::Threading::ApartmentState::STA);
4288  thread->Start();
4289  REFAPP_END_METHOD();
4290 }
4291 
4292 System::Void SampleForm::NewInstanceInThread()
4293 {
4294  REFAPP_START_METHOD();
4295  SampleForm^ form = gcnew SampleForm();
4296  form->SetInstanceName(Util::Util::ToString(SampleConstants::CHILD_INSTANCE_NAME));
4297  form->SetCreatorForm(this);
4298  System::Windows::Forms::Application::Run(form);
4299  REFAPP_END_METHOD();
4300 }
4301 
4302 System::Void SampleForm::buttonHmi_Click(System::Object^ sender, System::EventArgs^ e)
4303 {
4304  REFAPP_START_METHOD();
4305  if (buttonHmi->Checked)
4306  {
4307  piml->HmiWindow = gcnew HmiWindow();
4308  piml->HmiWindow->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &SampleForm::HmiWindow_FormClosing);
4309  piml->HmiWindow->SizeChanged += gcnew System::EventHandler(this, &SampleForm::HmiWindow_SizeChanged);
4310  piml->HmiWindow->Activated += gcnew System::EventHandler(this, &SampleForm::HmiWindow_Activated);
4311  piml->HmiWindow->Show();
4312 
4313  piml->HmiWindow->Size = System::Drawing::Size(Setting::UserSettings::GetInstance().GetHmiWindowWidth(), Setting::UserSettings::GetInstance().GetHmiWindowHeight());
4314  piml->HmiWindow->Location = System::Drawing::Point(Location.X + Size.Width, Location.Y);
4315  if (IS_NOT_NULL(piml->CreatorForm) && IS_NOT_NULL(piml->CreatorForm->piml->HmiWindow))
4316  {
4317  piml->HmiWindow->Size = piml->CreatorForm->piml->HmiWindow->Size;
4318  }
4319 
4320  piml->HmiWindow->BringToFront();
4321 
4322  piml->CustomScreenImplementation->SetHmiScreenHandle(piml->HmiWindow->GetHmiControl()->Handle.ToInt64());
4323  }
4324  else if (IS_NOT_NULL(piml->HmiWindow))
4325  {
4326  piml->HmiWindow->Close();
4327  }
4328 
4329  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonHmi : nullptr, buttonHmi);
4330  REFAPP_END_METHOD();
4331 }
4332 
4333 System::Void SampleForm::HmiWindow_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e)
4334 {
4335  REFAPP_START_METHOD();
4336  piml->CustomScreenImplementation->SetHmiScreenHandle(NULL);
4337  piml->HmiWindow = nullptr;
4338 
4339  buttonHmi->Checked = false;
4340  REFAPP_END_METHOD();
4341 }
4342 
4343 void SampleForm::HmiWindow_Activated(System::Object^ sender, System::EventArgs^ e)
4344 {
4345  REFAPP_START_METHOD();
4346  if (piml->CustomScreenImplementation != nullptr)
4347  {
4348  piml->CustomScreenImplementation->ActivateHmiScreen();
4349  }
4350  REFAPP_END_METHOD();
4351 }
4352 
4353 void SampleForm::HmiWindow_SizeChanged(System::Object^ sender, System::EventArgs^ e)
4354 {
4355  REFAPP_START_METHOD();
4356  Setting::UserSettings::GetInstance().SetHmiWindowWidth(piml->HmiWindow->Width);
4357  Setting::UserSettings::GetInstance().SetHmiWindowHeight(piml->HmiWindow->Height);
4358 
4359  if (piml->CustomScreenImplementation != nullptr)
4360  {
4361  piml->CustomScreenImplementation->RefreshHmiScreen();
4362  }
4363  REFAPP_END_METHOD();
4364 }
4365 
4366 void SampleForm::CustomScreenImplementation_KeyDown(std::shared_ptr<Custom::KeyEventArgs> eventArgs)
4367 {
4368  REFAPP_START_METHOD();
4369  std::string key = "Unknown";
4370  if (std::shared_ptr<Custom::WpfKeyEventArgs> wpfKeyEventArgs = std::dynamic_pointer_cast<Custom::WpfKeyEventArgs>(eventArgs))
4371  {
4372  key = wpfKeyEventArgs->ToString();
4373  if (wpfKeyEventArgs->GetModifierKeys() == Custom::ModifierKeys::Alt &&
4374  wpfKeyEventArgs->GetKey() == Custom::Key::F4)
4375  {
4376  if (IS_NOT_NULL(piml->HmiWindow))
4377  {
4378  piml->HmiWindow->Close();
4379  }
4380  }
4381  else if (wpfKeyEventArgs->GetKey() == Custom::Key::F10 ||
4382  wpfKeyEventArgs->GetKey() == Custom::Key::LeftAlt ||
4383  wpfKeyEventArgs->GetKey() == Custom::Key::RightAlt)
4384  {
4385  eventArgs->SetHandled(true);
4386  }
4387  }
4388  else if (std::shared_ptr<Custom::FormKeyEventArgs> formKeyEventArgs = std::dynamic_pointer_cast<Custom::FormKeyEventArgs>(eventArgs))
4389  {
4390  if (formKeyEventArgs->GetModifierKeys() == Custom::Keys::Alt &&
4391  formKeyEventArgs->GetKey() == Custom::Keys::F4)
4392  {
4393  if (IS_NOT_NULL(piml->HmiWindow))
4394  {
4395  piml->HmiWindow->Close();
4396  }
4397  }
4398  else if (formKeyEventArgs->GetKey() == Custom::Keys::F10 ||
4399  formKeyEventArgs->GetKey() == Custom::Keys::Alt)
4400  {
4401  eventArgs->SetHandled(true);
4402  }
4403  key = formKeyEventArgs->ToString();
4404  }
4405 
4406  PrintTextCallback("CustomScreenImplementation_KeyDown(" + Util::Util::ToString(key) + ")");
4407  REFAPP_END_METHOD();
4408 }
4409 
4410 System::Void SampleForm::SampleForm_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e)
4411 {
4412  REFAPP_START_METHOD();
4413  // at C#: listForms.Remove(this)
4414  for (size_t i = 0; i < piml->ListForms.size(); i++)
4415  {
4416  if (piml->ListForms.at(i).get() == this)
4417  {
4418  // Possibly crash application
4419  // piml->ListForms.erase(piml->ListForms.begin() + i);
4420  }
4421  }
4422 
4423  // Remove Event
4424  if (piml->GlobalRuntimeManager != nullptr)
4425  {
4426  piml->GlobalRuntimeManager->StopAll();
4427  piml->RemoveRuntimeEvents(piml->GlobalRuntimeManager);
4428  }
4429 
4430  //piml->StateVariableImplementation->SetStateVariableValueChangedHandler(nullptr);
4431 
4432  piml->RemoveOutputImplLogEventHandler();
4433 
4434  SaveSettings();
4435  REFAPP_END_METHOD();
4436 }
4437 
4438 void SampleForm::SaveSettings()
4439 {
4440  REFAPP_START_METHOD();
4441 
4442  int integerValue;
4443  unsigned long long longValue;
4444 
4445  if (piml != NULL && IS_NULL(piml->CreatorForm))
4446  {
4447  // Only main form
4448  Setting::UserSettings::GetInstance().SetPtxPpxDirectory(Util::Util::ToString(cbFilePath->Text->Trim()));
4449  Setting::UserSettings::GetInstance().SetPtxPpxDirectoryList(Util::Util::Join(";", cbFilePath->Items->GetEnumerator()));
4450 
4451  Setting::UserSettings::GetInstance().SetTraceFileMaxCount(System::Int32::TryParse(textBoxTraceFileMaxCount->Text->Trim(), integerValue) ?
4452  integerValue :
4453  Setting::UserSettings::GetInstance().GetTraceFileMaxCount());
4454  Setting::UserSettings::GetInstance().SetTraceFileMaxSize(System::Int32::TryParse(textBoxTraceFileMaxSize->Text->Trim(), integerValue) ?
4455  integerValue :
4456  Setting::UserSettings::GetInstance().GetTraceFileMaxSize());
4457  Setting::UserSettings::GetInstance().SetProfiling(checkBoxProfiling->Checked);
4458  Setting::UserSettings::GetInstance().SetProfilingMaxFileSize(System::Int32::TryParse(textBoxProfilingSize->Text->Trim(), integerValue) ?
4459  integerValue :
4460  Setting::UserSettings::GetInstance().GetProfilingMaxFileSize());
4461  Setting::UserSettings::GetInstance().SetTraceLevels(RuntimeConfig::GetInstance().GetTraceLevel());
4462  Setting::UserSettings::GetInstance().SetTracingDirectory(Util::Util::ToString(textBoxTraceFolder->Text->Trim()));
4463 
4464  Setting::UserSettings::GetInstance().SetWindowWidth(Size.Height);
4465  Setting::UserSettings::GetInstance().SetWindowWidth(Size.Width);
4466  Setting::UserSettings::GetInstance().SetWindowLocationX(Location.X);
4467  Setting::UserSettings::GetInstance().SetWindowLocationY(Location.Y);
4468  Setting::UserSettings::GetInstance().SetCustomImplTypes(GetCurrentCustomImpl());
4469  SaveSocketPortOrPipeName();
4470 
4471  Setting::UserSettings::GetInstance().SetAsynchron(checkBoxAsyncExecution->Checked);
4472  Setting::UserSettings::GetInstance().SetCyclic(checkBoxCyclicExecution->Checked);
4473  Setting::UserSettings::GetInstance().SetCyclicReload(checkBoxCyclicReload->Checked);
4474  Setting::UserSettings::GetInstance().SetNewRuntimeManager(checkBoxNewRuntimeManager->Checked);
4475  Setting::UserSettings::GetInstance().SetAddMessageToOutput(checkBoxAdd2Output->Checked);
4476  Setting::UserSettings::GetInstance().SetStartAllParents(checkBoxStartAllParents->Checked);
4477 
4478  Setting::UserSettings::GetInstance().SetTimeout(System::UInt64::TryParse(textBoxTimeout->Text->Trim(), longValue) ?
4479  longValue :
4480  Setting::UserSettings::GetInstance().GetTimeOut());
4481  Setting::UserSettings::GetInstance().SetConnectionState(checkBoxUseConnectionState->Checked);
4482  Setting::UserSettings::GetInstance().SetIgnition((int)checkBoxIgnition->CheckState);
4483  Setting::UserSettings::GetInstance().SetPollingTime(System::Int32::TryParse(textBoxPollingTime->Text->Trim(), integerValue) ?
4484  integerValue :
4485  Setting::UserSettings::GetInstance().GetPollingTime());
4486  Setting::UserSettings::GetInstance().SetVoltageThreshold(System::Int32::TryParse(textBoxVoltageThreshold->Text->Trim(), integerValue) ?
4487  integerValue :
4488  Setting::UserSettings::GetInstance().GetVoltageThreshold());
4489 
4490  Setting::UserSettings::GetInstance().SetRuntimeContextName(Util::Util::ToString(textBoxRuntimeContextName->Text->Trim()));
4491 
4492 #pragma region C++ for RAW-mode
4493  Setting::UserSettings::GetInstance().SetDiagIpcType(comboBoxDiagIpcType->SelectedItem != nullptr ?
4494  Util::Util::ToIpcType(comboBoxDiagIpcType->SelectedItem->ToString()) :
4495  IpcTypes::Raw);
4496  Setting::UserSettings::GetInstance().SetDiagManagerLicenseKey(Util::LicenseUtil::Encrypt(Util::Util::ToString(textBoxDiagManagerLicenseKey->Text)));
4497  Setting::UserSettings::GetInstance().SetDiagManagerTraceLevel(comboBoxDiagManagerTraceLevel->SelectedItem != nullptr ?
4498  Util::Util::ToLoggerLevel(comboBoxDiagManagerTraceLevel->SelectedItem->ToString()) :
4499  (DiagManager::Common::ILog::Level)Util::OtxDiagUtil::GetLevelLoggerDefault());
4500  Setting::UserSettings::GetInstance().SetDiagLoggingTraceLevel(comboBoxDiagLoggingTraceLevel->SelectedItem != nullptr ?
4501  Util::Util::ToDiagDiagnosticsLogLevel(comboBoxDiagLoggingTraceLevel->SelectedItem->ToString()) :
4502  (DiagManager::NoneOtxDiagApi::INoneOtxDiag::LogLevels)Util::OtxDiagUtil::GetDiagnosticLogLevelDefault());
4503  Setting::UserSettings::GetInstance().SetIncludeTraceDiagLogging(checkBoxIncludedDiagLogging->Checked);
4504  Setting::UserSettings::GetInstance().SetDiagTraceDirectory(Util::Util::ToString(textBoxDiagManagerTraceFolder->Text));
4505  Setting::UserSettings::GetInstance().SetOdxProject(comboBoxODXProject->SelectedItem != nullptr ?
4506  Util::Util::ToString(comboBoxODXProject->SelectedItem->ToString()) :
4507  "");
4508  Setting::UserSettings::GetInstance().SetOdxVehicleInformation(comboBoxODXVehicle->SelectedItem != nullptr ?
4509  Util::Util::ToString(comboBoxODXVehicle->SelectedItem->ToString()) :
4510  "");
4511 #pragma endregion//Only C++
4512 
4513  Setting::UserSettings::GetInstance().Save();
4514  }
4515  REFAPP_END_METHOD();
4516 }
4517 
4518 void SampleForm::SaveSocketPortOrPipeName()
4519 {
4520  REFAPP_START_METHOD();
4521  IpcTypes ipcType = Util::Util::ToIpcType(comboBoxIpcType->SelectedItem->ToString());
4522  unsigned short unsignedShortValue;
4523 
4524  switch (ipcType)
4525  {
4526 #pragma region C++ for RAW-mode
4527  case IpcTypes::Raw:
4528  {
4529  Setting::UserSettings::GetInstance().SetIpcType(ipcType);
4530  break;
4531  }
4532 #pragma endregion//C++ for RAW-mode
4533  case IpcTypes::Socket:
4534  {
4535  try
4536  {
4537  Setting::UserSettings::GetInstance().SetDiagManagerPort(System::UInt16::TryParse(textBoxDiagPortPipe->Text->Trim(), unsignedShortValue) ?
4538  unsignedShortValue :
4539  SampleConstants::DEFAULT_DM_PORT);
4540  Setting::UserSettings::GetInstance().SetRuntimePort(System::UInt16::TryParse(textBoxRtPortPipe->Text->Trim(), unsignedShortValue) ?
4541  unsignedShortValue :
4542  SampleConstants::DEFAULT_RT_PORT);
4543  Setting::UserSettings::GetInstance().SetIpcType(ipcType);
4544  }
4545  catch (...)
4546  {
4547  Setting::UserSettings::GetInstance().SetDiagManagerPort(SampleConstants::DEFAULT_DM_PORT);
4548  Setting::UserSettings::GetInstance().SetRuntimePort(SampleConstants::DEFAULT_RT_PORT);
4549  }
4550  break;
4551  }
4552  case IpcTypes::Pipe:
4553  {
4554  std::string diagManagerPipeName = Util::Util::ToString(textBoxDiagPortPipe->Text->Trim());
4555  std::string runtimePipeName = Util::Util::ToString(textBoxRtPortPipe->Text->Trim());
4556 
4557  Setting::UserSettings::GetInstance().SetDiagManagerPipeName(!diagManagerPipeName.empty() ? diagManagerPipeName : SampleConstants::DEFAULT_DM_PIPE_NAME);
4558  Setting::UserSettings::GetInstance().SetRuntimePipeName(!runtimePipeName.empty() ? runtimePipeName : SampleConstants::DEFAULT_RT_PIPE_NAME);
4559  Setting::UserSettings::GetInstance().SetIpcType(ipcType);
4560  break;
4561  }
4562  default:
4563  break;
4564  }
4565  REFAPP_END_METHOD();
4566 }
4567 
4568 System::Void SampleForm::textBoxRuntimeContextName_TextChanged(System::Object^ sender, System::EventArgs^ e)
4569 {
4570  REFAPP_START_METHOD();
4571  textBoxRuntimeContextName->Text = textBoxRuntimeContextName->Text->Trim();
4572  piml->RuntimeContextName = Util::Util::ToString(textBoxRuntimeContextName->Text);
4573 
4574  SetTitle(Util::Util::ToString(piml->Title));
4575  REFAPP_END_METHOD();
4576 }
4577 
4578 System::Void SampleForm::listBoxOuput_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
4579 {
4580  REFAPP_START_METHOD();
4581  buttonCopyRow->Enabled = listBoxOuput->SelectedItems->Count > 0;
4582  REFAPP_END_METHOD();
4583 }
4584 
4585 System::Void SampleForm::buttonPause_Click(System::Object^ sender, System::EventArgs^ e)
4586 {
4587  REFAPP_START_METHOD();
4588  msclr::lock l(piml->LockRuntimeContexts.get());
4589  {
4590  if (buttonPause->Checked)
4591  {
4592  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
4593  {
4594  if (piml->RuntimeContexts[i]->GetExecutionState() == ExecutionState::Running)
4595  {
4596  piml->RuntimeContexts[i]->Pause();
4597  }
4598  }
4599  }
4600  else
4601  {
4602  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
4603  {
4604  if (piml->RuntimeContexts[i]->GetExecutionState() == ExecutionState::Paused)
4605  {
4606  piml->RuntimeContexts[i]->Continue();
4607  }
4608  }
4609  }
4610  }
4611 
4612  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonPause : nullptr, buttonPause);
4613  REFAPP_END_METHOD();
4614 }
4615 
4616 void SampleForm::AddRuntimeContext(IRuntimeContext* context)
4617 {
4618  REFAPP_START_METHOD();
4619  msclr::lock l(piml->LockRuntimeContexts.get());
4620  {
4621  if (std::find(piml->RuntimeContexts.begin(), piml->RuntimeContexts.end(), context) == piml->RuntimeContexts.end()) // context not exist into vector
4622  {
4623  piml->RuntimeContexts.push_back(context);
4624  }
4625 
4626  if (piml->RuntimeContextIdsExecutionStartTick.find(context->GetRuntimeId()) == piml->RuntimeContextIdsExecutionStartTick.end())
4627  {
4628  piml->RuntimeContextIdsExecutionStartTick.insert({ context->GetRuntimeId(), System::DateTime::Now.Ticks });
4629  }
4630  }
4631  REFAPP_END_METHOD();
4632 }
4633 
4634 void SampleForm::RemoveRuntimeContext(IRuntimeContext* context)
4635 {
4636  REFAPP_START_METHOD();
4637  long long contextRuntimeId = context->GetRuntimeId();
4638 
4639  msclr::lock l(piml->LockRuntimeContexts.get());
4640  {
4641  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
4642  {
4643  if (piml->RuntimeContexts[i]->GetRuntimeId() == contextRuntimeId)
4644  {
4645  piml->RuntimeContexts.erase(piml->RuntimeContexts.begin() + i);
4646  }
4647  }
4648 
4649  std::map<long long, long long>::iterator itr = piml->RuntimeContextIdsExecutionStartTick.find(contextRuntimeId);
4650  if (itr != piml->RuntimeContextIdsExecutionStartTick.end())
4651  {
4652  piml->RuntimeContextIdsExecutionStartTick.erase(itr);
4653  }
4654  }
4655  REFAPP_END_METHOD();
4656 }
4657 
4658 bool SampleForm::IsPauseEnabled()
4659 {
4660  REFAPP_START_METHOD();
4661  msclr::lock l(piml->LockRuntimeContexts.get());
4662  {
4663  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
4664  {
4665  if (piml->RuntimeContexts[i]->GetExecutionState() == ExecutionState::Running)
4666  {
4667  REFAPP_END_METHOD();
4668  return true;
4669  }
4670  }
4671 
4672  REFAPP_END_METHOD();
4673  return false;
4674  }
4675 }
4676 
4677 bool SampleForm::IsContinueEnable()
4678 {
4679  REFAPP_START_METHOD();
4680  msclr::lock l(piml->LockRuntimeContexts.get());
4681  {
4682  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
4683  {
4684  if (piml->RuntimeContexts[i]->GetExecutionState() == ExecutionState::Paused)
4685  {
4686  REFAPP_END_METHOD();
4687  return true;
4688  }
4689  }
4690  REFAPP_END_METHOD();
4691  return false;
4692  }
4693 }
4694 
4695 void SampleForm::SetExpectedState()
4696 {
4697  REFAPP_START_METHOD();
4698  if (piml->UseConnectionState)
4699  {
4700  if (piml->KL15State == -1)
4701  {
4702  piml->ExpectedConnectionState = ExpectedState::BatteryOn;
4703  }
4704  else if (piml->KL15State == 1)
4705  {
4706  piml->ExpectedConnectionState = ExpectedState::IgnitionOn;
4707  }
4708  else
4709  {
4710  piml->ExpectedConnectionState = ExpectedState::IgnitionOff;
4711  }
4712  }
4713  else
4714  {
4715  piml->ExpectedConnectionState = ExpectedState::None;
4716  }
4717  REFAPP_END_METHOD();
4718 }
4719 
4720 System::Void SampleForm::checkBoxUseConnectionState_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
4721 {
4722  REFAPP_START_METHOD();
4723  piml->UseConnectionState = checkBoxUseConnectionState->Checked;
4724  EnableConnectionState();
4725  SetExpectedState();
4726 
4727  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
4728  labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBattery16")));
4729  labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnition16")));
4730 
4731  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxUseConnectionState : nullptr, checkBoxUseConnectionState);
4732  REFAPP_END_METHOD();
4733 }
4734 
4735 System::Void SampleForm::CheckBoxKL15_CheckStateChanged(System::Object^ sender, System::EventArgs^ e)
4736 {
4737  REFAPP_START_METHOD();
4738  switch (checkBoxIgnition->CheckState)
4739  {
4740  case System::Windows::Forms::CheckState::Checked:
4741  piml->KL15State = 1;
4742  break;
4743  case System::Windows::Forms::CheckState::Unchecked:
4744  piml->KL15State = 0;
4745  break;
4746  default:
4747  piml->KL15State = -1;
4748  break;
4749  }
4750 
4751  SetExpectedState();
4752 
4753  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxIgnition : nullptr, checkBoxIgnition);
4754  REFAPP_END_METHOD();
4755 }
4756 
4757 void SampleForm::EnableConnectionState()
4758 {
4759  labelExpectedState->Enabled = piml->UseConnectionState;
4760  labelBatteryState->Enabled = piml->UseConnectionState;
4761  checkBoxIgnition->Enabled = piml->UseConnectionState;
4762  labelPollingTime->Enabled = piml->UseConnectionState;
4763  textBoxPollingTime->Enabled = piml->UseConnectionState;
4764  labelVoltageThreshold->Enabled = piml->UseConnectionState;
4765  textBoxVoltageThreshold->Enabled = piml->UseConnectionState;
4766  buttonCheckBatteryIgnition->Enabled = piml->UseConnectionState;
4767 }
4768 
4769 System::Void SampleForm::buttonCheckBatteryIgnition_Click(System::Object^ sender, System::EventArgs^ e)
4770 {
4771  REFAPP_START_METHOD();
4772  CheckBatteryIgnitionState(piml->GlobalRuntimeManager);
4773 
4774  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->buttonCheckBatteryIgnition : nullptr, buttonCheckBatteryIgnition);
4775  REFAPP_END_METHOD();
4776 }
4777 
4778 System::Void SampleForm::textBoxPollingTime_TextChanged(System::Object^ sender, System::EventArgs^ e)
4779 {
4780  REFAPP_START_METHOD();
4781  try
4782  {
4783  if (System::Convert::ToInt32(textBoxPollingTime->Text->Trim()) <= 0)
4784  {
4785  textBoxPollingTime->Text = piml->DEFAULT_POLLING_TIME.ToString();
4786  }
4787  }
4788  catch (...)
4789  {
4790  textBoxPollingTime->Text = piml->DEFAULT_POLLING_TIME.ToString();
4791  }
4792 
4793  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxPollingTime : nullptr, textBoxPollingTime);
4794  REFAPP_END_METHOD();
4795 }
4796 
4797 System::Void SampleForm::textBoxBatteryVoltageThreshold_TextChanged(System::Object^ sender, System::EventArgs^ e)
4798 {
4799  REFAPP_START_METHOD();
4800  try
4801  {
4802  if (System::Convert::ToInt32(textBoxVoltageThreshold->Text->Trim()) <= 0)
4803  {
4804  textBoxVoltageThreshold->Text = piml->DEFAULT_POLLING_TIME.ToString();
4805  }
4806  }
4807  catch (...)
4808  {
4809  textBoxVoltageThreshold->Text = piml->DEFAULT_POLLING_TIME.ToString();
4810  }
4811 
4812  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxVoltageThreshold : nullptr, textBoxVoltageThreshold);
4813  REFAPP_END_METHOD();
4814 }
4815 
4816 void SampleForm::CheckBatteryIgnitionState(std::shared_ptr<IRuntimeManager> runtimeManager)
4817 {
4818  REFAPP_START_METHOD();
4819  if (piml->UseConnectionState)
4820  {
4821  runtimeManager->GetDiagConnectionState()->SetPollingTime(System::Convert::ToInt32(textBoxPollingTime->Text));
4822  runtimeManager->GetDiagConnectionState()->SetBatteryVoltageThreshold(System::Convert::ToInt32(textBoxVoltageThreshold->Text));
4823  ClampState batteryState = runtimeManager->GetDiagConnectionState()->GetBatteryState();
4824  ClampState ignitionState = runtimeManager->GetDiagConnectionState()->GetIgnitionState();
4825 
4826  SetBatteryIgnitionState(batteryState, ignitionState);
4827 
4828  PrintTextCallback("Check DiagConnection State - BatteryState = " + Util::Util::ToString(batteryState) + ", IgnitionState = " + Util::Util::ToString(ignitionState));
4829  }
4830  REFAPP_END_METHOD();
4831 }
4832 
4833 void SampleForm::SetBatteryIgnitionState(ClampState batteryState, ClampState ignitionState)
4834 {
4835  REFAPP_START_METHOD();
4836 #pragma region C++ for initialize resource
4837  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
4838 #pragma endregion
4839 
4840  switch (batteryState)
4841  {
4843  labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBatteryNotAvailable16")));
4844  break;
4845  case OpenTestSystem::Otx::Runtime::Api::ClampState::Off:
4846  labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBatteryOff16")));
4847  break;
4849  labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconBatteryOn16")));
4850  break;
4851  }
4852 
4853  switch (ignitionState)
4854  {
4856  labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnitionNotAvailable16")));
4857  break;
4858  case OpenTestSystem::Otx::Runtime::Api::ClampState::Off:
4859  labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnitionOff16")));
4860  break;
4862  labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"IconIgnitionOn16")));
4863  break;
4864  }
4865  REFAPP_END_METHOD();
4866 }
4867 
4868 void SampleForm::ShowConnectionStateMessage(IRuntimeContext* runtimeContext)
4869 {
4870  REFAPP_START_METHOD();
4871  if (runtimeContext != nullptr)
4872  {
4873  System::Media::SystemSounds::Beep->Play();
4874 
4875  switch (piml->ExpectedConnectionState)
4876  {
4878  PrintTextCallback("----------------------------------------------------------------------------------------------------------------------------------------------");
4879  PrintTextCallback("-- Not expected connection state: Either it is not possible to communicate with the VCI or the battery is not connected. Please connect it! --");
4880  PrintTextCallback("----------------------------------------------------------------------------------------------------------------------------------------------");
4881  break;
4883  PrintTextCallback("------------------------------------------------------------------------------------");
4884  PrintTextCallback("-- Not expected connection state: The ignition must be OFF. Please switch it OFF! --");
4885  PrintTextCallback("------------------------------------------------------------------------------------");
4886  break;
4888  PrintTextCallback("----------------------------------------------------------------------------------");
4889  PrintTextCallback("-- Not expected connection state: The ignition must be ON. Please switch it ON! --");
4890  PrintTextCallback("----------------------------------------------------------------------------------");
4891  break;
4892  default:
4893  break;
4894  }
4895  }
4896  REFAPP_END_METHOD();
4897 }
4898 
4899 System::Void SampleForm::checkBoxAdd2Output_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
4900 {
4901  REFAPP_START_METHOD();
4902  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxAdd2Output : nullptr, checkBoxAdd2Output);
4903  REFAPP_END_METHOD();
4904 }
4905 
4906 void SampleForm::NumericUpDownSetValueCallback(cli::array<System::Object^>^ arr)
4907 {
4908  REFAPP_START_METHOD();
4909  if (arr == nullptr || arr->Length != 2)
4910  {
4911  REFAPP_END_METHOD();
4912  return;
4913  }
4914 
4915  System::Windows::Forms::NumericUpDown^ numericUpDown = dynamic_cast<System::Windows::Forms::NumericUpDown^>(arr[0]);
4916  System::Windows::Forms::NumericUpDown^ control = dynamic_cast<System::Windows::Forms::NumericUpDown^>(arr[1]);
4917 
4918  numericUpDown->Value = control->Value;
4919  REFAPP_END_METHOD();
4920 }
4921 
4922 void SampleForm::ParentNumericUpDownSetValueCallback(System::Object^ state)
4923 {
4924  REFAPP_START_METHOD();
4925  cli::array<System::Object^>^ arr = dynamic_cast<cli::array<System::Object^>^>(state);
4926  if (arr == nullptr || arr->Length != 2) {
4927  REFAPP_END_METHOD();
4928  return;
4929  }
4930 
4931  System::Windows::Forms::NumericUpDown^ numericUpDown = dynamic_cast<System::Windows::Forms::NumericUpDown^>(arr[0]);
4932  System::Windows::Forms::NumericUpDown^ control = dynamic_cast<System::Windows::Forms::NumericUpDown^>(arr[1]);
4933 
4934  if (numericUpDown == nullptr || control == nullptr)
4935  {
4936  REFAPP_END_METHOD();
4937  return;
4938  }
4939 
4940  if (numericUpDown->InvokeRequired)
4941  {
4942  piml->CreatorForm->Invoke(gcnew System::Action<cli::array<System::Object^>^>(this, &SampleForm::NumericUpDownSetValueCallback), gcnew cli::array<System::Object^>{arr});
4943  }
4944  else
4945  {
4946  NumericUpDownSetValueCallback(arr);
4947  }
4948  REFAPP_END_METHOD();
4949 }
4950 
4951 System::Void SampleForm::comboBoxTraceLevel_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
4952 {
4953  REFAPP_START_METHOD();
4954  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->comboBoxTraceLevel : nullptr,
4955  comboBoxTraceLevel);
4956  REFAPP_END_METHOD();
4957 }
4958 
4959 System::Void SampleForm::txtPassword_TextChanged(System::Object^ sender, System::EventArgs^ e)
4960 {
4961  REFAPP_START_METHOD();
4962  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->txtPassword : nullptr, txtPassword);
4963  REFAPP_END_METHOD();
4964 }
4965 
4966 System::Void SampleForm::textBoxTimeout_TextChanged(System::Object^ sender, System::EventArgs^ e)
4967 {
4968  REFAPP_START_METHOD();
4969  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxTimeout : nullptr, textBoxTimeout);
4970  REFAPP_END_METHOD();
4971 }
4972 
4973 System::Void SampleForm::checkBoxProfiling_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
4974 {
4975  REFAPP_START_METHOD();
4976  if (piml->GlobalRuntimeManager == nullptr)
4977  {
4978  REFAPP_END_METHOD();
4979  return;
4980  }
4981 
4982  PrintTextCallback("Set Profiling to " + checkBoxProfiling->Checked.ToString());
4983 
4984  try
4985  {
4986  RuntimeConfig::GetInstance().SetProfiling(checkBoxProfiling->Checked);
4987  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->checkBoxProfiling : nullptr);
4988  }
4989  catch (System::Exception^ ex)
4990  {
4991  PrintException(ex);
4992  checkBoxProfiling->Checked = RuntimeConfig::GetInstance().GetProfiling();
4993  }
4994  REFAPP_END_METHOD();
4995 }
4996 
4997 System::Void SampleForm::textBoxTraceFileMaxSize_TextChanged(System::Object^ sender, System::EventArgs^ e)
4998 {
4999  REFAPP_START_METHOD();
5000  if (piml->GlobalRuntimeManager == nullptr)
5001  {
5002  REFAPP_END_METHOD();
5003  return;
5004  }
5005 
5006  PrintTextCallback("Set TraceFileMaxSize to " + textBoxTraceFileMaxSize->Text);
5007 
5008  try
5009  {
5010  RuntimeConfig::GetInstance().SetTraceFileMaxSize(System::Convert::ToInt32(textBoxTraceFileMaxSize->Text));
5011  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxTraceFileMaxSize : nullptr, textBoxTraceFileMaxSize);
5012  }
5013  catch (System::Exception^ ex)
5014  {
5015  PrintException(ex);
5016  textBoxTraceFileMaxSize->Text = RuntimeConfig::GetInstance().GetTraceFileMaxSize().ToString();
5017  }
5018  REFAPP_END_METHOD();
5019 }
5020 
5021 System::Void SampleForm::textBoxProfilingSize_TextChanged(System::Object^ sender, System::EventArgs^ e)
5022 {
5023  REFAPP_START_METHOD();
5024  if (piml->GlobalRuntimeManager == nullptr)
5025  {
5026  REFAPP_END_METHOD();
5027  return;
5028  }
5029 
5030  PrintTextCallback("Set ProfilingFileMaxSize to " + textBoxProfilingSize->Text->Trim());
5031 
5032  try
5033  {
5034  RuntimeConfig::GetInstance().SetProfilingMaxFileSize(System::Convert::ToUInt32(textBoxProfilingSize->Text));
5035  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxProfilingSize : nullptr, textBoxProfilingSize);
5036  }
5037 
5038  catch (System::Exception^ ex)
5039  {
5040  PrintException(ex);
5041  textBoxProfilingSize->Text = RuntimeConfig::GetInstance().GetProfilingMaxFileSize().ToString();
5042  }
5043 }
5044 
5045 System::Void SampleForm::textBoxTraceFileMaxCount_TextChanged(System::Object^ sender, System::EventArgs^ e)
5046 {
5047  REFAPP_START_METHOD();
5048  if (piml->GlobalRuntimeManager == nullptr)
5049  {
5050  REFAPP_END_METHOD();
5051  return;
5052  }
5053 
5054  PrintTextCallback("Set TraceFileMaxCount to " + textBoxTraceFileMaxCount->Text);
5055 
5056  try
5057  {
5058  RuntimeConfig::GetInstance().SetTraceFileMaxCount(System::Convert::ToInt32(textBoxTraceFileMaxCount->Text));
5059  SyncWithParent(IS_NOT_NULL(piml->CreatorForm) ? piml->CreatorForm->textBoxTraceFileMaxCount : nullptr,
5060  textBoxTraceFileMaxCount);
5061  }
5062  catch (System::Exception^ ex)
5063  {
5064  PrintException(ex);
5065  textBoxTraceFileMaxCount->Text = RuntimeConfig::GetInstance().GetTraceFileMaxCount().ToString();
5066  }
5067  REFAPP_END_METHOD();
5068 }
5069 
5070 void SampleForm::WebServerTimer_Tick(System::Object^ sender, System::EventArgs^ e)
5071 {
5072  REFAPP_START_METHOD();
5073  UpdateWebServerButtonCallback();
5074  REFAPP_END_METHOD();
5075 }
5076 
5077 void SampleForm::UpdateWebServerButtonCallback()
5078 {
5079  REFAPP_START_METHOD();
5080  if (InvokeRequired)
5081  {
5082  Invoke(gcnew System::Action(this, &SampleForm::UpdateWebServerButtonCallback));
5083  REFAPP_END_METHOD();
5084  return;
5085  }
5086  if (piml->CustomScreenImplementation == nullptr)
5087  {
5088  buttonStartStopWebServer->Enabled = false;
5089  REFAPP_END_METHOD();
5090  return;
5091  }
5092 
5093  buttonStartStopWebServer->Enabled = true;
5094 #pragma region C++ for initialize resource
5095  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
5096 #pragma endregion
5097  if (Custom::DefaultCustomScreenImplementation::IsStartedHtmlWebserver()) // Has Start WebServer
5098  {
5099  if (piml->IsStartWebSever == 1 || resources == nullptr)
5100  {
5101  REFAPP_END_METHOD();
5102  return;
5103  }
5104 
5105  if (Util::Util::IsInstance<System::Object^>(resources->GetObject(L"StopWebServer.image")))
5106  {
5107  buttonStartStopWebServer->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"StopWebServer.image")));
5108  piml->IsStartWebSever = 1;
5109  }
5110  }
5111  else
5112  {
5113  if (piml->IsStartWebSever == 0 || resources == nullptr)
5114  {
5115  REFAPP_END_METHOD();
5116  return;
5117  }
5118 
5119  if (Util::Util::IsInstance<System::Object^>(resources->GetObject(L"StartWebServer.image")))
5120  {
5121  buttonStartStopWebServer->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"StartWebServer.image")));
5122  piml->IsStartWebSever = 0;
5123  }
5124  }
5125  REFAPP_END_METHOD();
5126 }
5127 
5128 System::Void SampleForm::buttonStartStopWebServer_Click(System::Object^ sender, System::EventArgs^ e)
5129 {
5130  StartStopWebServerCallback();
5131 }
5132 
5133 void SampleForm::StartStopWebServerCallback()
5134 {
5135  REFAPP_START_METHOD();
5136  if (InvokeRequired)
5137  {
5138  Invoke(gcnew System::Action(this, &SampleForm::StartStopWebServerCallback));
5139  REFAPP_END_METHOD();
5140  return;
5141  }
5142 
5143  if (piml->CustomScreenImplementation == nullptr)
5144  {
5145  REFAPP_END_METHOD();
5146  return;
5147  }
5148 
5149  if (Custom::DefaultCustomScreenImplementation::IsStartedHtmlWebserver() == false) // No Start WebServer
5150  {
5151  piml->CustomScreenImplementation->StartHtmlWebServer();
5152  }
5153  else
5154  {
5155  piml->CustomScreenImplementation->StopHtmlWebServer();
5156  }
5157  REFAPP_END_METHOD();
5158 }
5159 
5160 System::Void SampleForm::buttonLicense_Click(System::Object^ sender, System::EventArgs^ e)
5161 {
5162  REFAPP_START_METHOD();
5163  LicenseForm^ form = gcnew LicenseForm();
5164  form->SetParentForm(this);
5165  if (form != nullptr)
5166  {
5167  form->ShowDialog(this);
5168  }
5169  REFAPP_END_METHOD();
5170 }
5171 
5172 void SampleForm::ReloadRuntimeManager()
5173 {
5174  REFAPP_START_METHOD();
5175  try
5176  {
5177  // Reason: See #15223. Only implement at Sample Dotnet
5178  //std::string licenseKeyFromOTForOTPLicense = OpenTestSystem::Common::LicensingV5::Util->CreateLicenseKeyFromOTForOTPLicense();
5179  //if (!licenseKeyFromOTForOTPLicense.empty()&&LicenseUtil::Util::CheckLicenesFormat(licenseKeyFromOTForOTPLicense))
5180  //{
5181  // OpenTestSystem::Otx::Runtime::Api::License::LicenseManager::SetLicenseKey(licenseKeyFromOTForOTPLicense);
5182  //}
5183 
5184  piml->IpcInitializedBefore = "Reloading RuntimeManager";
5185  piml->GlobalRuntimeManager = CreateRuntimeManager();
5186 
5187  // TODO: update GUI if license is not valid
5188  }
5189  catch (const std::exception& ex)
5190  {
5191  PrintException(ex);
5192  PrintTextCallback("No RuntimeManager created");
5193  }
5194  catch (System::Exception^ ex)
5195  {
5196  PrintException(ex);
5197  PrintTextCallback("No RuntimeManager created");
5198  }
5199  REFAPP_END_METHOD();
5200 }
5201 
5202 #pragma region C++ for Invoke inside DoCyclic
5203 void SampleForm::ReloadContextFileCallback(CLRWrapper<std::shared_ptr<IRuntimeManager>>^ clrRuntimeManager)
5204 {
5205  REFAPP_START_METHOD();
5207  if (checkBoxNewRuntimeManager->Checked)
5208  {
5209  LoadContextFile(clrRuntimeManager->GetPtr());
5210  }
5211  REFAPP_END_METHOD();
5212 }
5213 #pragma endregion
5214 
5215 #pragma region C++
5216 IRuntimeContext* SampleForm::GetRuntimeContext(long long runtimeId)
5217 {
5218  REFAPP_START_METHOD();
5219  for (int i = 0; i < piml->RuntimeContexts.size(); i++)
5220  {
5221  if (piml->RuntimeContexts[i]->GetRuntimeId() == runtimeId)
5222  {
5223  REFAPP_END_METHOD();
5224  return piml->RuntimeContexts[i];
5225  }
5226  }
5227  REFAPP_END_METHOD();
5228  return nullptr;
5229 }
5230 
5231 void SampleForm::SetInstanceName(System::String^ instanceName)
5232 {
5233  REFAPP_START_METHOD();
5234  if (System::String::IsNullOrEmpty(instanceName) == false)
5235  {
5236  piml->Title = Util::Util::ToString(instanceName);
5237  }
5238  else
5239  {
5240  piml->Title = SampleConstants::MAIN_INSTANCE_NAME;
5241  }
5242  REFAPP_END_METHOD();
5243 }
5244 
5245 void SampleForm::SetCreatorForm(SampleForm^ creatorForm)
5246 {
5247  piml->CreatorForm = creatorForm;
5248 }
5249 #pragma endregion
5250 
5251 
5252 #pragma region C++ for RAW-mode
5253 std::shared_ptr<IRuntimeManager> SampleForm::CreateRawRuntimeManager()
5254 {
5255  REFAPP_START_METHOD();
5256  std::shared_ptr<IRuntimeManager> runtimeManager = nullptr;
5257  System::String^ ipcTypeString = "";
5258  if (comboBoxDiagIpcType->SelectedItem != nullptr)
5259  {
5260  ipcTypeString = comboBoxDiagIpcType->SelectedItem->ToString()->Trim();
5261  }
5262  IpcTypes ipcType = Util::Util::ToIpcType(ipcTypeString);
5263  std::string licenseKey;
5264  std::shared_ptr<Otx::DiagManager::OtxDiagApi::IOtxDiag> rawOtxDiag = nullptr;
5265  unsigned short diagPort;
5266  std::string inforRuntimeManagerCurrent;
5267 
5268  switch (ipcType)
5269  {
5270  case OpenTestSystem::Otx::Runtime2::Api::Sample::Raw:
5271 
5272  comboBoxODXProject->Items->Clear();
5273  comboBoxODXVehicle->Items->Clear();
5274 
5275  licenseKey = Util::Util::ToString(textBoxDiagManagerLicenseKey->Text);
5276 
5277  inforRuntimeManagerCurrent = "ipcRaw-diagIPCRaw with licenseKey=" + licenseKey;
5278  if (piml->IpcInitializedBefore._Equal(inforRuntimeManagerCurrent))
5279  {
5280  REFAPP_END_METHOD();
5281  return runtimeManager;
5282  }
5283  else
5284  {
5285  piml->IpcInitializedBefore = inforRuntimeManagerCurrent;
5286  }
5287 
5288  rawOtxDiag = Util::OtxDiagUtil::RawOtxDiag(licenseKey);
5289  runtimeManager = RuntimeManagerFactory::CreateRawRuntimeManager(rawOtxDiag);
5290 
5291  InitializeODXProject();
5292 
5293  break;
5294  case OpenTestSystem::Otx::Runtime2::Api::Sample::Socket:
5295 
5296  diagPort = System::Convert::ToUInt16(textBoxDiagPortPipe->Text);
5297 
5298  inforRuntimeManagerCurrent = "ipcRaw-diagIPCSocket with port=" + std::to_string(diagPort);
5299  if (piml->IpcInitializedBefore._Equal(inforRuntimeManagerCurrent))
5300  {
5301  REFAPP_END_METHOD();
5302  return runtimeManager;
5303  }
5304  else
5305  {
5306  piml->IpcInitializedBefore = inforRuntimeManagerCurrent;
5307  }
5308 
5309  runtimeManager = RuntimeManagerFactory::CreateRawRuntimeManager(diagPort);
5310 
5311  break;
5312  case OpenTestSystem::Otx::Runtime2::Api::Sample::Pipe:
5313 
5314  inforRuntimeManagerCurrent = "ipcRaw-diagIPCPipe with pipe=" + Util::Util::ToString(textBoxDiagPortPipe->Text);
5315  if (piml->IpcInitializedBefore._Equal(inforRuntimeManagerCurrent))
5316  {
5317  REFAPP_END_METHOD();
5318  return runtimeManager;
5319  }
5320  else
5321  {
5322  piml->IpcInitializedBefore = inforRuntimeManagerCurrent;
5323  }
5324 #pragma endregion
5325 
5326  runtimeManager = RuntimeManagerFactory::CreateRawRuntimeManager(Util::Util::ToString(textBoxDiagPortPipe->Text));
5327 
5328  break;
5329  }
5330 
5331  REFAPP_END_METHOD();
5332  return runtimeManager;
5333 }
5334 
5335 System::Void SampleForm::comboBoxODXProject_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
5336 {
5337  REFAPP_START_METHOD();
5338  try
5339  {
5340  System::String^ stringOdxProject = comboBoxODXProject->SelectedItem->ToString();
5341  comboBoxODXVehicle->Items->Clear();
5342  std::shared_ptr<Otx::DiagManager::OtxDiagApi::IOtxDiag> rawOtxDiag = Util::OtxDiagUtil::RawOtxDiag();
5343  if (rawOtxDiag != nullptr && rawOtxDiag->GetDiagConfiguration() != nullptr && System::String::IsNullOrEmpty(stringOdxProject) == false)
5344  {
5345  std::string odxProject = Util::Util::ToString(comboBoxODXProject->SelectedItem->ToString());
5346  rawOtxDiag->GetDiagConfiguration()->SelectProject(odxProject);
5347 
5348  std::vector<std::string> odxVehicles = rawOtxDiag->GetDiagConfiguration()->GetDbVehicleInformationList();
5349 
5350  std::string vehicleSetting = Setting::UserSettings::GetInstance().GetOdxVehicleInformation();
5351 
5352  for (size_t i = 0; i < odxVehicles.size(); i++)
5353  {
5354  std::string odxVehicle = odxVehicles[i];
5355  comboBoxODXVehicle->Items->Add(Util::Util::ToString(odxVehicle));
5356 
5357  if (vehicleSetting._Equal(odxVehicle))
5358  {
5359  comboBoxODXVehicle->SelectedIndex = i;
5360  }
5361  }
5362 
5363  if (comboBoxODXVehicle->SelectedIndex == -1)
5364  {
5365  comboBoxODXVehicle->SelectedIndex = 0;
5366  }
5367  }
5368  else
5369  {
5370  comboBoxODXVehicle->Items->Add("");
5371  comboBoxODXVehicle->SelectedIndex = 0;
5372  }
5373  }
5374  catch (const std::exception& ex)
5375  {
5376  PrintException(ex);
5377  }
5378  catch (System::Exception^ ex)
5379  {
5380  PrintException(ex);
5381  }
5382  REFAPP_END_METHOD();
5383 }
5384 
5385 System::Void SampleForm::comboBoxODXVehicle_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
5386 {
5387  REFAPP_START_METHOD();
5388  try
5389  {
5390  System::String^ stringOdxVehicle = comboBoxODXVehicle->SelectedItem->ToString()->Trim();
5391  std::shared_ptr<Otx::DiagManager::OtxDiagApi::IOtxDiag> rawOtxDiag = Util::OtxDiagUtil::RawOtxDiag();
5392  if (System::String::IsNullOrEmpty(stringOdxVehicle) == false && rawOtxDiag != nullptr)
5393  {
5394  rawOtxDiag->GetDiagConfiguration()->SelectVehicleInformation(Util::Util::ToString(stringOdxVehicle));
5395  }
5396  }
5397  catch (const std::exception& ex)
5398  {
5399  PrintException(ex);
5400  }
5401  catch (System::Exception^ ex)
5402  {
5403  PrintException(ex);
5404  }
5405  REFAPP_END_METHOD();
5406 }
5407 
5408 void SampleForm::InitializeODXProject()
5409 {
5410  REFAPP_START_METHOD();
5411  comboBoxODXProject->Items->Clear();
5412 
5413  try
5414  {
5415  std::string licenseKey = Util::Util::ToString(textBoxDiagManagerLicenseKey->Text);
5416  std::shared_ptr<OpenTestSystem::Otx::DiagManager::OtxDiagApi::IOtxDiag> otxDiag = Util::OtxDiagUtil::RawOtxDiag(licenseKey);
5417 
5418  if (otxDiag == nullptr || otxDiag->GetDiagConfiguration() == nullptr)
5419  {
5420  REFAPP_END_METHOD();
5421  return;
5422  }
5423 
5424  std::vector<std::string> dbProjectList = otxDiag->GetDiagConfiguration()->GetDbProjectList();
5425 
5426  std::string odxProjectSetting = Setting::UserSettings::GetInstance().GetOdxProject();
5427  for (size_t i = 0; i < dbProjectList.size(); i++)
5428  {
5429  std::string dbProject = dbProjectList[i];
5430  comboBoxODXProject->Items->Add(Util::Util::ToString(dbProject));
5431 
5432  if (odxProjectSetting._Equal(dbProject))
5433  {
5434  comboBoxODXProject->SelectedIndex = i;
5435  }
5436  }
5437 
5438  if (comboBoxODXProject->SelectedIndex == -1)
5439  {
5440  comboBoxODXProject->SelectedIndex = 0;
5441  }
5442  }
5443  catch (const std::exception& ex)
5444  {
5445  PrintException(ex);
5446  }
5447  catch (System::Exception^ ex)
5448  {
5449  PrintException(ex);
5450  }
5451  REFAPP_END_METHOD();
5452 }
5453 
5454 void SampleForm::SetupDiagManagerControls()
5455 {
5456  REFAPP_START_METHOD();
5457  // move to line of diag ipc type
5458  portPipeLabel->Location = System::Drawing::Point(Width - 324, 65);
5459  textBoxDiagPortPipe->Location = System::Drawing::Point(Width - 221, 62);
5460  textBoxDiagPortPipe->Size = System::Drawing::Size(181, 22);
5461 
5462  // initialize default value of related controls
5463 
5464  if (comboBoxDiagIpcType->Items->Count == 0)
5465  {
5466  comboBoxDiagIpcType->Items->AddRange(Util::Util::ArrayIpcTypes2String());
5467  comboBoxDiagIpcType->SelectedItem = Util::Util::ToString(Setting::UserSettings::GetInstance().GetDiagIpcType());
5468  }
5469 
5470  if (comboBoxDiagManagerTraceLevel->Items->Count == 0)
5471  {
5472  comboBoxDiagManagerTraceLevel->Items->AddRange(Util::Util::ArrayDiagLoggerLevels2String());
5473  comboBoxDiagManagerTraceLevel->SelectedItem = Util::Util::ToString(Setting::UserSettings::GetInstance().GetDiagManagerTraceLevel());
5474  }
5475 
5476  if (comboBoxDiagLoggingTraceLevel->Items->Count == 0)
5477  {
5478  comboBoxDiagLoggingTraceLevel->Items->AddRange(Util::Util::ArrayDiagnosticLogLevels2String());
5479  comboBoxDiagLoggingTraceLevel->SelectedItem = Util::Util::ToString(Setting::UserSettings::GetInstance().GetDiagLoggingTraceLevel());
5480  }
5481  REFAPP_END_METHOD();
5482 }
5483 
5484 System::Void SampleForm::comboBoxDiagIpcType_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
5485 {
5486  REFAPP_START_METHOD();
5487  labelOdxProject->Hide();
5488  comboBoxODXProject->Hide();
5489  labelODXVehicle->Hide();
5490  comboBoxODXVehicle->Hide();
5491 
5492  portPipeLabel->Hide();
5493  textBoxDiagPortPipe->Hide();
5494 
5495  textBoxDiagManagerLicenseKey->Enabled = false;
5496  comboBoxDiagManagerTraceLevel->Enabled = false;
5497  checkBoxIncludedDiagLogging->Enabled = false;
5498  comboBoxDiagLoggingTraceLevel->Enabled = false;
5499  textBoxDiagManagerTraceFolder->Enabled = false;
5500  buttonOpenDiagLoggingTraceFolder->Enabled = false;
5501  buttonBrowseDiagLoggingTraceFolder->Enabled = false;
5502 
5503  IpcTypes diagIpcType = Util::Util::ToIpcType(comboBoxDiagIpcType->SelectedItem->ToString());
5504  switch (diagIpcType)
5505  {
5506  case IpcTypes::Raw:
5507 
5508  labelOdxProject->Show();
5509  comboBoxODXProject->Show();
5510  labelODXVehicle->Show();
5511  comboBoxODXVehicle->Show();
5512 
5513  textBoxDiagManagerLicenseKey->Enabled = true;
5514  comboBoxDiagManagerTraceLevel->Enabled = true;
5515  checkBoxIncludedDiagLogging->Enabled = true;
5516  comboBoxDiagLoggingTraceLevel->Enabled = checkBoxIncludedDiagLogging->Checked;
5517  textBoxDiagManagerTraceFolder->Enabled = true;
5518  buttonOpenDiagLoggingTraceFolder->Enabled = true;
5519  buttonBrowseDiagLoggingTraceFolder->Enabled = true;
5520 
5521  InitializeODXProject();
5522  break;
5523 
5524  case IpcTypes::Socket:
5525 
5526  portPipeLabel->Show();
5527  portPipeLabel->Text = "DiagManager Ports";
5528 
5529  textBoxDiagPortPipe->Show();
5530  textBoxDiagPortPipe->Text = piml->DefaultDiagPort.ToString();
5531  textBoxDiagPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
5532 
5533  break;
5534 
5535  case IpcTypes::Pipe:
5536 
5537  portPipeLabel->Show();
5538  portPipeLabel->Text = "DiagManager Pipes";
5539 
5540  textBoxDiagPortPipe->Show();
5541  textBoxDiagPortPipe->Text = Util::Util::ToString(piml->DefaultDiagPipeName);
5542  textBoxDiagPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
5543 
5544  break;
5545 
5546  }
5547 
5548  piml->GlobalRuntimeManager = CreateRuntimeManager();
5549  REFAPP_END_METHOD();
5550 }
5551 
5552 System::Void SampleForm::checkBoxIncludedDiagLogging_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
5553 {
5554  REFAPP_START_METHOD();
5555  if (IsDiagIpcRaw() == false)
5556  {
5557  REFAPP_END_METHOD();
5558  return;
5559  }
5560 
5561  comboBoxDiagLoggingTraceLevel->Enabled = checkBoxIncludedDiagLogging->Checked;
5562 
5563  UpdateDiagLogging();
5564  REFAPP_END_METHOD();
5565 }
5566 
5567 System::Void SampleForm::buttonOpenDiagLoggingTraceFolder_Click(System::Object^ sender, System::EventArgs^ e)
5568 {
5569  REFAPP_START_METHOD();
5570  if (IsDiagIpcRaw() == false)
5571  {
5572  REFAPP_END_METHOD();
5573  return;
5574  }
5575 
5576  System::String^ path = textBoxDiagManagerTraceFolder->Text;
5577  if (System::IO::Directory::Exists(path))
5578  {
5579  System::Diagnostics::Process::Start(path);
5580  }
5581  REFAPP_END_METHOD();
5582 }
5583 
5584 System::Void SampleForm::buttonBrowseDiagLoggingTraceFolder_Click(System::Object^ sender, System::EventArgs^ e)
5585 {
5586  REFAPP_START_METHOD();
5587  if (IsDiagIpcRaw() == false)
5588  {
5589  REFAPP_END_METHOD();
5590  return;
5591  }
5592 
5593  folderBrowserDialog1->SelectedPath = textBoxDiagManagerTraceFolder->Text;
5594  folderBrowserDialog1->ShowNewFolderButton = true;
5595 
5596  System::Windows::Forms::DialogResult result = folderBrowserDialog1->ShowDialog();
5597  if (result == System::Windows::Forms::DialogResult::OK)
5598  {
5599  textBoxDiagManagerTraceFolder->Text = folderBrowserDialog1->SelectedPath;
5600  }
5601  REFAPP_END_METHOD();
5602 }
5603 
5604 System::Void SampleForm::textBoxDiagManagerLicenseKey_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e)
5605 {
5606  REFAPP_START_METHOD();
5607  if (IsDiagIpcRaw() == false)
5608  {
5609  REFAPP_END_METHOD();
5610  return;
5611  }
5612 
5613  if (e->KeyCode == System::Windows::Forms::Keys::Delete || e->KeyCode == System::Windows::Forms::Keys::Back)
5614  {
5615  textBoxDiagManagerLicenseKey->Clear();
5616  }
5617  REFAPP_END_METHOD();
5618 }
5619 
5620 System::Void SampleForm::textBoxDiagManagerLicenseKey_TextChanged(System::Object^ sender, System::EventArgs^ e)
5621 {
5622  REFAPP_START_METHOD();
5623  if (IsDiagIpcRaw() == false)
5624  {
5625  REFAPP_END_METHOD();
5626  return;
5627  }
5628 
5629  System::Windows::Forms::TextBox^ textBox = dynamic_cast<System::Windows::Forms::TextBox^>(sender);
5630  System::String^ inputRemoveHyphen = textBox->Text->Replace("-", "");
5631 
5632  System::Text::StringBuilder^ formattedLicenseKey = gcnew System::Text::StringBuilder();
5633  for (int i = 0; i < inputRemoveHyphen->Length; i++)
5634  {
5635  formattedLicenseKey->Append(inputRemoveHyphen[i]);
5636  if ((i + 1) % 5 == 0 && i + 1 < inputRemoveHyphen->Length)
5637  {
5638  formattedLicenseKey->Append("-");
5639  }
5640  }
5641 
5642  textBoxDiagManagerLicenseKey->Text = formattedLicenseKey->ToString();
5643  textBoxDiagManagerLicenseKey->SelectionStart = textBoxDiagManagerLicenseKey->Text->Length;
5644 
5645  std::string licenseKey = Util::Util::ToString(textBoxDiagManagerLicenseKey->Text);
5646  if (Util::LicenseUtil::CheckLicenseFormat(licenseKey))
5647  {
5648  this->piml->ErrorProvider->Clear();
5649  try
5650  {
5651  std::shared_ptr<OpenTestSystem::Otx::DiagManager::OtxDiagApi::IOtxDiag> otxDiag = Util::OtxDiagUtil::RawOtxDiag(licenseKey);
5652  InitializeODXProject();
5653 
5654  if (Util::OtxDiagUtil::RawOtxDiag() != nullptr)
5655  {
5656  piml->ErrorProvider->SetError(textBoxDiagManagerLicenseKey, "");
5657  }
5658  }
5659  catch (const std::exception& ex)
5660  {
5661  piml->ErrorProvider->SetError(textBoxDiagManagerLicenseKey, Util::Util::ToString(ex.what()));
5662  }
5663  catch (System::Exception^ ex)
5664  {
5665  piml->ErrorProvider->SetError(textBoxDiagManagerLicenseKey, ex->Message);
5666  }
5667  catch (...)
5668  {
5669  piml->ErrorProvider->SetError(textBoxDiagManagerLicenseKey, "License key invalid.");
5670  }
5671 
5672  try
5673  {
5674  piml->GlobalRuntimeManager = CreateRuntimeManager();
5675  }
5676  catch (const std::exception& ex)
5677  {
5678  PrintException(ex);
5679  }
5680  catch (System::Exception^ ex)
5681  {
5682  PrintException(ex);
5683  }
5684  }
5685  else
5686  {
5687  this->piml->ErrorProvider->SetError(textBoxDiagManagerLicenseKey, "License key does not match the desired format XXXXX-XXXXX-XXXXX-XXXXX-XXXXX.");
5688  this->comboBoxODXProject->Items->Clear();
5689  this->comboBoxODXProject->Items->Add("");
5690  this->comboBoxODXProject->SelectedIndex = 0;
5691  }
5692  REFAPP_END_METHOD();
5693 }
5694 
5695 System::Void SampleForm::comboBoxDiagManagerTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
5696 {
5697  REFAPP_START_METHOD();
5698  if (IsDiagIpcRaw() == false || Util::OtxDiagUtil::RawOtxDiag() == nullptr)
5699  {
5700  REFAPP_END_METHOD();
5701  return;
5702  }
5703 
5704  OpenTestSystem::Otx::DiagManager::Common::ILog::Level loggerLevel = Util::Util::ToLoggerLevel(comboBoxDiagManagerTraceLevel->SelectedItem->ToString());
5705 
5706  Util::OtxDiagUtil::SetLevelLogger(loggerLevel);
5707  PrintTextCallback("Updated trace level");
5708  REFAPP_END_METHOD();
5709 }
5710 
5711 void SampleForm::UpdateDiagLogging()
5712 {
5713  REFAPP_START_METHOD();
5714  if (IsDiagIpcRaw() == false || Util::OtxDiagUtil::RawOtxDiag() == nullptr)
5715  {
5716  REFAPP_END_METHOD();
5717  return;
5718  }
5719 
5720  try
5721  {
5722  System::String^ stringDiagTraceFolder = textBoxDiagManagerTraceFolder->Text->Trim();
5723  std::string diagTraceFolder = System::String::IsNullOrEmpty(stringDiagTraceFolder) ? "" : Util::Util::ToString(stringDiagTraceFolder);
5724  int logLevel = Util::OtxDiagUtil::GetDiagnosticLogLevelDefault();
5725 
5726  if (checkBoxIncludedDiagLogging->Checked && comboBoxDiagLoggingTraceLevel->SelectedItem != nullptr)
5727  {
5728  logLevel = Util::Util::ToDiagDiagnosticsLogLevel(comboBoxDiagLoggingTraceLevel->SelectedItem->ToString());
5729  }
5730 
5731  Util::OtxDiagUtil::SetDiagDiagnosticLogging(logLevel, diagTraceFolder);
5732  }
5733  catch (const std::exception& ex)
5734  {
5735  PrintException(ex);
5736  }
5737  catch (System::Exception^ ex)
5738  {
5739  PrintException(ex);
5740  }
5741  catch (...) {}
5742  REFAPP_END_METHOD();
5743 }
5744 
5745 System::Void SampleForm::comboBoxDiagLoggingTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e)
5746 {
5747  if (IsDiagIpcRaw() == false)
5748  {
5749  return;
5750  }
5751 
5752  UpdateDiagLogging();
5753 }
5754 
5755 System::Void SampleForm::textBoxDiagManagerTraceFolder_TextChanged(System::Object^ sender, System::EventArgs^ e)
5756 {
5757  REFAPP_START_METHOD();
5758  if (IsDiagIpcRaw() == false || Util::OtxDiagUtil::RawOtxDiag() == nullptr)
5759  {
5760  REFAPP_END_METHOD();
5761  return;
5762  }
5763 
5764  try
5765  {
5766  std::string diagTraceFolder = Util::Util::ToString(textBoxDiagManagerTraceFolder->Text);
5767 
5768  Util::OtxDiagUtil::SetPathLogger(diagTraceFolder);
5769  UpdateDiagLogging();
5770  PrintTextCallback("Updated DiagManager trace folder");
5771  }
5772  catch (const std::exception& ex)
5773  {
5774  PrintException(ex);
5775  }
5776  catch (System::Exception^ ex)
5777  {
5778  PrintException(ex);
5779  }
5780  catch (...) {}
5781  REFAPP_END_METHOD();
5782 }
5783 
5784 bool SampleForm::IsDiagIpcRaw()
5785 {
5786  REFAPP_START_METHOD();
5787  bool result = false;
5788  System::String^ ipcValue, ^ ipcDiagValue;
5789 
5790  try
5791  {
5792  if (Util::Util::IsInstance<System::Windows::Forms::ComboBox^>(comboBoxIpcType) &&
5793  Util::Util::IsInstance<System::Windows::Forms::ComboBox^>(comboBoxDiagIpcType) &&
5794  comboBoxIpcType->SelectedItem != nullptr &&
5795  comboBoxDiagIpcType->SelectedItem != nullptr)
5796  {
5797  ipcValue = comboBoxIpcType->SelectedItem->ToString();
5798  ipcDiagValue = comboBoxDiagIpcType->SelectedItem->ToString();
5799  result = Util::Util::ToIpcType(ipcValue) == IpcTypes::Raw && Util::Util::ToIpcType(ipcDiagValue) == IpcTypes::Raw;
5800  }
5801  }
5802  catch (...) {}
5803  REFAPP_END_METHOD();
5804  return result;
5805 }
5806 #pragma endregion
LogLevels
Levels for logging of diagnostic communication
Definition: INoneOtxDiag.h:21
static void SetLicenseKey(const std::string &licenseKey)
Sets a valid license key to release the API.
TraceLevels GetTraceLevel() const
Gets OTX-Runtime Tracing Level. The Tracing is the internal logging of the API. Default value: ERROR.
bool SetTraceFolder(const std::string &path)
Sets directory where the trace files are stored.
bool SetTraceLevel(const TraceLevels traceLevel)
Sets OTX-Runtime Tracing Level. The Tracing is the internal logging of the API. Default value: ERROR.
static RuntimeConfig & GetInstance()
Get RuntimeConfig Instance
ExecutionStateChangeReason
Reason, why a procedure execution state was changed, e.g. Paused or Running
Definition: ExecutionStateChangeReason.h:12
ClampState
Contains the state of a clamp
Definition: ClampState.h:12
@ NotAvailable
The clamp state cannot be determined (default)
ExpectedState
Contains the expected state of the diagnostic connection
Definition: ExpectedState.h:12
@ BatteryOn
The connection state is battery ON, which means KL30 is On AND KL15 will be ignored
@ IgnitionOff
The connection state is ignition OFF, which means KL30 is On AND KL15 is Off OR KL15 is NotAvailable
@ IgnitionOn
The connection state is ignition ON, which means KL30 is On AND KL15 is On

Code Example Header-File

Code example (.\otxruntime\ReferenceApplication\src\Gui\SampleForm.h) of the OTX-Runtime API Sample Program.

1 #pragma once
2 
3 #include "CustomImplTypes.h"
4 #include "IRuntimeManager.h"
5 #include "CLRWrapper.h"
6 
7 #include <Project/IProject.h>
8 #include <Otx/IPackage.h>
9 #include <Otx/IDocument.h>
10 #include <Otx/IProcedure.h>
11 #include <KeyEventArgs.h>
12 #include <Exceptions/Exception.h>
13 using namespace OpenTestSystem::Otx::Runtime::Api;
14 
15 #include <memory>
16 
17 namespace OpenTestSystem { namespace Otx { namespace Runtime2 { namespace Api { namespace Sample {
18 
19  struct SampleFormImpl;
20 
24  public ref class SampleForm : public System::Windows::Forms::Form
25  {
26  public:
27  SampleForm(void)
28  {
29  InitializeComponent();
30  //
31  //TODO: Add the constructor code here
32  //
33  InitializeInternalComponent();
34  }
35  SampleForm(System::String^ title, SampleForm^ createForm);
36 
37  protected:
41  ~SampleForm()
42  {
43  if (components)
44  {
45  delete components;
46  }
47 
48  if (piml)
49  {
50  delete piml;
51  }
52  }
53 
54  private: System::Windows::Forms::Panel^ panel1;
55  private: System::Windows::Forms::Button^ buttonBrowseFile;
56  private: System::Windows::Forms::ComboBox^ cbFilePath;
57  private: System::Windows::Forms::Label^ label1;
58  private: System::Windows::Forms::Panel^ panel2;
59  private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
60  private: System::Windows::Forms::TextBox^ txtPassword;
61  private: System::Windows::Forms::Label^ passwordLabel;
62  private: System::Windows::Forms::SplitContainer^ splitContainer1;
63  private: System::Windows::Forms::TreeView^ treeViewOtxProject;
64  private: System::Windows::Forms::Label^ label3;
65  private: System::Windows::Forms::DataGridView^ gridViewParameter;
66  private: System::Windows::Forms::Label^ labelAdjustProcedureParameters;
67  private: System::Windows::Forms::Button^ buttonExecuteSelectedProcedure;
68  private: System::Windows::Forms::Button^ buttonReload;
69  private: System::Windows::Forms::SplitContainer^ splitContainer2;
70  private: System::Windows::Forms::SplitContainer^ splitContainer3;
71  private: System::Windows::Forms::Label^ label4;
72  private: System::Windows::Forms::DataGridView^ gridViewContext;
73  private: System::Windows::Forms::Label^ label5;
74  private: System::Windows::Forms::DataGridView^ gridViewState;
75  private: System::Windows::Forms::SplitContainer^ splitContainer4;
76  private: System::Windows::Forms::ComboBox^ comboBoxTraceLevel;
77  private: System::Windows::Forms::Label^ label8;
78  private: System::Windows::Forms::Label^ label6;
79  private: System::Windows::Forms::TextBox^ textBoxTraceFolder;
80  private: System::Windows::Forms::Label^ label9;
81  private: System::Windows::Forms::Button^ buttonBrowseTraceFolder;
82  private: System::Windows::Forms::ComboBox^ comboBoxIpcType;
83  private: System::Windows::Forms::Label^ label11;
84  private: System::Windows::Forms::Label^ label10;
85  private: System::Windows::Forms::Label^ portPipeLabel;
86  private: System::Windows::Forms::TextBox^ textBoxRtPortPipe;
87  private: System::Windows::Forms::Button^ buttonExecuteMain;
88  private: System::Windows::Forms::Button^ buttonStop;
89  private: System::Windows::Forms::CheckBox^ checkBoxCyclicExecution;
90  private: System::Windows::Forms::CheckBox^ checkBoxAsyncExecution;
91  private: System::Windows::Forms::Button^ buttonNewInstanceNewThread;
92  private: System::Windows::Forms::Button^ buttonNewInstance;
93  private: System::Windows::Forms::Label^ labelOutputOverflow;
94  private: System::Windows::Forms::Button^ buttonCopyRow;
95  private: System::Windows::Forms::Button^ buttonClearOutput;
96  private: System::Windows::Forms::ListBox^ listBoxOuput;
97  private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog1;
98  private: System::Windows::Forms::ImageList^ imageList1;
99  private: System::Windows::Forms::SplitContainer^ splitContainer5;
100  private: System::Windows::Forms::GroupBox^ groupBox1;
101  private: System::Windows::Forms::RadioButton^ radioButtonDefaultImplementation;
102  private: System::Windows::Forms::RadioButton^ radioButtonOuputWindow;
103  private: System::Windows::Forms::RadioButton^ radioButtonNoCustomImplementation;
104  private: System::Windows::Forms::Panel^ panel3;
105  private: System::Windows::Forms::Panel^ panel4;
106  private: System::Windows::Forms::Button^ buttonWriteSettings;
107  private: System::Windows::Forms::Button^ buttonReadSettings;
108  private: System::Windows::Forms::DataGridView^ gridViewSettings;
109  private: System::Windows::Forms::Label^ label12;
110  private: System::Windows::Forms::CheckBox^ buttonHmi;
111  private: System::Windows::Forms::CheckBox^ checkBoxCyclicReload;
112  private: System::Windows::Forms::Label^ label13;
113  private: System::Windows::Forms::Label^ label15;
114  private: System::Windows::Forms::Label^ label14;
115  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnSettingName;
116  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnSettingValue;
117  private: System::Windows::Forms::CheckBox^ checkBoxAdd2Output;
118  private: System::Windows::Forms::CheckBox^ checkBoxNewRuntimeManager;
119  private: System::Windows::Forms::TextBox^ textBoxRuntimeContextName;
120  private: System::Windows::Forms::Label^ runtimeNameLabel;
121  private: System::Windows::Forms::CheckBox^ buttonPause;
122  private: System::Windows::Forms::CheckBox^ checkBoxIgnition;
123  private: System::Windows::Forms::CheckBox^ checkBoxUseConnectionState;
124  private: System::Windows::Forms::TextBox^ textBoxVoltageThreshold;
125  private: System::Windows::Forms::Label^ labelVoltageThreshold;
126  private: System::Windows::Forms::TextBox^ textBoxPollingTime;
127  private: System::Windows::Forms::Label^ labelPollingTime;
128  private: System::Windows::Forms::Label^ labelTimeout;
129  private: System::Windows::Forms::TextBox^ textBoxTimeout;
130  private: System::Windows::Forms::TextBox^ textBoxDiagPortPipe;
131  private: System::Windows::Forms::Button^ buttonOpenTraceFolder;
132  private: System::Windows::Forms::Label^ labelSeparator2;
133  private: System::Windows::Forms::Label^ labelProcedureExecutionState;
134  private: System::Windows::Forms::TableLayoutPanel^ tableLayoutPanelExecutionState;
135  private: System::Windows::Forms::Label^ label18;
136  private: System::Windows::Forms::Label^ labelExpectedState;
137  private: System::Windows::Forms::Label^ labelSeparator3;
138  private: System::Windows::Forms::Label^ labelSeparator4;
139  private: System::Windows::Forms::Label^ labelSeparator1;
140  private: System::Windows::Forms::Label^ labelBatteryState;
141  private: System::Windows::Forms::Label^ labelIconProcedureExecutionState;
142  private: System::Windows::Forms::Button^ buttonCheckBatteryIgnition;
143  private: System::Windows::Forms::Label^ labelIgnitionState;
144  private: System::Windows::Forms::CheckBox^ checkBoxStartAllParents;
145  private: System::Windows::Forms::TextBox^ textBoxTraceFileMaxSize;
146  private: System::Windows::Forms::TextBox^ textBoxTraceFileMaxCount;
147  private: System::Windows::Forms::Label^ label2;
148  private: System::Windows::Forms::Timer^ updateGuiTimer;
149  private: System::Windows::Forms::Label^ labelSeparator5;
150  private: System::Windows::Forms::Label^ labelProcedureExecutionTimes;
151  private: System::Windows::Forms::ToolTip^ toolTip1;
152  private: System::Windows::Forms::Button^ buttonStartStopWebServer;
153  private: System::Windows::Forms::Button^ buttonLicense;
154  private: System::ComponentModel::IContainer^ components;
155  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnName;
156  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnDirection;
157  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnDataType;
158  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnValue;
159  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnDetails;
160  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnContextName;
161  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnContextDataType;
162  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnContextValue;
163  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnContextDetails;
164  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnStateName;
165  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnStateDataType;
166  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnStateValue;
167  private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumnStateDetails;
168  private: System::Windows::Forms::ComboBox^ comboBoxODXProject;
169  private: System::Windows::Forms::ComboBox^ comboBoxODXVehicle;
170  private: System::Windows::Forms::Label^ labelDiagType;
171  private: System::Windows::Forms::Label^ labelOdxProject;
172  private: System::Windows::Forms::Label^ labelODXVehicle;
173  private: System::Windows::Forms::Label^ label7;
174  private: System::Windows::Forms::ComboBox^ comboBoxDiagIpcType;
175  private: System::Windows::Forms::CheckBox^ checkBoxIncludedDiagLogging;
176  private: System::Windows::Forms::ComboBox^ comboBoxDiagManagerTraceLevel;
177  private: System::Windows::Forms::Label^ label16;
178  private: System::Windows::Forms::TextBox^ textBoxDiagManagerLicenseKey;
179  private: System::Windows::Forms::ComboBox^ comboBoxDiagLoggingTraceLevel;
180  private: System::Windows::Forms::Label^ label17;
181  private: System::Windows::Forms::TextBox^ textBoxDiagManagerTraceFolder;
182  private: System::Windows::Forms::Label^ label19;
183  private: System::Windows::Forms::Button^ buttonBrowseDiagLoggingTraceFolder;
184  private: System::Windows::Forms::Button^ buttonOpenDiagLoggingTraceFolder;
185  private: System::Windows::Forms::TextBox^ textBoxProfilingSize;
186  private: System::Windows::Forms::CheckBox^ checkBoxProfiling;
187 
188  protected:
189 
190  private:
194  SampleFormImpl* piml;
195 
196  void RegisterSettingsEvent();
197  void InitializeInternalComponent();
198  void CreateCustomImpl();
199  void CreateDefaultCustomImpl();
200  void CreateOutputWindowCustomImpl();
201  void InitializeSampleDefaultValues();
202  void LoadSetting();
203  void AddComboBoxFileOrPath(System::Windows::Forms::ComboBox^ comboBox);
204  void SetupTraceLevel();
205  void SetupTraceFolder();
206  void SetupTraceFileProfilerMaxCountAndSize();
207  void SetupDefaultPortAndPipeName();
208  void SetupCustomImplType();
209  void SetupWindowSize();
210  void SetupWindowLocation();
211  bool CheckFormIsInBound(System::Drawing::Point location);
212  void SetupTimeOut();
213  void SetupPollingTime();
214  void SetupVoltageThreshold();
215  void UpdateWebServerButtonCallback();
216  void SetRuntimeContextName();
217  void SetTitle(System::String^ title);
218  void SetLocation(SampleForm^ creatorForm);
219  void PrintException(System::Exception^ ex);
220  void PrintException(System::Exception^ ex, System::String^ additionalText);
221  void PrintException(const std::exception& ex);
222  void PrintException(const std::exception& ex, System::String^ additionalText);
223  std::shared_ptr<IRuntimeManager> CreateRuntimeManager();
224  std::shared_ptr<IRuntimeManager> CreateRawRuntimeManager();
225  std::shared_ptr<IRuntimeManager> CreateSocketRuntimeManager();
226  std::shared_ptr<IRuntimeManager> CreatePipeRuntimeManager();
227  bool NoDiag();
228  void InitializeRuntimeEvents(std::shared_ptr<IRuntimeManager> runtimeManager);
229  void SetCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager);
230  CustomImplTypes GetCurrentCustomImpl();
231  void SetOutputWindowImplementation(std::shared_ptr<IRuntimeManager> runtimeManager);
232  void SetDefaultCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager);
233  void RemoveCustomImplementation(std::shared_ptr<IRuntimeManager> runtimeManager);
234  System::String^ GetTimeAndDurationStringSinceLastTimeAndUpdateLastTime();
235  void EnableConnectionState();
236  void SyncWithParent(System::Object^ parentControl);
237  void SyncWithParent(System::Object^ parentControl, System::Object^ control);
238  void SyncWithParent(System::Object^ parentControl, System::Object^ control, bool newThread);
239  void ParentButtonClickCallback(System::Object^ state);
240  void TextBoxSetTextCallback(cli::array<System::Object^>^ arr);
241  void ParentTextBoxSetTextCallback(System::Object^ state);
242  void CheckBoxSetCheckStateCallback(cli::array<System::Object^>^ arr);
243  void ParentCheckBoxSetCheckStateCallback(System::Object^ state);
244  void ComboBoxSetIndexCallback(cli::array<System::Object^>^ arr);
245  void ParentComboBoxSetIndexCallback(System::Object^ state);
246  void NumericUpDownSetValueCallback(cli::array<System::Object^>^ arr);
247  void ParentNumericUpDownSetValueCallback(System::Object^ state);
248  System::String^ IpcPortPipeString();
249  void LoadContextFile(std::shared_ptr<IRuntimeManager> runtimeManager);
250  void ReloadContextFileCallback(CLRWrapper<std::shared_ptr<IRuntimeManager>>^ clrRuntimeManager);
251  void ClearSampleGUI();
252  std::shared_ptr<Project::IProject> LoadPtx(std::shared_ptr<IRuntimeManager> runtimeManager);
253  void ClearCustomImplemetationCaches();
254  void LoadPackage(std::shared_ptr<Project::IProject> project);
255  System::Windows::Forms::TreeNode^ CreatePackageNode(std::shared_ptr<IPackage> pack);
256  System::Windows::Forms::TreeNode^ CreateDocumentNode(std::shared_ptr<IDocument> doc);
257  System::Windows::Forms::TreeNode^ CreateProcedureName(std::shared_ptr<IProcedure> proc);
258  void ReadSettings(std::map<std::string, std::string> settings);
259  std::shared_ptr<Project::IPlayerProject> LoadPpx(std::shared_ptr<IRuntimeManager> runtimeManager);
260  System::Void HmiWindow_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e);
261  System::Void NewInstanceInThread();
262  void ExecuteProcedure();
263  void ExecuteProcedureSync(cli::array<System::Object^>^ args);
264  void CheckBatteryIgnitionState(std::shared_ptr<IRuntimeManager> runtimeManager);
265  void SetBatteryIgnitionState(ClampState batteryState, ClampState ignitionState);
266  void UpdateGridView(std::shared_ptr<IProcedure> procedure);
267  void UpdateGridviewParameter(std::shared_ptr<IProcedure> procedure);
268  void UpdateGridviewParameter(std::shared_ptr<IProcedureParameter> parameter);
269  System::String^ ConvertValue2String(std::shared_ptr<DataTypes::Object> value);
270  System::String^ GetDetails(std::shared_ptr<DataTypes::Object> value);
271  void UpdateGridViewContextVariable(std::shared_ptr<IDocument> document, bool withPrefix, std::vector<std::string>& listItemReviewed);
272  void UpdateGridViewStateVariable(std::shared_ptr<IDocument> document, bool withPrefix, std::vector<std::string>& listItemReviewed);
273  void DoCyclic(System::Object^ args);
274  void CheckCyclicReloadOrNewRuntimeManager(std::shared_ptr<IRuntimeManager> runtimeManager);
275  void CheckCyclicReloadOrNewRuntimeManager(std::shared_ptr<IRuntimeManager> runtimeManager, bool waitCyclic);
276  void CheckCyclicReloadOrNewRuntimeManagerCallback(cli::array<System::Object^>^ arr);
277  void WaitCyclicExecuteAsyncIsProcessing();
278  void UpdateButtonStateAfterThrowException();
279  void UpdateExecutionStateButtons(bool wasExecuted);
280  void UpdatePauseButton(bool pauseAvailable);
281  void UpdatePauseButton(bool pauseAvailable, bool enabled);
282  void DisplayProcedureExecutionTimes();
283  void SaveSettings();
284  void SaveSocketPortOrPipeName();
285  void SetExpectedState();
286  std::shared_ptr<Project::IProject> GetProject(std::shared_ptr<IProcedure> procedure);
287  void UpdateExecutionState(IRuntimeContext* context);
288  void UpdateExecutionState(IRuntimeContext* context, ExecutionStateChangeReason reason);
289  void AddRuntimeContext(IRuntimeContext* context);
290  IRuntimeContext* GetRuntimeContext(long long runtimeId);
291  void DisplayProcedureExecutionState(IRuntimeContext* context);
292  void DisplayProcedureExecutionState(IRuntimeContext* context, System::String^ errorMessage);
293  void RemoveRuntimeContext(IRuntimeContext* context);
294  void StartStopUpdateGuiTimer();
295  void ShowConnectionStateMessage(IRuntimeContext* context);
296  std::string ShortenedValueString(std::shared_ptr<DataTypes::Object> value);
297  bool IsPauseEnabled();
298  bool IsContinueEnable();
299 
300  void StartStopWebServerCallback();
301 
302  void InitializeODXProject();
303  void SetupDiagManagerControls();
304  void UpdateDiagLogging();
305  bool IsDiagIpcRaw();
306 
307  public:
308  void PrintTextCallback(System::String^ text);
309  void ReloadRuntimeManager();
310  void SetInstanceName(System::String^ instanceName);
311  void SetCreatorForm(SampleForm^ creatorForm);
312 
313  void ProcedurePendingCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
314  void ProcedureStartedCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
315  void ProcedurePaused(IRuntimeContext* context, ExecutionStateChangeReason reason);
316  void ProcedurePausedCallback(cli::array<System::Object^>^ arr);
317  void ProcedureContinuedCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
318  void ProcedureFinishedCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
319  void ProcedureStoppedCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
320  void ProcedureAbortedCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
321  void ProcedureTimeoutCallback(CLRWrapper<IRuntimeContext*>^ clrContext);
322  void DiagConnectionStateChanged(ClampState batteryState, ClampState ignitionState);
323  void DiagConnectionStateChangedCallback(cli::array<System::Object^>^ arr);
324  void InOutParameterValueChanged(IRuntimeContext* context, IProcedureInOutParameter* parameter);
325  void InOutParameterValueChangedCallback(cli::array<System::Object^>^ arr);
326  void CustomScreenImplementation_KeyDown(std::shared_ptr<Custom::KeyEventArgs> eventArgs);
327 
328  void ContextVariableRead(std::shared_ptr<IContextVariable> contextVariable, std::shared_ptr<DataTypes::Object> value);
329  void ContextVariableReadCallback(cli::array<System::Object^>^ arr);
330  void StateVariableValueChanged(std::shared_ptr<IStateVariable> stateVariable, std::shared_ptr<DataTypes::Object> value);
331  void StateVariableValueChangedCallback(cli::array<System::Object^>^ arr);
332  void UpdateGridViewStateVariable(std::shared_ptr<IStateVariable> stateVariable);
333 
334  private:
335 #pragma region Windows Form Designer generated code
340  void InitializeComponent(void)
341  {
342  this->components = (gcnew System::ComponentModel::Container());
343  System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(SampleForm::typeid));
344  System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
345  System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle2 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
346  System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle3 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
347  this->panel1 = (gcnew System::Windows::Forms::Panel());
348  this->textBoxProfilingSize = (gcnew System::Windows::Forms::TextBox());
349  this->checkBoxProfiling = (gcnew System::Windows::Forms::CheckBox());
350  this->buttonBrowseDiagLoggingTraceFolder = (gcnew System::Windows::Forms::Button());
351  this->buttonOpenDiagLoggingTraceFolder = (gcnew System::Windows::Forms::Button());
352  this->textBoxDiagManagerTraceFolder = (gcnew System::Windows::Forms::TextBox());
353  this->label19 = (gcnew System::Windows::Forms::Label());
354  this->comboBoxDiagLoggingTraceLevel = (gcnew System::Windows::Forms::ComboBox());
355  this->label17 = (gcnew System::Windows::Forms::Label());
356  this->checkBoxIncludedDiagLogging = (gcnew System::Windows::Forms::CheckBox());
357  this->comboBoxDiagManagerTraceLevel = (gcnew System::Windows::Forms::ComboBox());
358  this->label16 = (gcnew System::Windows::Forms::Label());
359  this->textBoxDiagManagerLicenseKey = (gcnew System::Windows::Forms::TextBox());
360  this->label7 = (gcnew System::Windows::Forms::Label());
361  this->comboBoxDiagIpcType = (gcnew System::Windows::Forms::ComboBox());
362  this->labelDiagType = (gcnew System::Windows::Forms::Label());
363  this->labelOdxProject = (gcnew System::Windows::Forms::Label());
364  this->labelODXVehicle = (gcnew System::Windows::Forms::Label());
365  this->comboBoxODXVehicle = (gcnew System::Windows::Forms::ComboBox());
366  this->comboBoxODXProject = (gcnew System::Windows::Forms::ComboBox());
367  this->label2 = (gcnew System::Windows::Forms::Label());
368  this->textBoxTraceFileMaxSize = (gcnew System::Windows::Forms::TextBox());
369  this->textBoxTraceFileMaxCount = (gcnew System::Windows::Forms::TextBox());
370  this->buttonOpenTraceFolder = (gcnew System::Windows::Forms::Button());
371  this->textBoxRuntimeContextName = (gcnew System::Windows::Forms::TextBox());
372  this->runtimeNameLabel = (gcnew System::Windows::Forms::Label());
373  this->textBoxDiagPortPipe = (gcnew System::Windows::Forms::TextBox());
374  this->textBoxRtPortPipe = (gcnew System::Windows::Forms::TextBox());
375  this->label13 = (gcnew System::Windows::Forms::Label());
376  this->portPipeLabel = (gcnew System::Windows::Forms::Label());
377  this->comboBoxIpcType = (gcnew System::Windows::Forms::ComboBox());
378  this->label11 = (gcnew System::Windows::Forms::Label());
379  this->label10 = (gcnew System::Windows::Forms::Label());
380  this->buttonBrowseTraceFolder = (gcnew System::Windows::Forms::Button());
381  this->textBoxTraceFolder = (gcnew System::Windows::Forms::TextBox());
382  this->label9 = (gcnew System::Windows::Forms::Label());
383  this->comboBoxTraceLevel = (gcnew System::Windows::Forms::ComboBox());
384  this->label8 = (gcnew System::Windows::Forms::Label());
385  this->label6 = (gcnew System::Windows::Forms::Label());
386  this->buttonReload = (gcnew System::Windows::Forms::Button());
387  this->txtPassword = (gcnew System::Windows::Forms::TextBox());
388  this->passwordLabel = (gcnew System::Windows::Forms::Label());
389  this->buttonBrowseFile = (gcnew System::Windows::Forms::Button());
390  this->cbFilePath = (gcnew System::Windows::Forms::ComboBox());
391  this->label1 = (gcnew System::Windows::Forms::Label());
392  this->textBoxTimeout = (gcnew System::Windows::Forms::TextBox());
393  this->labelTimeout = (gcnew System::Windows::Forms::Label());
394  this->textBoxVoltageThreshold = (gcnew System::Windows::Forms::TextBox());
395  this->labelVoltageThreshold = (gcnew System::Windows::Forms::Label());
396  this->textBoxPollingTime = (gcnew System::Windows::Forms::TextBox());
397  this->labelPollingTime = (gcnew System::Windows::Forms::Label());
398  this->checkBoxIgnition = (gcnew System::Windows::Forms::CheckBox());
399  this->checkBoxUseConnectionState = (gcnew System::Windows::Forms::CheckBox());
400  this->panel2 = (gcnew System::Windows::Forms::Panel());
401  this->buttonLicense = (gcnew System::Windows::Forms::Button());
402  this->buttonStartStopWebServer = (gcnew System::Windows::Forms::Button());
403  this->buttonHmi = (gcnew System::Windows::Forms::CheckBox());
404  this->checkBoxNewRuntimeManager = (gcnew System::Windows::Forms::CheckBox());
405  this->label15 = (gcnew System::Windows::Forms::Label());
406  this->label14 = (gcnew System::Windows::Forms::Label());
407  this->checkBoxCyclicReload = (gcnew System::Windows::Forms::CheckBox());
408  this->listBoxOuput = (gcnew System::Windows::Forms::ListBox());
409  this->labelOutputOverflow = (gcnew System::Windows::Forms::Label());
410  this->buttonCopyRow = (gcnew System::Windows::Forms::Button());
411  this->buttonClearOutput = (gcnew System::Windows::Forms::Button());
412  this->buttonNewInstanceNewThread = (gcnew System::Windows::Forms::Button());
413  this->buttonNewInstance = (gcnew System::Windows::Forms::Button());
414  this->checkBoxStartAllParents = (gcnew System::Windows::Forms::CheckBox());
415  this->checkBoxAdd2Output = (gcnew System::Windows::Forms::CheckBox());
416  this->checkBoxCyclicExecution = (gcnew System::Windows::Forms::CheckBox());
417  this->checkBoxAsyncExecution = (gcnew System::Windows::Forms::CheckBox());
418  this->buttonPause = (gcnew System::Windows::Forms::CheckBox());
419  this->buttonStop = (gcnew System::Windows::Forms::Button());
420  this->buttonExecuteMain = (gcnew System::Windows::Forms::Button());
421  this->buttonExecuteSelectedProcedure = (gcnew System::Windows::Forms::Button());
422  this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
423  this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());
424  this->treeViewOtxProject = (gcnew System::Windows::Forms::TreeView());
425  this->label3 = (gcnew System::Windows::Forms::Label());
426  this->splitContainer5 = (gcnew System::Windows::Forms::SplitContainer());
427  this->splitContainer2 = (gcnew System::Windows::Forms::SplitContainer());
428  this->gridViewParameter = (gcnew System::Windows::Forms::DataGridView());
429  this->dataGridViewTextBoxColumnName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
430  this->dataGridViewTextBoxColumnDirection = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
431  this->dataGridViewTextBoxColumnDataType = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
432  this->dataGridViewTextBoxColumnValue = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
433  this->dataGridViewTextBoxColumnDetails = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
434  this->labelAdjustProcedureParameters = (gcnew System::Windows::Forms::Label());
435  this->splitContainer3 = (gcnew System::Windows::Forms::SplitContainer());
436  this->gridViewContext = (gcnew System::Windows::Forms::DataGridView());
437  this->dataGridViewTextBoxColumnContextName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
438  this->dataGridViewTextBoxColumnContextDataType = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
439  this->dataGridViewTextBoxColumnContextValue = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
440  this->dataGridViewTextBoxColumnContextDetails = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
441  this->label4 = (gcnew System::Windows::Forms::Label());
442  this->gridViewState = (gcnew System::Windows::Forms::DataGridView());
443  this->dataGridViewTextBoxColumnStateName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
444  this->dataGridViewTextBoxColumnStateDataType = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
445  this->dataGridViewTextBoxColumnStateValue = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
446  this->dataGridViewTextBoxColumnStateDetails = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
447  this->label5 = (gcnew System::Windows::Forms::Label());
448  this->panel3 = (gcnew System::Windows::Forms::Panel());
449  this->gridViewSettings = (gcnew System::Windows::Forms::DataGridView());
450  this->dataGridViewTextBoxColumnSettingName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
451  this->dataGridViewTextBoxColumnSettingValue = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
452  this->panel4 = (gcnew System::Windows::Forms::Panel());
453  this->label12 = (gcnew System::Windows::Forms::Label());
454  this->buttonWriteSettings = (gcnew System::Windows::Forms::Button());
455  this->buttonReadSettings = (gcnew System::Windows::Forms::Button());
456  this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
457  this->radioButtonNoCustomImplementation = (gcnew System::Windows::Forms::RadioButton());
458  this->radioButtonDefaultImplementation = (gcnew System::Windows::Forms::RadioButton());
459  this->radioButtonOuputWindow = (gcnew System::Windows::Forms::RadioButton());
460  this->splitContainer4 = (gcnew System::Windows::Forms::SplitContainer());
461  this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog());
462  this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
463  this->labelSeparator2 = (gcnew System::Windows::Forms::Label());
464  this->labelProcedureExecutionState = (gcnew System::Windows::Forms::Label());
465  this->tableLayoutPanelExecutionState = (gcnew System::Windows::Forms::TableLayoutPanel());
466  this->labelIconProcedureExecutionState = (gcnew System::Windows::Forms::Label());
467  this->labelBatteryState = (gcnew System::Windows::Forms::Label());
468  this->labelExpectedState = (gcnew System::Windows::Forms::Label());
469  this->labelSeparator3 = (gcnew System::Windows::Forms::Label());
470  this->labelSeparator4 = (gcnew System::Windows::Forms::Label());
471  this->labelSeparator1 = (gcnew System::Windows::Forms::Label());
472  this->buttonCheckBatteryIgnition = (gcnew System::Windows::Forms::Button());
473  this->labelIgnitionState = (gcnew System::Windows::Forms::Label());
474  this->labelSeparator5 = (gcnew System::Windows::Forms::Label());
475  this->labelProcedureExecutionTimes = (gcnew System::Windows::Forms::Label());
476  this->label18 = (gcnew System::Windows::Forms::Label());
477  this->updateGuiTimer = (gcnew System::Windows::Forms::Timer(this->components));
478  this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
479  this->panel1->SuspendLayout();
480  this->panel2->SuspendLayout();
481  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer1))->BeginInit();
482  this->splitContainer1->Panel1->SuspendLayout();
483  this->splitContainer1->Panel2->SuspendLayout();
484  this->splitContainer1->SuspendLayout();
485  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer5))->BeginInit();
486  this->splitContainer5->Panel1->SuspendLayout();
487  this->splitContainer5->Panel2->SuspendLayout();
488  this->splitContainer5->SuspendLayout();
489  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer2))->BeginInit();
490  this->splitContainer2->Panel1->SuspendLayout();
491  this->splitContainer2->Panel2->SuspendLayout();
492  this->splitContainer2->SuspendLayout();
493  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewParameter))->BeginInit();
494  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer3))->BeginInit();
495  this->splitContainer3->Panel1->SuspendLayout();
496  this->splitContainer3->Panel2->SuspendLayout();
497  this->splitContainer3->SuspendLayout();
498  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewContext))->BeginInit();
499  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewState))->BeginInit();
500  this->panel3->SuspendLayout();
501  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewSettings))->BeginInit();
502  this->panel4->SuspendLayout();
503  this->groupBox1->SuspendLayout();
504  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer4))->BeginInit();
505  this->splitContainer4->Panel1->SuspendLayout();
506  this->splitContainer4->Panel2->SuspendLayout();
507  this->splitContainer4->SuspendLayout();
508  this->tableLayoutPanelExecutionState->SuspendLayout();
509  this->SuspendLayout();
510  //
511  // panel1
512  //
513  this->panel1->Controls->Add(this->textBoxProfilingSize);
514  this->panel1->Controls->Add(this->checkBoxProfiling);
515  this->panel1->Controls->Add(this->buttonBrowseDiagLoggingTraceFolder);
516  this->panel1->Controls->Add(this->buttonOpenDiagLoggingTraceFolder);
517  this->panel1->Controls->Add(this->textBoxDiagManagerTraceFolder);
518  this->panel1->Controls->Add(this->label19);
519  this->panel1->Controls->Add(this->comboBoxDiagLoggingTraceLevel);
520  this->panel1->Controls->Add(this->label17);
521  this->panel1->Controls->Add(this->checkBoxIncludedDiagLogging);
522  this->panel1->Controls->Add(this->comboBoxDiagManagerTraceLevel);
523  this->panel1->Controls->Add(this->label16);
524  this->panel1->Controls->Add(this->textBoxDiagManagerLicenseKey);
525  this->panel1->Controls->Add(this->label7);
526  this->panel1->Controls->Add(this->comboBoxDiagIpcType);
527  this->panel1->Controls->Add(this->labelDiagType);
528  this->panel1->Controls->Add(this->labelOdxProject);
529  this->panel1->Controls->Add(this->labelODXVehicle);
530  this->panel1->Controls->Add(this->comboBoxODXVehicle);
531  this->panel1->Controls->Add(this->comboBoxODXProject);
532  this->panel1->Controls->Add(this->label2);
533  this->panel1->Controls->Add(this->textBoxTraceFileMaxSize);
534  this->panel1->Controls->Add(this->textBoxTraceFileMaxCount);
535  this->panel1->Controls->Add(this->buttonOpenTraceFolder);
536  this->panel1->Controls->Add(this->textBoxRuntimeContextName);
537  this->panel1->Controls->Add(this->runtimeNameLabel);
538  this->panel1->Controls->Add(this->textBoxDiagPortPipe);
539  this->panel1->Controls->Add(this->textBoxRtPortPipe);
540  this->panel1->Controls->Add(this->label13);
541  this->panel1->Controls->Add(this->portPipeLabel);
542  this->panel1->Controls->Add(this->comboBoxIpcType);
543  this->panel1->Controls->Add(this->label11);
544  this->panel1->Controls->Add(this->label10);
545  this->panel1->Controls->Add(this->buttonBrowseTraceFolder);
546  this->panel1->Controls->Add(this->textBoxTraceFolder);
547  this->panel1->Controls->Add(this->label9);
548  this->panel1->Controls->Add(this->comboBoxTraceLevel);
549  this->panel1->Controls->Add(this->label8);
550  this->panel1->Controls->Add(this->label6);
551  this->panel1->Controls->Add(this->buttonReload);
552  this->panel1->Controls->Add(this->txtPassword);
553  this->panel1->Controls->Add(this->passwordLabel);
554  this->panel1->Controls->Add(this->buttonBrowseFile);
555  this->panel1->Controls->Add(this->cbFilePath);
556  this->panel1->Controls->Add(this->label1);
557  this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
558  this->panel1->Location = System::Drawing::Point(0, 0);
559  this->panel1->Name = L"panel1";
560  this->panel1->Padding = System::Windows::Forms::Padding(0, 0, 0, 6);
561  this->panel1->Size = System::Drawing::Size(1328, 115);
562  this->panel1->TabIndex = 0;
563  //
564  // textBoxProfilingSize
565  //
566  this->textBoxProfilingSize->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
567  this->textBoxProfilingSize->Location = System::Drawing::Point(391, 30);
568  this->textBoxProfilingSize->Name = L"textBoxProfilingSize";
569  this->textBoxProfilingSize->Size = System::Drawing::Size(32, 22);
570  this->textBoxProfilingSize->TabIndex = 47;
571  this->textBoxProfilingSize->Text = L"100";
572  this->textBoxProfilingSize->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
573  this->textBoxProfilingSize->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxProfilingSize_TextChanged);
574  //
575  // checkBoxProfiling
576  //
577  this->checkBoxProfiling->AutoSize = true;
578  this->checkBoxProfiling->Location = System::Drawing::Point(296, 32);
579  this->checkBoxProfiling->Name = L"checkBoxProfiling";
580  this->checkBoxProfiling->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
581  this->checkBoxProfiling->Size = System::Drawing::Size(89, 17);
582  this->checkBoxProfiling->TabIndex = 46;
583  this->checkBoxProfiling->Tag = L"";
584  this->checkBoxProfiling->Text = L"Profiling, Size";
585  this->checkBoxProfiling->UseVisualStyleBackColor = true;
586  this->checkBoxProfiling->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxProfiling_CheckedChanged);
587  //
588  // buttonBrowseDiagLoggingTraceFolder
589  //
590  this->buttonBrowseDiagLoggingTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
591  this->buttonBrowseDiagLoggingTraceFolder->Location = System::Drawing::Point(1298, 86);
592  this->buttonBrowseDiagLoggingTraceFolder->Name = L"buttonBrowseDiagLoggingTraceFolder";
593  this->buttonBrowseDiagLoggingTraceFolder->Size = System::Drawing::Size(30, 23);
594  this->buttonBrowseDiagLoggingTraceFolder->TabIndex = 45;
595  this->buttonBrowseDiagLoggingTraceFolder->Text = L"...";
596  this->buttonBrowseDiagLoggingTraceFolder->UseVisualStyleBackColor = true;
597  this->buttonBrowseDiagLoggingTraceFolder->Click += gcnew System::EventHandler(this, &SampleForm::buttonBrowseDiagLoggingTraceFolder_Click);
598  //
599  // buttonOpenDiagLoggingTraceFolder
600  //
601  this->buttonOpenDiagLoggingTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
602  this->buttonOpenDiagLoggingTraceFolder->Location = System::Drawing::Point(1210, 86);
603  this->buttonOpenDiagLoggingTraceFolder->Name = L"buttonOpenDiagLoggingTraceFolder";
604  this->buttonOpenDiagLoggingTraceFolder->Size = System::Drawing::Size(82, 23);
605  this->buttonOpenDiagLoggingTraceFolder->TabIndex = 44;
606  this->buttonOpenDiagLoggingTraceFolder->Text = L"Open Folder";
607  this->buttonOpenDiagLoggingTraceFolder->UseVisualStyleBackColor = true;
608  this->buttonOpenDiagLoggingTraceFolder->Click += gcnew System::EventHandler(this, &SampleForm::buttonOpenDiagLoggingTraceFolder_Click);
609  //
610  // textBoxDiagManagerTraceFolder
611  //
612  this->textBoxDiagManagerTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
613  this->textBoxDiagManagerTraceFolder->Location = System::Drawing::Point(1095, 88);
614  this->textBoxDiagManagerTraceFolder->Name = L"textBoxDiagManagerTraceFolder";
615  this->textBoxDiagManagerTraceFolder->Size = System::Drawing::Size(109, 20);
616  this->textBoxDiagManagerTraceFolder->TabIndex = 43;
617  this->textBoxDiagManagerTraceFolder->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxDiagManagerTraceFolder_TextChanged);
618  //
619  // label19
620  //
621  this->label19->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
622  this->label19->AutoSize = true;
623  this->label19->Location = System::Drawing::Point(1073, 91);
624  this->label19->Name = L"label19";
625  this->label19->Size = System::Drawing::Size(15, 13);
626  this->label19->TabIndex = 42;
627  this->label19->Text = L"in";
628  //
629  // comboBoxDiagLoggingTraceLevel
630  //
631  this->comboBoxDiagLoggingTraceLevel->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
632  this->comboBoxDiagLoggingTraceLevel->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
633  this->comboBoxDiagLoggingTraceLevel->Enabled = false;
634  this->comboBoxDiagLoggingTraceLevel->FormattingEnabled = true;
635  this->comboBoxDiagLoggingTraceLevel->Location = System::Drawing::Point(943, 88);
636  this->comboBoxDiagLoggingTraceLevel->Name = L"comboBoxDiagLoggingTraceLevel";
637  this->comboBoxDiagLoggingTraceLevel->Size = System::Drawing::Size(124, 21);
638  this->comboBoxDiagLoggingTraceLevel->TabIndex = 41;
639  this->comboBoxDiagLoggingTraceLevel->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxDiagLoggingTraceLevel_SelectedValueChanged);
640  //
641  // label17
642  //
643  this->label17->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
644  this->label17->AutoSize = true;
645  this->label17->Location = System::Drawing::Point(893, 91);
646  this->label17->Name = L"label17";
647  this->label17->Size = System::Drawing::Size(44, 13);
648  this->label17->TabIndex = 40;
649  this->label17->Text = L"at level:";
650  //
651  // checkBoxIncludedDiagLogging
652  //
653  this->checkBoxIncludedDiagLogging->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
654  this->checkBoxIncludedDiagLogging->AutoSize = true;
655  this->checkBoxIncludedDiagLogging->Location = System::Drawing::Point(760, 90);
656  this->checkBoxIncludedDiagLogging->Name = L"checkBoxIncludedDiagLogging";
657  this->checkBoxIncludedDiagLogging->Size = System::Drawing::Size(129, 17);
658  this->checkBoxIncludedDiagLogging->TabIndex = 39;
659  this->checkBoxIncludedDiagLogging->Text = L"included DiagLogging";
660  this->checkBoxIncludedDiagLogging->UseVisualStyleBackColor = true;
661  this->checkBoxIncludedDiagLogging->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxIncludedDiagLogging_CheckedChanged);
662  //
663  // comboBoxDiagManagerTraceLevel
664  //
665  this->comboBoxDiagManagerTraceLevel->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
666  this->comboBoxDiagManagerTraceLevel->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
667  this->comboBoxDiagManagerTraceLevel->FormattingEnabled = true;
668  this->comboBoxDiagManagerTraceLevel->Location = System::Drawing::Point(660, 88);
669  this->comboBoxDiagManagerTraceLevel->Name = L"comboBoxDiagManagerTraceLevel";
670  this->comboBoxDiagManagerTraceLevel->Size = System::Drawing::Size(94, 21);
671  this->comboBoxDiagManagerTraceLevel->TabIndex = 38;
672  this->comboBoxDiagManagerTraceLevel->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxDiagManagerTraceLevel_SelectedValueChanged);
673  //
674  // label16
675  //
676  this->label16->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
677  this->label16->AutoSize = true;
678  this->label16->Location = System::Drawing::Point(598, 91);
679  this->label16->Name = L"label16";
680  this->label16->Size = System::Drawing::Size(59, 13);
681  this->label16->TabIndex = 37;
682  this->label16->Text = L"trace level:";
683  //
684  // textBoxDiagManagerLicenseKey
685  //
686  this->textBoxDiagManagerLicenseKey->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
687  | System::Windows::Forms::AnchorStyles::Right));
688  this->textBoxDiagManagerLicenseKey->Location = System::Drawing::Point(128, 88);
689  this->textBoxDiagManagerLicenseKey->Name = L"textBoxDiagManagerLicenseKey";
690  this->textBoxDiagManagerLicenseKey->PasswordChar = '*';
691  this->textBoxDiagManagerLicenseKey->Size = System::Drawing::Size(456, 20);
692  this->textBoxDiagManagerLicenseKey->TabIndex = 36;
693  this->textBoxDiagManagerLicenseKey->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxDiagManagerLicenseKey_TextChanged);
694  this->textBoxDiagManagerLicenseKey->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &SampleForm::textBoxDiagManagerLicenseKey_KeyDown);
695  //
696  // label7
697  //
698  this->label7->AutoSize = true;
699  this->label7->Location = System::Drawing::Point(-3, 91);
700  this->label7->Name = L"label7";
701  this->label7->Size = System::Drawing::Size(130, 13);
702  this->label7->TabIndex = 35;
703  this->label7->Text = L"DiagManager license key:";
704  //
705  // comboBoxDiagIpcType
706  //
707  this->comboBoxDiagIpcType->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
708  this->comboBoxDiagIpcType->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
709  this->comboBoxDiagIpcType->FormattingEnabled = true;
710  this->comboBoxDiagIpcType->Location = System::Drawing::Point(943, 61);
711  this->comboBoxDiagIpcType->Name = L"comboBoxDiagIpcType";
712  this->comboBoxDiagIpcType->Size = System::Drawing::Size(93, 21);
713  this->comboBoxDiagIpcType->TabIndex = 34;
714  this->comboBoxDiagIpcType->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxDiagIpcType_SelectedValueChanged);
715  //
716  // labelDiagType
717  //
718  this->labelDiagType->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
719  this->labelDiagType->AutoSize = true;
720  this->labelDiagType->Location = System::Drawing::Point(878, 65);
721  this->labelDiagType->Name = L"labelDiagType";
722  this->labelDiagType->Size = System::Drawing::Size(59, 13);
723  this->labelDiagType->TabIndex = 33;
724  this->labelDiagType->Text = L"Diag Type:";
725  //
726  // labelOdxProject
727  //
728  this->labelOdxProject->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
729  this->labelOdxProject->AutoSize = true;
730  this->labelOdxProject->Location = System::Drawing::Point(1046, 35);
731  this->labelOdxProject->Name = L"labelOdxProject";
732  this->labelOdxProject->Size = System::Drawing::Size(43, 13);
733  this->labelOdxProject->TabIndex = 32;
734  this->labelOdxProject->Text = L"Project:";
735  //
736  // labelODXVehicle
737  //
738  this->labelODXVehicle->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
739  this->labelODXVehicle->AutoSize = true;
740  this->labelODXVehicle->Location = System::Drawing::Point(1044, 65);
741  this->labelODXVehicle->Name = L"labelODXVehicle";
742  this->labelODXVehicle->Size = System::Drawing::Size(45, 13);
743  this->labelODXVehicle->TabIndex = 31;
744  this->labelODXVehicle->Text = L"Vehicle:";
745  //
746  // comboBoxODXVehicle
747  //
748  this->comboBoxODXVehicle->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
749  this->comboBoxODXVehicle->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
750  this->comboBoxODXVehicle->DropDownWidth = 120;
751  this->comboBoxODXVehicle->FormattingEnabled = true;
752  this->comboBoxODXVehicle->Location = System::Drawing::Point(1095, 61);
753  this->comboBoxODXVehicle->Name = L"comboBoxODXVehicle";
754  this->comboBoxODXVehicle->Size = System::Drawing::Size(233, 21);
755  this->comboBoxODXVehicle->TabIndex = 3;
756  this->comboBoxODXVehicle->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxODXVehicle_SelectedValueChanged);
757  //
758  // comboBoxODXProject
759  //
760  this->comboBoxODXProject->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
761  this->comboBoxODXProject->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
762  this->comboBoxODXProject->DropDownWidth = 200;
763  this->comboBoxODXProject->FormattingEnabled = true;
764  this->comboBoxODXProject->Location = System::Drawing::Point(1095, 31);
765  this->comboBoxODXProject->Name = L"comboBoxODXProject";
766  this->comboBoxODXProject->Size = System::Drawing::Size(233, 21);
767  this->comboBoxODXProject->TabIndex = 4;
768  this->comboBoxODXProject->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxODXProject_SelectedValueChanged);
769  //
770  // label2
771  //
772  this->label2->AutoSize = true;
773  this->label2->Location = System::Drawing::Point(165, 34);
774  this->label2->Name = L"label2";
775  this->label2->Size = System::Drawing::Size(54, 13);
776  this->label2->TabIndex = 30;
777  this->label2->Text = L"Files, Size";
778  //
779  // textBoxTraceFileMaxSize
780  //
781  this->textBoxTraceFileMaxSize->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
782  this->textBoxTraceFileMaxSize->Location = System::Drawing::Point(256, 30);
783  this->textBoxTraceFileMaxSize->Name = L"textBoxTraceFileMaxSize";
784  this->textBoxTraceFileMaxSize->Size = System::Drawing::Size(32, 22);
785  this->textBoxTraceFileMaxSize->TabIndex = 29;
786  this->textBoxTraceFileMaxSize->Text = L"100";
787  this->textBoxTraceFileMaxSize->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
788  this->textBoxTraceFileMaxSize->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxTraceFileMaxSize_TextChanged);
789  //
790  // textBoxTraceFileMaxCount
791  //
792  this->textBoxTraceFileMaxCount->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
793  this->textBoxTraceFileMaxCount->Location = System::Drawing::Point(225, 30);
794  this->textBoxTraceFileMaxCount->Name = L"textBoxTraceFileMaxCount";
795  this->textBoxTraceFileMaxCount->Size = System::Drawing::Size(25, 22);
796  this->textBoxTraceFileMaxCount->TabIndex = 28;
797  this->textBoxTraceFileMaxCount->Text = L"10";
798  this->textBoxTraceFileMaxCount->TextAlign = System::Windows::Forms::HorizontalAlignment::Right;
799  this->textBoxTraceFileMaxCount->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxTraceFileMaxCount_TextChanged);
800  //
801  // buttonOpenTraceFolder
802  //
803  this->buttonOpenTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
804  this->buttonOpenTraceFolder->Location = System::Drawing::Point(833, 30);
805  this->buttonOpenTraceFolder->Name = L"buttonOpenTraceFolder";
806  this->buttonOpenTraceFolder->Size = System::Drawing::Size(49, 23);
807  this->buttonOpenTraceFolder->TabIndex = 15;
808  this->buttonOpenTraceFolder->Text = L"Open...";
809  this->buttonOpenTraceFolder->UseVisualStyleBackColor = true;
810  this->buttonOpenTraceFolder->Click += gcnew System::EventHandler(this, &SampleForm::buttonOpenTraceFolder_Click);
811  //
812  // textBoxRuntimeContextName
813  //
814  this->textBoxRuntimeContextName->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
815  this->textBoxRuntimeContextName->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
816  this->textBoxRuntimeContextName->Location = System::Drawing::Point(1124, 2);
817  this->textBoxRuntimeContextName->Name = L"textBoxRuntimeContextName";
818  this->textBoxRuntimeContextName->Size = System::Drawing::Size(123, 22);
819  this->textBoxRuntimeContextName->TabIndex = 8;
820  this->textBoxRuntimeContextName->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxRuntimeContextName_TextChanged);
821  //
822  // runtimeNameLabel
823  //
824  this->runtimeNameLabel->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
825  this->runtimeNameLabel->AutoSize = true;
826  this->runtimeNameLabel->Location = System::Drawing::Point(1044, 5);
827  this->runtimeNameLabel->Name = L"runtimeNameLabel";
828  this->runtimeNameLabel->Size = System::Drawing::Size(75, 13);
829  this->runtimeNameLabel->TabIndex = 7;
830  this->runtimeNameLabel->Text = L"Runtime name";
831  //
832  // textBoxDiagPortPipe
833  //
834  this->textBoxDiagPortPipe->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
835  this->textBoxDiagPortPipe->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
836  static_cast<System::Byte>(0)));
837  this->textBoxDiagPortPipe->Location = System::Drawing::Point(1273, 31);
838  this->textBoxDiagPortPipe->Name = L"textBoxDiagPortPipe";
839  this->textBoxDiagPortPipe->Size = System::Drawing::Size(55, 22);
840  this->textBoxDiagPortPipe->TabIndex = 22;
841  this->textBoxDiagPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
842  //
843  // textBoxRtPortPipe
844  //
845  this->textBoxRtPortPipe->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
846  this->textBoxRtPortPipe->BackColor = System::Drawing::SystemColors::Window;
847  this->textBoxRtPortPipe->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
848  static_cast<System::Byte>(0)));
849  this->textBoxRtPortPipe->Location = System::Drawing::Point(1192, 31);
850  this->textBoxRtPortPipe->Name = L"textBoxRtPortPipe";
851  this->textBoxRtPortPipe->Size = System::Drawing::Size(55, 22);
852  this->textBoxRtPortPipe->TabIndex = 20;
853  this->textBoxRtPortPipe->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPortPipe_TextChanged);
854  //
855  // label13
856  //
857  this->label13->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
858  this->label13->AutoSize = true;
859  this->label13->Location = System::Drawing::Point(1254, 34);
860  this->label13->Name = L"label13";
861  this->label13->Size = System::Drawing::Size(12, 13);
862  this->label13->TabIndex = 21;
863  this->label13->Text = L"/";
864  //
865  // portPipeLabel
866  //
867  this->portPipeLabel->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
868  this->portPipeLabel->AutoSize = true;
869  this->portPipeLabel->Location = System::Drawing::Point(1044, 34);
870  this->portPipeLabel->Name = L"portPipeLabel";
871  this->portPipeLabel->Size = System::Drawing::Size(144, 13);
872  this->portPipeLabel->TabIndex = 19;
873  this->portPipeLabel->Text = L"Runner / DiagManager Ports";
874  //
875  // comboBoxIpcType
876  //
877  this->comboBoxIpcType->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
878  this->comboBoxIpcType->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
879  this->comboBoxIpcType->DropDownWidth = 170;
880  this->comboBoxIpcType->FormattingEnabled = true;
881  this->comboBoxIpcType->Location = System::Drawing::Point(943, 31);
882  this->comboBoxIpcType->Name = L"comboBoxIpcType";
883  this->comboBoxIpcType->Size = System::Drawing::Size(93, 21);
884  this->comboBoxIpcType->TabIndex = 18;
885  this->comboBoxIpcType->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxIpcType_SelectedValueChanged);
886  //
887  // label11
888  //
889  this->label11->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
890  this->label11->AutoSize = true;
891  this->label11->Location = System::Drawing::Point(895, 34);
892  this->label11->Name = L"label11";
893  this->label11->Size = System::Drawing::Size(24, 13);
894  this->label11->TabIndex = 17;
895  this->label11->Text = L"IPC";
896  //
897  // label10
898  //
899  this->label10->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
900  this->label10->BackColor = System::Drawing::SystemColors::ControlDark;
901  this->label10->Location = System::Drawing::Point(888, 35);
902  this->label10->Name = L"label10";
903  this->label10->Size = System::Drawing::Size(1, 14);
904  this->label10->TabIndex = 16;
905  //
906  // buttonBrowseTraceFolder
907  //
908  this->buttonBrowseTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
909  this->buttonBrowseTraceFolder->Location = System::Drawing::Point(798, 30);
910  this->buttonBrowseTraceFolder->Name = L"buttonBrowseTraceFolder";
911  this->buttonBrowseTraceFolder->Size = System::Drawing::Size(29, 23);
912  this->buttonBrowseTraceFolder->TabIndex = 14;
913  this->buttonBrowseTraceFolder->Text = L"...";
914  this->buttonBrowseTraceFolder->UseVisualStyleBackColor = true;
915  this->buttonBrowseTraceFolder->Click += gcnew System::EventHandler(this, &SampleForm::buttonBrowseTraceFolder_Click);
916  //
917  // textBoxTraceFolder
918  //
919  this->textBoxTraceFolder->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
920  | System::Windows::Forms::AnchorStyles::Right));
921  this->textBoxTraceFolder->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
922  static_cast<System::Byte>(0)));
923  this->textBoxTraceFolder->Location = System::Drawing::Point(450, 30);
924  this->textBoxTraceFolder->Name = L"textBoxTraceFolder";
925  this->textBoxTraceFolder->Size = System::Drawing::Size(342, 22);
926  this->textBoxTraceFolder->TabIndex = 13;
927  this->textBoxTraceFolder->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxTraceFolder_TextChanged);
928  //
929  // label9
930  //
931  this->label9->AutoSize = true;
932  this->label9->Location = System::Drawing::Point(429, 33);
933  this->label9->Name = L"label9";
934  this->label9->Size = System::Drawing::Size(15, 13);
935  this->label9->TabIndex = 12;
936  this->label9->Text = L"in";
937  //
938  // comboBoxTraceLevel
939  //
940  this->comboBoxTraceLevel->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
941  this->comboBoxTraceLevel->FormattingEnabled = true;
942  this->comboBoxTraceLevel->Location = System::Drawing::Point(90, 31);
943  this->comboBoxTraceLevel->Name = L"comboBoxTraceLevel";
944  this->comboBoxTraceLevel->Size = System::Drawing::Size(69, 21);
945  this->comboBoxTraceLevel->TabIndex = 11;
946  this->comboBoxTraceLevel->SelectedIndexChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxTraceLevel_SelectedIndexChanged);
947  this->comboBoxTraceLevel->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::comboBoxTraceLevel_SelectedValueChanged);
948  //
949  // label8
950  //
951  this->label8->AutoSize = true;
952  this->label8->Location = System::Drawing::Point(-3, 34);
953  this->label8->Name = L"label8";
954  this->label8->Size = System::Drawing::Size(83, 13);
955  this->label8->TabIndex = 10;
956  this->label8->Text = L"TraceFile: Level";
957  //
958  // label6
959  //
960  this->label6->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
961  | System::Windows::Forms::AnchorStyles::Right));
962  this->label6->BackColor = System::Drawing::SystemColors::ControlDark;
963  this->label6->Location = System::Drawing::Point(-3, 27);
964  this->label6->Name = L"label6";
965  this->label6->Size = System::Drawing::Size(1332, 1);
966  this->label6->TabIndex = 9;
967  //
968  // buttonReload
969  //
970  this->buttonReload->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
971  this->buttonReload->Enabled = false;
972  this->buttonReload->Location = System::Drawing::Point(833, 1);
973  this->buttonReload->Name = L"buttonReload";
974  this->buttonReload->Size = System::Drawing::Size(49, 23);
975  this->buttonReload->TabIndex = 3;
976  this->buttonReload->Text = L"Reload";
977  this->buttonReload->UseVisualStyleBackColor = true;
978  this->buttonReload->Click += gcnew System::EventHandler(this, &SampleForm::buttonReload_Click);
979  //
980  // txtPassword
981  //
982  this->txtPassword->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
983  this->txtPassword->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
984  static_cast<System::Byte>(0)));
985  this->txtPassword->Location = System::Drawing::Point(943, 2);
986  this->txtPassword->Name = L"txtPassword";
987  this->txtPassword->PasswordChar = '*';
988  this->txtPassword->Size = System::Drawing::Size(93, 22);
989  this->txtPassword->TabIndex = 5;
990  this->txtPassword->TextChanged += gcnew System::EventHandler(this, &SampleForm::txtPassword_TextChanged);
991  //
992  // passwordLabel
993  //
994  this->passwordLabel->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
995  this->passwordLabel->AutoSize = true;
996  this->passwordLabel->Location = System::Drawing::Point(884, 6);
997  this->passwordLabel->Name = L"passwordLabel";
998  this->passwordLabel->Size = System::Drawing::Size(53, 13);
999  this->passwordLabel->TabIndex = 4;
1000  this->passwordLabel->Text = L"Password";
1001  //
1002  // buttonBrowseFile
1003  //
1004  this->buttonBrowseFile->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1005  this->buttonBrowseFile->Location = System::Drawing::Point(798, 1);
1006  this->buttonBrowseFile->Name = L"buttonBrowseFile";
1007  this->buttonBrowseFile->Size = System::Drawing::Size(29, 23);
1008  this->buttonBrowseFile->TabIndex = 2;
1009  this->buttonBrowseFile->Text = L"...";
1010  this->buttonBrowseFile->UseVisualStyleBackColor = true;
1011  this->buttonBrowseFile->Click += gcnew System::EventHandler(this, &SampleForm::buttonBrowseFile_Click);
1012  //
1013  // cbFilePath
1014  //
1015  this->cbFilePath->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
1016  | System::Windows::Forms::AnchorStyles::Right));
1017  this->cbFilePath->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
1018  static_cast<System::Byte>(0)));
1019  this->cbFilePath->Location = System::Drawing::Point(90, 1);
1020  this->cbFilePath->Name = L"cbFilePath";
1021  this->cbFilePath->Size = System::Drawing::Size(702, 22);
1022  this->cbFilePath->TabIndex = 1;
1023  this->cbFilePath->SelectedValueChanged += gcnew System::EventHandler(this, &SampleForm::cbFilePath_SelectedValueChanged);
1024  this->cbFilePath->TextChanged += gcnew System::EventHandler(this, &SampleForm::cbFilePath_TextChanged);
1025  //
1026  // label1
1027  //
1028  this->label1->AutoSize = true;
1029  this->label1->Location = System::Drawing::Point(-3, 6);
1030  this->label1->Name = L"label1";
1031  this->label1->Size = System::Drawing::Size(87, 13);
1032  this->label1->TabIndex = 0;
1033  this->label1->Text = L"Select PTX/PPX";
1034  //
1035  // textBoxTimeout
1036  //
1037  this->textBoxTimeout->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
1038  this->textBoxTimeout->Location = System::Drawing::Point(642, 3);
1039  this->textBoxTimeout->Name = L"textBoxTimeout";
1040  this->textBoxTimeout->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
1041  this->textBoxTimeout->Size = System::Drawing::Size(45, 22);
1042  this->textBoxTimeout->TabIndex = 4;
1043  this->textBoxTimeout->Text = L"0";
1044  this->textBoxTimeout->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxTimeout_TextChanged);
1045  //
1046  // labelTimeout
1047  //
1048  this->labelTimeout->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1049  this->labelTimeout->AutoSize = true;
1050  this->labelTimeout->Location = System::Drawing::Point(591, 0);
1051  this->labelTimeout->Name = L"labelTimeout";
1052  this->labelTimeout->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
1053  this->labelTimeout->Size = System::Drawing::Size(45, 20);
1054  this->labelTimeout->TabIndex = 3;
1055  this->labelTimeout->Text = L"Timeout";
1056  //
1057  // textBoxVoltageThreshold
1058  //
1059  this->textBoxVoltageThreshold->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
1060  static_cast<System::Byte>(0)));
1061  this->textBoxVoltageThreshold->Location = System::Drawing::Point(1301, 3);
1062  this->textBoxVoltageThreshold->Name = L"textBoxVoltageThreshold";
1063  this->textBoxVoltageThreshold->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
1064  this->textBoxVoltageThreshold->Size = System::Drawing::Size(45, 22);
1065  this->textBoxVoltageThreshold->TabIndex = 16;
1066  this->textBoxVoltageThreshold->Text = L"6000";
1067  this->textBoxVoltageThreshold->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxBatteryVoltageThreshold_TextChanged);
1068  //
1069  // labelVoltageThreshold
1070  //
1071  this->labelVoltageThreshold->AutoSize = true;
1072  this->labelVoltageThreshold->Location = System::Drawing::Point(1205, 0);
1073  this->labelVoltageThreshold->Name = L"labelVoltageThreshold";
1074  this->labelVoltageThreshold->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
1075  this->labelVoltageThreshold->Size = System::Drawing::Size(90, 20);
1076  this->labelVoltageThreshold->TabIndex = 15;
1077  this->labelVoltageThreshold->Text = L"VoltageThreshold";
1078  //
1079  // textBoxPollingTime
1080  //
1081  this->textBoxPollingTime->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
1082  static_cast<System::Byte>(0)));
1083  this->textBoxPollingTime->Location = System::Drawing::Point(1159, 3);
1084  this->textBoxPollingTime->Name = L"textBoxPollingTime";
1085  this->textBoxPollingTime->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
1086  this->textBoxPollingTime->Size = System::Drawing::Size(40, 22);
1087  this->textBoxPollingTime->TabIndex = 14;
1088  this->textBoxPollingTime->Text = L"500";
1089  this->textBoxPollingTime->TextChanged += gcnew System::EventHandler(this, &SampleForm::textBoxPollingTime_TextChanged);
1090  //
1091  // labelPollingTime
1092  //
1093  this->labelPollingTime->AutoSize = true;
1094  this->labelPollingTime->Location = System::Drawing::Point(1092, 0);
1095  this->labelPollingTime->Name = L"labelPollingTime";
1096  this->labelPollingTime->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
1097  this->labelPollingTime->Size = System::Drawing::Size(61, 20);
1098  this->labelPollingTime->TabIndex = 13;
1099  this->labelPollingTime->Text = L"PollingTime";
1100  //
1101  // checkBoxIgnition
1102  //
1103  this->checkBoxIgnition->AutoSize = true;
1104  this->checkBoxIgnition->Checked = true;
1105  this->checkBoxIgnition->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1106  this->checkBoxIgnition->Location = System::Drawing::Point(978, 3);
1107  this->checkBoxIgnition->Name = L"checkBoxIgnition";
1108  this->checkBoxIgnition->Padding = System::Windows::Forms::Padding(0, 3, 0, 0);
1109  this->checkBoxIgnition->Size = System::Drawing::Size(45, 20);
1110  this->checkBoxIgnition->TabIndex = 10;
1111  this->checkBoxIgnition->Text = L"IGN";
1112  this->checkBoxIgnition->TextImageRelation = System::Windows::Forms::TextImageRelation::TextBeforeImage;
1113  this->checkBoxIgnition->ThreeState = true;
1114  this->checkBoxIgnition->UseVisualStyleBackColor = true;
1115  this->checkBoxIgnition->CheckStateChanged += gcnew System::EventHandler(this, &SampleForm::CheckBoxKL15_CheckStateChanged);
1116  //
1117  // checkBoxUseConnectionState
1118  //
1119  this->checkBoxUseConnectionState->AutoSize = true;
1120  this->checkBoxUseConnectionState->CheckAlign = System::Drawing::ContentAlignment::MiddleRight;
1121  this->checkBoxUseConnectionState->Location = System::Drawing::Point(700, 3);
1122  this->checkBoxUseConnectionState->Name = L"checkBoxUseConnectionState";
1123  this->checkBoxUseConnectionState->Padding = System::Windows::Forms::Padding(0, 3, 0, 0);
1124  this->checkBoxUseConnectionState->Size = System::Drawing::Size(139, 20);
1125  this->checkBoxUseConnectionState->TabIndex = 6;
1126  this->checkBoxUseConnectionState->Text = L"Check ConnectionState";
1127  this->checkBoxUseConnectionState->UseVisualStyleBackColor = true;
1128  this->checkBoxUseConnectionState->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxUseConnectionState_CheckedChanged);
1129  //
1130  // panel2
1131  //
1132  this->panel2->Controls->Add(this->buttonLicense);
1133  this->panel2->Controls->Add(this->buttonStartStopWebServer);
1134  this->panel2->Controls->Add(this->buttonHmi);
1135  this->panel2->Controls->Add(this->checkBoxNewRuntimeManager);
1136  this->panel2->Controls->Add(this->label15);
1137  this->panel2->Controls->Add(this->label14);
1138  this->panel2->Controls->Add(this->checkBoxCyclicReload);
1139  this->panel2->Controls->Add(this->listBoxOuput);
1140  this->panel2->Controls->Add(this->labelOutputOverflow);
1141  this->panel2->Controls->Add(this->buttonCopyRow);
1142  this->panel2->Controls->Add(this->buttonClearOutput);
1143  this->panel2->Controls->Add(this->buttonNewInstanceNewThread);
1144  this->panel2->Controls->Add(this->buttonNewInstance);
1145  this->panel2->Controls->Add(this->checkBoxStartAllParents);
1146  this->panel2->Controls->Add(this->checkBoxAdd2Output);
1147  this->panel2->Controls->Add(this->checkBoxCyclicExecution);
1148  this->panel2->Controls->Add(this->checkBoxAsyncExecution);
1149  this->panel2->Controls->Add(this->buttonPause);
1150  this->panel2->Controls->Add(this->buttonStop);
1151  this->panel2->Controls->Add(this->buttonExecuteMain);
1152  this->panel2->Controls->Add(this->buttonExecuteSelectedProcedure);
1153  this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
1154  this->panel2->Location = System::Drawing::Point(0, 0);
1155  this->panel2->Name = L"panel2";
1156  this->panel2->Size = System::Drawing::Size(1328, 305);
1157  this->panel2->TabIndex = 0;
1158  //
1159  // buttonLicense
1160  //
1161  this->buttonLicense->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1162  this->buttonLicense->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonLicense.Image")));
1163  this->buttonLicense->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1164  this->buttonLicense->Location = System::Drawing::Point(798, 5);
1165  this->buttonLicense->Name = L"buttonLicense";
1166  this->buttonLicense->Padding = System::Windows::Forms::Padding(10, 0, 5, 0);
1167  this->buttonLicense->Size = System::Drawing::Size(91, 35);
1168  this->buttonLicense->TabIndex = 19;
1169  this->buttonLicense->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/3333D311.htm";
1170  this->buttonLicense->Text = L"License";
1171  this->buttonLicense->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1172  this->buttonLicense->UseVisualStyleBackColor = true;
1173  this->buttonLicense->Click += gcnew System::EventHandler(this, &SampleForm::buttonLicense_Click);
1174  //
1175  // buttonStartStopWebServer
1176  //
1177  this->buttonStartStopWebServer->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1178  this->buttonStartStopWebServer->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonStartStopWebServer.Image")));
1179  this->buttonStartStopWebServer->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1180  this->buttonStartStopWebServer->Location = System::Drawing::Point(676, 5);
1181  this->buttonStartStopWebServer->Name = L"buttonStartStopWebServer";
1182  this->buttonStartStopWebServer->Padding = System::Windows::Forms::Padding(10, 0, 5, 0);
1183  this->buttonStartStopWebServer->Size = System::Drawing::Size(116, 35);
1184  this->buttonStartStopWebServer->TabIndex = 18;
1185  this->buttonStartStopWebServer->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/3333D311.htm";
1186  this->buttonStartStopWebServer->Text = L"Web Server";
1187  this->buttonStartStopWebServer->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1188  this->buttonStartStopWebServer->UseVisualStyleBackColor = true;
1189  this->buttonStartStopWebServer->Click += gcnew System::EventHandler(this, &SampleForm::buttonStartStopWebServer_Click);
1190  //
1191  // buttonHmi
1192  //
1193  this->buttonHmi->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1194  this->buttonHmi->Appearance = System::Windows::Forms::Appearance::Button;
1195  this->buttonHmi->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonHmi.Image")));
1196  this->buttonHmi->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1197  this->buttonHmi->Location = System::Drawing::Point(895, 5);
1198  this->buttonHmi->Name = L"buttonHmi";
1199  this->buttonHmi->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1200  this->buttonHmi->Size = System::Drawing::Size(80, 35);
1201  this->buttonHmi->TabIndex = 9;
1202  this->buttonHmi->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/18FE2C39.htm";
1203  this->buttonHmi->Text = L"HMI";
1204  this->buttonHmi->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1205  this->buttonHmi->UseVisualStyleBackColor = true;
1206  this->buttonHmi->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::buttonHmi_Click);
1207  //
1208  // checkBoxNewRuntimeManager
1209  //
1210  this->checkBoxNewRuntimeManager->AutoSize = true;
1211  this->checkBoxNewRuntimeManager->Enabled = false;
1212  this->checkBoxNewRuntimeManager->Location = System::Drawing::Point(481, 7);
1213  this->checkBoxNewRuntimeManager->Name = L"checkBoxNewRuntimeManager";
1214  this->checkBoxNewRuntimeManager->Size = System::Drawing::Size(89, 17);
1215  this->checkBoxNewRuntimeManager->TabIndex = 7;
1216  this->checkBoxNewRuntimeManager->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/A42F362A.htm";
1217  this->checkBoxNewRuntimeManager->Text = L"New RntMgr.";
1218  this->checkBoxNewRuntimeManager->UseVisualStyleBackColor = true;
1219  this->checkBoxNewRuntimeManager->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxNewRuntimeManager_CheckedChanged);
1220  //
1221  // label15
1222  //
1223  this->label15->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
1224  | System::Windows::Forms::AnchorStyles::Right));
1225  this->label15->BackColor = System::Drawing::SystemColors::ControlDark;
1226  this->label15->Location = System::Drawing::Point(3, 43);
1227  this->label15->Name = L"label15";
1228  this->label15->Size = System::Drawing::Size(1328, 1);
1229  this->label15->TabIndex = 12;
1230  //
1231  // label14
1232  //
1233  this->label14->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
1234  | System::Windows::Forms::AnchorStyles::Right));
1235  this->label14->BackColor = System::Drawing::SystemColors::ControlDark;
1236  this->label14->Location = System::Drawing::Point(1, 1);
1237  this->label14->Name = L"label14";
1238  this->label14->Size = System::Drawing::Size(1328, 1);
1239  this->label14->TabIndex = 0;
1240  //
1241  // checkBoxCyclicReload
1242  //
1243  this->checkBoxCyclicReload->AutoSize = true;
1244  this->checkBoxCyclicReload->Enabled = false;
1245  this->checkBoxCyclicReload->Location = System::Drawing::Point(481, 23);
1246  this->checkBoxCyclicReload->Name = L"checkBoxCyclicReload";
1247  this->checkBoxCyclicReload->Size = System::Drawing::Size(91, 17);
1248  this->checkBoxCyclicReload->TabIndex = 8;
1249  this->checkBoxCyclicReload->Text = L"Cyclic Reload";
1250  this->checkBoxCyclicReload->UseVisualStyleBackColor = true;
1251  this->checkBoxCyclicReload->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxCyclicReload_CheckedChanged);
1252  //
1253  // listBoxOuput
1254  //
1255  this->listBoxOuput->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
1256  | System::Windows::Forms::AnchorStyles::Left)
1257  | System::Windows::Forms::AnchorStyles::Right));
1258  this->listBoxOuput->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
1259  static_cast<System::Byte>(0)));
1260  this->listBoxOuput->HorizontalScrollbar = true;
1261  this->listBoxOuput->IntegralHeight = false;
1262  this->listBoxOuput->ItemHeight = 14;
1263  this->listBoxOuput->Location = System::Drawing::Point(0, 76);
1264  this->listBoxOuput->Name = L"listBoxOuput";
1265  this->listBoxOuput->SelectionMode = System::Windows::Forms::SelectionMode::MultiExtended;
1266  this->listBoxOuput->Size = System::Drawing::Size(1328, 81);
1267  this->listBoxOuput->TabIndex = 17;
1268  this->listBoxOuput->SelectedIndexChanged += gcnew System::EventHandler(this, &SampleForm::listBoxOuput_SelectedIndexChanged);
1269  //
1270  // labelOutputOverflow
1271  //
1272  this->labelOutputOverflow->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1273  this->labelOutputOverflow->AutoSize = true;
1274  this->labelOutputOverflow->ForeColor = System::Drawing::Color::DarkRed;
1275  this->labelOutputOverflow->Location = System::Drawing::Point(781, 53);
1276  this->labelOutputOverflow->Name = L"labelOutputOverflow";
1277  this->labelOutputOverflow->Size = System::Drawing::Size(345, 13);
1278  this->labelOutputOverflow->TabIndex = 14;
1279  this->labelOutputOverflow->Text = L"More than 7,500 lines are in output! After 10,000 all lines will be cleared!";
1280  this->labelOutputOverflow->Visible = false;
1281  //
1282  // buttonCopyRow
1283  //
1284  this->buttonCopyRow->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1285  this->buttonCopyRow->Enabled = false;
1286  this->buttonCopyRow->Location = System::Drawing::Point(1132, 48);
1287  this->buttonCopyRow->Name = L"buttonCopyRow";
1288  this->buttonCopyRow->Size = System::Drawing::Size(86, 23);
1289  this->buttonCopyRow->TabIndex = 15;
1290  this->buttonCopyRow->Text = L"Copy";
1291  this->buttonCopyRow->UseVisualStyleBackColor = true;
1292  this->buttonCopyRow->Click += gcnew System::EventHandler(this, &SampleForm::buttonCopyRow_Click);
1293  //
1294  // buttonClearOutput
1295  //
1296  this->buttonClearOutput->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1297  this->buttonClearOutput->Location = System::Drawing::Point(1224, 48);
1298  this->buttonClearOutput->Name = L"buttonClearOutput";
1299  this->buttonClearOutput->Size = System::Drawing::Size(104, 23);
1300  this->buttonClearOutput->TabIndex = 16;
1301  this->buttonClearOutput->Text = L"Clear Output";
1302  this->buttonClearOutput->UseVisualStyleBackColor = true;
1303  this->buttonClearOutput->Click += gcnew System::EventHandler(this, &SampleForm::buttonClearOutput_Click);
1304  //
1305  // buttonNewInstanceNewThread
1306  //
1307  this->buttonNewInstanceNewThread->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1308  this->buttonNewInstanceNewThread->AutoSize = true;
1309  this->buttonNewInstanceNewThread->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonNewInstanceNewThread.Image")));
1310  this->buttonNewInstanceNewThread->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1311  this->buttonNewInstanceNewThread->Location = System::Drawing::Point(1116, 5);
1312  this->buttonNewInstanceNewThread->Name = L"buttonNewInstanceNewThread";
1313  this->buttonNewInstanceNewThread->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1314  this->buttonNewInstanceNewThread->Size = System::Drawing::Size(212, 35);
1315  this->buttonNewInstanceNewThread->TabIndex = 11;
1316  this->buttonNewInstanceNewThread->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/18FE2C39.htm";
1317  this->buttonNewInstanceNewThread->Text = L"New Instance - New Thread";
1318  this->buttonNewInstanceNewThread->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1319  this->buttonNewInstanceNewThread->UseVisualStyleBackColor = true;
1320  this->buttonNewInstanceNewThread->Click += gcnew System::EventHandler(this, &SampleForm::buttonNewInstanceNewThread_Click);
1321  //
1322  // buttonNewInstance
1323  //
1324  this->buttonNewInstance->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1325  this->buttonNewInstance->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonNewInstance.Image")));
1326  this->buttonNewInstance->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1327  this->buttonNewInstance->Location = System::Drawing::Point(981, 5);
1328  this->buttonNewInstance->Name = L"buttonNewInstance";
1329  this->buttonNewInstance->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1330  this->buttonNewInstance->Size = System::Drawing::Size(129, 35);
1331  this->buttonNewInstance->TabIndex = 10;
1332  this->buttonNewInstance->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/18FE2C39.htm";
1333  this->buttonNewInstance->Text = L"New Instance";
1334  this->buttonNewInstance->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1335  this->buttonNewInstance->UseVisualStyleBackColor = true;
1336  this->buttonNewInstance->Click += gcnew System::EventHandler(this, &SampleForm::buttonNewInstance_Click);
1337  //
1338  // checkBoxStartAllParents
1339  //
1340  this->checkBoxStartAllParents->AutoSize = true;
1341  this->checkBoxStartAllParents->Location = System::Drawing::Point(149, 51);
1342  this->checkBoxStartAllParents->Name = L"checkBoxStartAllParents";
1343  this->checkBoxStartAllParents->Size = System::Drawing::Size(106, 17);
1344  this->checkBoxStartAllParents->TabIndex = 12;
1345  this->checkBoxStartAllParents->Tag = L"";
1346  this->checkBoxStartAllParents->Text = L"Sync with Parent";
1347  this->checkBoxStartAllParents->UseVisualStyleBackColor = true;
1348  this->checkBoxStartAllParents->Visible = false;
1349  //
1350  // checkBoxAdd2Output
1351  //
1352  this->checkBoxAdd2Output->AutoSize = true;
1353  this->checkBoxAdd2Output->Checked = true;
1354  this->checkBoxAdd2Output->CheckState = System::Windows::Forms::CheckState::Checked;
1355  this->checkBoxAdd2Output->Location = System::Drawing::Point(0, 51);
1356  this->checkBoxAdd2Output->Name = L"checkBoxAdd2Output";
1357  this->checkBoxAdd2Output->Size = System::Drawing::Size(143, 17);
1358  this->checkBoxAdd2Output->TabIndex = 13;
1359  this->checkBoxAdd2Output->Tag = L"";
1360  this->checkBoxAdd2Output->Text = L"Add Messages to Output";
1361  this->checkBoxAdd2Output->UseVisualStyleBackColor = true;
1362  this->checkBoxAdd2Output->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxAdd2Output_CheckedChanged);
1363  //
1364  // checkBoxCyclicExecution
1365  //
1366  this->checkBoxCyclicExecution->AutoSize = true;
1367  this->checkBoxCyclicExecution->Location = System::Drawing::Point(405, 23);
1368  this->checkBoxCyclicExecution->Name = L"checkBoxCyclicExecution";
1369  this->checkBoxCyclicExecution->Size = System::Drawing::Size(54, 17);
1370  this->checkBoxCyclicExecution->TabIndex = 6;
1371  this->checkBoxCyclicExecution->Tag = L"";
1372  this->checkBoxCyclicExecution->Text = L"Cyclic";
1373  this->checkBoxCyclicExecution->UseVisualStyleBackColor = true;
1374  this->checkBoxCyclicExecution->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxCyclicExecution_CheckedChanged);
1375  //
1376  // checkBoxAsyncExecution
1377  //
1378  this->checkBoxAsyncExecution->AutoSize = true;
1379  this->checkBoxAsyncExecution->Checked = true;
1380  this->checkBoxAsyncExecution->CheckState = System::Windows::Forms::CheckState::Checked;
1381  this->checkBoxAsyncExecution->Location = System::Drawing::Point(405, 7);
1382  this->checkBoxAsyncExecution->Name = L"checkBoxAsyncExecution";
1383  this->checkBoxAsyncExecution->Size = System::Drawing::Size(76, 17);
1384  this->checkBoxAsyncExecution->TabIndex = 5;
1385  this->checkBoxAsyncExecution->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/A42F362A.htm";
1386  this->checkBoxAsyncExecution->Text = L"Asynchron";
1387  this->checkBoxAsyncExecution->UseVisualStyleBackColor = true;
1388  this->checkBoxAsyncExecution->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::checkBoxAsyncExecution_CheckedChanged);
1389  //
1390  // buttonPause
1391  //
1392  this->buttonPause->Appearance = System::Windows::Forms::Appearance::Button;
1393  this->buttonPause->Enabled = false;
1394  this->buttonPause->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonPause.Image")));
1395  this->buttonPause->Location = System::Drawing::Point(263, 5);
1396  this->buttonPause->Name = L"buttonPause";
1397  this->buttonPause->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1398  this->buttonPause->Size = System::Drawing::Size(42, 35);
1399  this->buttonPause->TabIndex = 3;
1400  this->buttonPause->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/3333D311.htm";
1401  this->buttonPause->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1402  this->buttonPause->UseVisualStyleBackColor = true;
1403  this->buttonPause->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::buttonPause_Click);
1404  //
1405  // buttonStop
1406  //
1407  this->buttonStop->Enabled = false;
1408  this->buttonStop->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonStop.Image")));
1409  this->buttonStop->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1410  this->buttonStop->Location = System::Drawing::Point(311, 5);
1411  this->buttonStop->Name = L"buttonStop";
1412  this->buttonStop->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1413  this->buttonStop->Size = System::Drawing::Size(88, 35);
1414  this->buttonStop->TabIndex = 4;
1415  this->buttonStop->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/3333D311.htm";
1416  this->buttonStop->Text = L"Stop";
1417  this->buttonStop->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1418  this->buttonStop->UseVisualStyleBackColor = true;
1419  this->buttonStop->Click += gcnew System::EventHandler(this, &SampleForm::buttonStop_Click);
1420  //
1421  // buttonExecuteMain
1422  //
1423  this->buttonExecuteMain->Enabled = false;
1424  this->buttonExecuteMain->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonExecuteMain.Image")));
1425  this->buttonExecuteMain->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1426  this->buttonExecuteMain->Location = System::Drawing::Point(0, 5);
1427  this->buttonExecuteMain->Name = L"buttonExecuteMain";
1428  this->buttonExecuteMain->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1429  this->buttonExecuteMain->Size = System::Drawing::Size(91, 35);
1430  this->buttonExecuteMain->TabIndex = 1;
1431  this->buttonExecuteMain->Text = L"Main";
1432  this->buttonExecuteMain->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1433  this->buttonExecuteMain->UseVisualStyleBackColor = true;
1434  this->buttonExecuteMain->Click += gcnew System::EventHandler(this, &SampleForm::buttonExecuteMain_Click);
1435  //
1436  // buttonExecuteSelectedProcedure
1437  //
1438  this->buttonExecuteSelectedProcedure->Enabled = false;
1439  this->buttonExecuteSelectedProcedure->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"buttonExecuteSelectedProcedure.Image")));
1440  this->buttonExecuteSelectedProcedure->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
1441  this->buttonExecuteSelectedProcedure->Location = System::Drawing::Point(97, 5);
1442  this->buttonExecuteSelectedProcedure->Name = L"buttonExecuteSelectedProcedure";
1443  this->buttonExecuteSelectedProcedure->Padding = System::Windows::Forms::Padding(10, 0, 10, 0);
1444  this->buttonExecuteSelectedProcedure->Size = System::Drawing::Size(160, 35);
1445  this->buttonExecuteSelectedProcedure->TabIndex = 2;
1446  this->buttonExecuteSelectedProcedure->Text = L"Selected Procedure";
1447  this->buttonExecuteSelectedProcedure->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
1448  this->buttonExecuteSelectedProcedure->UseVisualStyleBackColor = true;
1449  this->buttonExecuteSelectedProcedure->Click += gcnew System::EventHandler(this, &SampleForm::buttonExecuteSelectedProcedure_Click);
1450  //
1451  // openFileDialog1
1452  //
1453  this->openFileDialog1->Filter = L"All supported formats(*.ptx, *.ppx)|*.ptx;*.ppx|PTX Files(*.ptx)|*.ptx|PPX Files("
1454  L"*->ppx)|*->ppx|All Files (*->*)|*->*";
1455  this->openFileDialog1->Title = L"Please select a PTX/PPX file";
1456  //
1457  // splitContainer1
1458  //
1459  this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
1460  this->splitContainer1->FixedPanel = System::Windows::Forms::FixedPanel::Panel1;
1461  this->splitContainer1->Location = System::Drawing::Point(0, 115);
1462  this->splitContainer1->Name = L"splitContainer1";
1463  //
1464  // splitContainer1.Panel1
1465  //
1466  this->splitContainer1->Panel1->Controls->Add(this->treeViewOtxProject);
1467  this->splitContainer1->Panel1->Controls->Add(this->label3);
1468  //
1469  // splitContainer1.Panel2
1470  //
1471  this->splitContainer1->Panel2->Controls->Add(this->splitContainer5);
1472  this->splitContainer1->Size = System::Drawing::Size(1328, 290);
1473  this->splitContainer1->SplitterDistance = 307;
1474  this->splitContainer1->TabIndex = 5;
1475  //
1476  // treeViewOtxProject
1477  //
1478  this->treeViewOtxProject->Dock = System::Windows::Forms::DockStyle::Fill;
1479  this->treeViewOtxProject->Enabled = false;
1480  this->treeViewOtxProject->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
1481  this->treeViewOtxProject->HideSelection = false;
1482  this->treeViewOtxProject->Location = System::Drawing::Point(0, 16);
1483  this->treeViewOtxProject->Name = L"treeViewOtxProject";
1484  this->treeViewOtxProject->Size = System::Drawing::Size(307, 274);
1485  this->treeViewOtxProject->TabIndex = 1;
1486  this->treeViewOtxProject->DrawNode += gcnew System::Windows::Forms::DrawTreeNodeEventHandler(this, &SampleForm::treeViewOtxProject_DrawNode);
1487  this->treeViewOtxProject->AfterSelect += gcnew System::Windows::Forms::TreeViewEventHandler(this, &SampleForm::treeViewOtxProject_AfterSelect);
1488  //
1489  // label3
1490  //
1491  this->label3->AutoSize = true;
1492  this->label3->Dock = System::Windows::Forms::DockStyle::Top;
1493  this->label3->Location = System::Drawing::Point(0, 0);
1494  this->label3->Name = L"label3";
1495  this->label3->Padding = System::Windows::Forms::Padding(0, 0, 0, 3);
1496  this->label3->Size = System::Drawing::Size(245, 16);
1497  this->label3->TabIndex = 0;
1498  this->label3->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/671A83F2.htm";
1499  this->label3->Text = L"OTX-Project Tree (To execute select a Procedure)";
1500  //
1501  // splitContainer5
1502  //
1503  this->splitContainer5->Dock = System::Windows::Forms::DockStyle::Fill;
1504  this->splitContainer5->FixedPanel = System::Windows::Forms::FixedPanel::Panel1;
1505  this->splitContainer5->Location = System::Drawing::Point(0, 0);
1506  this->splitContainer5->MinimumSize = System::Drawing::Size(0, 318);
1507  this->splitContainer5->Name = L"splitContainer5";
1508  //
1509  // splitContainer5.Panel1
1510  //
1511  this->splitContainer5->Panel1->Controls->Add(this->splitContainer2);
1512  //
1513  // splitContainer5.Panel2
1514  //
1515  this->splitContainer5->Panel2->Controls->Add(this->panel3);
1516  this->splitContainer5->Panel2->Controls->Add(this->groupBox1);
1517  this->splitContainer5->Size = System::Drawing::Size(1017, 318);
1518  this->splitContainer5->SplitterDistance = 311;
1519  this->splitContainer5->TabIndex = 4;
1520  //
1521  // splitContainer2
1522  //
1523  this->splitContainer2->Dock = System::Windows::Forms::DockStyle::Fill;
1524  this->splitContainer2->Location = System::Drawing::Point(0, 0);
1525  this->splitContainer2->Name = L"splitContainer2";
1526  this->splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal;
1527  //
1528  // splitContainer2.Panel1
1529  //
1530  this->splitContainer2->Panel1->Controls->Add(this->gridViewParameter);
1531  this->splitContainer2->Panel1->Controls->Add(this->labelAdjustProcedureParameters);
1532  //
1533  // splitContainer2.Panel2
1534  //
1535  this->splitContainer2->Panel2->Controls->Add(this->splitContainer3);
1536  this->splitContainer2->Size = System::Drawing::Size(311, 318);
1537  this->splitContainer2->SplitterDistance = 95;
1538  this->splitContainer2->TabIndex = 3;
1539  //
1540  // gridViewParameter
1541  //
1542  this->gridViewParameter->AllowUserToAddRows = false;
1543  this->gridViewParameter->AllowUserToDeleteRows = false;
1544  this->gridViewParameter->AllowUserToResizeRows = false;
1545  this->gridViewParameter->BackgroundColor = System::Drawing::SystemColors::Window;
1546  this->gridViewParameter->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
1547  this->gridViewParameter->CellBorderStyle = System::Windows::Forms::DataGridViewCellBorderStyle::None;
1548  this->gridViewParameter->ColumnHeadersBorderStyle = System::Windows::Forms::DataGridViewHeaderBorderStyle::None;
1549  this->gridViewParameter->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
1550  this->gridViewParameter->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(5) {
1551  this->dataGridViewTextBoxColumnName,
1552  this->dataGridViewTextBoxColumnDirection, this->dataGridViewTextBoxColumnDataType, this->dataGridViewTextBoxColumnValue, this->dataGridViewTextBoxColumnDetails
1553  });
1554  dataGridViewCellStyle1->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
1555  dataGridViewCellStyle1->BackColor = System::Drawing::SystemColors::Window;
1556  dataGridViewCellStyle1->Font = (gcnew System::Drawing::Font(L"Consolas", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
1557  static_cast<System::Byte>(0)));
1558  dataGridViewCellStyle1->ForeColor = System::Drawing::SystemColors::ControlText;
1559  dataGridViewCellStyle1->SelectionBackColor = System::Drawing::SystemColors::Highlight;
1560  dataGridViewCellStyle1->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
1561  dataGridViewCellStyle1->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
1562  this->gridViewParameter->DefaultCellStyle = dataGridViewCellStyle1;
1563  this->gridViewParameter->Dock = System::Windows::Forms::DockStyle::Fill;
1564  this->gridViewParameter->Enabled = false;
1565  this->gridViewParameter->EnableHeadersVisualStyles = false;
1566  this->gridViewParameter->Location = System::Drawing::Point(0, 16);
1567  this->gridViewParameter->MultiSelect = false;
1568  this->gridViewParameter->Name = L"gridViewParameter";
1569  this->gridViewParameter->RowHeadersVisible = false;
1570  this->gridViewParameter->RowHeadersWidth = 51;
1571  this->gridViewParameter->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
1572  this->gridViewParameter->Size = System::Drawing::Size(311, 79);
1573  this->gridViewParameter->StandardTab = true;
1574  this->gridViewParameter->TabIndex = 1;
1575  this->gridViewParameter->CellContentClick += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridView_CellContentClick);
1576  this->gridViewParameter->CellValidated += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridViewParameter_CellValidated);
1577  this->gridViewParameter->CellValidating += gcnew System::Windows::Forms::DataGridViewCellValidatingEventHandler(this, &SampleForm::gridViewParameter_CellValidating);
1578  this->gridViewParameter->CellValueChanged += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridView_CellValueChanged);
1579  //
1580  // dataGridViewTextBoxColumnName
1581  //
1582  this->dataGridViewTextBoxColumnName->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1583  this->dataGridViewTextBoxColumnName->HeaderText = L"Name";
1584  this->dataGridViewTextBoxColumnName->MinimumWidth = 6;
1585  this->dataGridViewTextBoxColumnName->Name = L"dataGridViewTextBoxColumnName";
1586  this->dataGridViewTextBoxColumnName->ReadOnly = true;
1587  this->dataGridViewTextBoxColumnName->Width = 58;
1588  //
1589  // dataGridViewTextBoxColumnDirection
1590  //
1591  this->dataGridViewTextBoxColumnDirection->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1592  this->dataGridViewTextBoxColumnDirection->HeaderText = L"Direction";
1593  this->dataGridViewTextBoxColumnDirection->Name = L"dataGridViewTextBoxColumnDirection";
1594  this->dataGridViewTextBoxColumnDirection->ReadOnly = true;
1595  this->dataGridViewTextBoxColumnDirection->Width = 72;
1596  //
1597  // dataGridViewTextBoxColumnDataType
1598  //
1599  this->dataGridViewTextBoxColumnDataType->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1600  this->dataGridViewTextBoxColumnDataType->HeaderText = L"DataType";
1601  this->dataGridViewTextBoxColumnDataType->MinimumWidth = 6;
1602  this->dataGridViewTextBoxColumnDataType->Name = L"dataGridViewTextBoxColumnDataType";
1603  this->dataGridViewTextBoxColumnDataType->ReadOnly = true;
1604  this->dataGridViewTextBoxColumnDataType->Width = 77;
1605  //
1606  // dataGridViewTextBoxColumnValue
1607  //
1608  this->dataGridViewTextBoxColumnValue->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1609  this->dataGridViewTextBoxColumnValue->HeaderText = L"Value";
1610  this->dataGridViewTextBoxColumnValue->MinimumWidth = 80;
1611  this->dataGridViewTextBoxColumnValue->Name = L"dataGridViewTextBoxColumnValue";
1612  this->dataGridViewTextBoxColumnValue->Width = 80;
1613  //
1614  // dataGridViewTextBoxColumnDetails
1615  //
1616  this->dataGridViewTextBoxColumnDetails->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1617  this->dataGridViewTextBoxColumnDetails->HeaderText = L"Details";
1618  this->dataGridViewTextBoxColumnDetails->Name = L"dataGridViewTextBoxColumnDetails";
1619  this->dataGridViewTextBoxColumnDetails->ReadOnly = true;
1620  this->dataGridViewTextBoxColumnDetails->Width = 62;
1621  //
1622  // labelAdjustProcedureParameters
1623  //
1624  this->labelAdjustProcedureParameters->AutoSize = true;
1625  this->labelAdjustProcedureParameters->Dock = System::Windows::Forms::DockStyle::Top;
1626  this->labelAdjustProcedureParameters->Location = System::Drawing::Point(0, 0);
1627  this->labelAdjustProcedureParameters->Name = L"labelAdjustProcedureParameters";
1628  this->labelAdjustProcedureParameters->Padding = System::Windows::Forms::Padding(0, 0, 0, 3);
1629  this->labelAdjustProcedureParameters->Size = System::Drawing::Size(188, 16);
1630  this->labelAdjustProcedureParameters->TabIndex = 0;
1631  this->labelAdjustProcedureParameters->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/94D3A64.htm";
1632  this->labelAdjustProcedureParameters->Text = L"Parameters of the selected Procedure:";
1633  //
1634  // splitContainer3
1635  //
1636  this->splitContainer3->Dock = System::Windows::Forms::DockStyle::Fill;
1637  this->splitContainer3->Location = System::Drawing::Point(0, 0);
1638  this->splitContainer3->Name = L"splitContainer3";
1639  this->splitContainer3->Orientation = System::Windows::Forms::Orientation::Horizontal;
1640  //
1641  // splitContainer3.Panel1
1642  //
1643  this->splitContainer3->Panel1->Controls->Add(this->gridViewContext);
1644  this->splitContainer3->Panel1->Controls->Add(this->label4);
1645  //
1646  // splitContainer3.Panel2
1647  //
1648  this->splitContainer3->Panel2->Controls->Add(this->gridViewState);
1649  this->splitContainer3->Panel2->Controls->Add(this->label5);
1650  this->splitContainer3->Size = System::Drawing::Size(311, 219);
1651  this->splitContainer3->SplitterDistance = 105;
1652  this->splitContainer3->TabIndex = 0;
1653  //
1654  // gridViewContext
1655  //
1656  this->gridViewContext->AllowUserToAddRows = false;
1657  this->gridViewContext->AllowUserToDeleteRows = false;
1658  this->gridViewContext->AllowUserToResizeRows = false;
1659  this->gridViewContext->BackgroundColor = System::Drawing::SystemColors::Window;
1660  this->gridViewContext->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
1661  this->gridViewContext->CellBorderStyle = System::Windows::Forms::DataGridViewCellBorderStyle::None;
1662  this->gridViewContext->ColumnHeadersBorderStyle = System::Windows::Forms::DataGridViewHeaderBorderStyle::None;
1663  this->gridViewContext->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
1664  this->gridViewContext->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {
1665  this->dataGridViewTextBoxColumnContextName,
1666  this->dataGridViewTextBoxColumnContextDataType, this->dataGridViewTextBoxColumnContextValue, this->dataGridViewTextBoxColumnContextDetails
1667  });
1668  dataGridViewCellStyle2->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
1669  dataGridViewCellStyle2->BackColor = System::Drawing::SystemColors::Window;
1670  dataGridViewCellStyle2->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
1671  dataGridViewCellStyle2->ForeColor = System::Drawing::SystemColors::ControlText;
1672  dataGridViewCellStyle2->SelectionBackColor = System::Drawing::SystemColors::Highlight;
1673  dataGridViewCellStyle2->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
1674  dataGridViewCellStyle2->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
1675  this->gridViewContext->DefaultCellStyle = dataGridViewCellStyle2;
1676  this->gridViewContext->Dock = System::Windows::Forms::DockStyle::Fill;
1677  this->gridViewContext->EnableHeadersVisualStyles = false;
1678  this->gridViewContext->Location = System::Drawing::Point(0, 16);
1679  this->gridViewContext->MultiSelect = false;
1680  this->gridViewContext->Name = L"gridViewContext";
1681  this->gridViewContext->RowHeadersVisible = false;
1682  this->gridViewContext->RowHeadersWidth = 51;
1683  this->gridViewContext->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
1684  this->gridViewContext->Size = System::Drawing::Size(311, 89);
1685  this->gridViewContext->StandardTab = true;
1686  this->gridViewContext->TabIndex = 1;
1687  this->gridViewContext->CellContentClick += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridView_CellContentClick);
1688  this->gridViewContext->CellValidated += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridViewContextVariable_CellValidated);
1689  this->gridViewContext->CellValidating += gcnew System::Windows::Forms::DataGridViewCellValidatingEventHandler(this, &SampleForm::gridViewContextVariable_CellValidating);
1690  this->gridViewContext->CellValueChanged += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &SampleForm::gridView_CellValueChanged);
1691  //
1692  // dataGridViewTextBoxColumnContextName
1693  //
1694  this->dataGridViewTextBoxColumnContextName->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1695  this->dataGridViewTextBoxColumnContextName->HeaderText = L"Name";
1696  this->dataGridViewTextBoxColumnContextName->MinimumWidth = 6;
1697  this->dataGridViewTextBoxColumnContextName->Name = L"dataGridViewTextBoxColumnContextName";
1698  this->dataGridViewTextBoxColumnContextName->ReadOnly = true;
1699  this->dataGridViewTextBoxColumnContextName->Width = 58;
1700  //
1701  // dataGridViewTextBoxColumnContextDataType
1702  //
1703  this->dataGridViewTextBoxColumnContextDataType->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1704  this->dataGridViewTextBoxColumnContextDataType->HeaderText = L"DataType";
1705  this->dataGridViewTextBoxColumnContextDataType->MinimumWidth = 6;
1706  this->dataGridViewTextBoxColumnContextDataType->Name = L"dataGridViewTextBoxColumnContextDataType";
1707  this->dataGridViewTextBoxColumnContextDataType->ReadOnly = true;
1708  this->dataGridViewTextBoxColumnContextDataType->Width = 77;
1709  //
1710  // dataGridViewTextBoxColumnContextValue
1711  //
1712  this->dataGridViewTextBoxColumnContextValue->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1713  this->dataGridViewTextBoxColumnContextValue->HeaderText = L"Value";
1714  this->dataGridViewTextBoxColumnContextValue->MinimumWidth = 80;
1715  this->dataGridViewTextBoxColumnContextValue->Name = L"dataGridViewTextBoxColumnContextValue";
1716  this->dataGridViewTextBoxColumnContextValue->Width = 80;
1717  //
1718  // dataGridViewTextBoxColumnContextDetails
1719  //
1720  this->dataGridViewTextBoxColumnContextDetails->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1721  this->dataGridViewTextBoxColumnContextDetails->HeaderText = L"Details";
1722  this->dataGridViewTextBoxColumnContextDetails->Name = L"dataGridViewTextBoxColumnContextDetails";
1723  this->dataGridViewTextBoxColumnContextDetails->Width = 62;
1724  //
1725  // label4
1726  //
1727  this->label4->AutoSize = true;
1728  this->label4->Dock = System::Windows::Forms::DockStyle::Top;
1729  this->label4->Location = System::Drawing::Point(0, 0);
1730  this->label4->Name = L"label4";
1731  this->label4->Padding = System::Windows::Forms::Padding(0, 0, 0, 3);
1732  this->label4->Size = System::Drawing::Size(277, 16);
1733  this->label4->TabIndex = 0;
1734  this->label4->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/A926ED83.htm";
1735  this->label4->Text = L"Set value for ContextVariables of the selected Document:";
1736  //
1737  // gridViewState
1738  //
1739  this->gridViewState->AllowUserToAddRows = false;
1740  this->gridViewState->AllowUserToDeleteRows = false;
1741  this->gridViewState->AllowUserToResizeRows = false;
1742  this->gridViewState->BackgroundColor = System::Drawing::SystemColors::Window;
1743  this->gridViewState->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
1744  this->gridViewState->CellBorderStyle = System::Windows::Forms::DataGridViewCellBorderStyle::None;
1745  this->gridViewState->ColumnHeadersBorderStyle = System::Windows::Forms::DataGridViewHeaderBorderStyle::None;
1746  this->gridViewState->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
1747  this->gridViewState->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {
1748  this->dataGridViewTextBoxColumnStateName,
1749  this->dataGridViewTextBoxColumnStateDataType, this->dataGridViewTextBoxColumnStateValue, this->dataGridViewTextBoxColumnStateDetails
1750  });
1751  dataGridViewCellStyle3->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
1752  dataGridViewCellStyle3->BackColor = System::Drawing::SystemColors::Window;
1753  dataGridViewCellStyle3->Font = (gcnew System::Drawing::Font(L"Consolas", 9));
1754  dataGridViewCellStyle3->ForeColor = System::Drawing::SystemColors::ControlText;
1755  dataGridViewCellStyle3->SelectionBackColor = System::Drawing::SystemColors::Highlight;
1756  dataGridViewCellStyle3->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
1757  dataGridViewCellStyle3->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
1758  this->gridViewState->DefaultCellStyle = dataGridViewCellStyle3;
1759  this->gridViewState->Dock = System::Windows::Forms::DockStyle::Fill;
1760  this->gridViewState->EnableHeadersVisualStyles = false;
1761  this->gridViewState->Location = System::Drawing::Point(0, 16);
1762  this->gridViewState->MultiSelect = false;
1763  this->gridViewState->Name = L"gridViewState";
1764  this->gridViewState->RowHeadersVisible = false;
1765  this->gridViewState->RowHeadersWidth = 51;
1766  this->gridViewState->Size = System::Drawing::Size(311, 94);
1767  this->gridViewState->StandardTab = true;
1768  this->gridViewState->TabIndex = 1;
1769  //
1770  // dataGridViewTextBoxColumnStateName
1771  //
1772  this->dataGridViewTextBoxColumnStateName->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::DisplayedCells;
1773  this->dataGridViewTextBoxColumnStateName->HeaderText = L"Name";
1774  this->dataGridViewTextBoxColumnStateName->MinimumWidth = 6;
1775  this->dataGridViewTextBoxColumnStateName->Name = L"dataGridViewTextBoxColumnStateName";
1776  this->dataGridViewTextBoxColumnStateName->ReadOnly = true;
1777  this->dataGridViewTextBoxColumnStateName->Width = 58;
1778  //
1779  // dataGridViewTextBoxColumnStateDataType
1780  //
1781  this->dataGridViewTextBoxColumnStateDataType->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1782  this->dataGridViewTextBoxColumnStateDataType->HeaderText = L"DataType";
1783  this->dataGridViewTextBoxColumnStateDataType->MinimumWidth = 6;
1784  this->dataGridViewTextBoxColumnStateDataType->Name = L"dataGridViewTextBoxColumnStateDataType";
1785  this->dataGridViewTextBoxColumnStateDataType->ReadOnly = true;
1786  this->dataGridViewTextBoxColumnStateDataType->Width = 77;
1787  //
1788  // dataGridViewTextBoxColumnStateValue
1789  //
1790  this->dataGridViewTextBoxColumnStateValue->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1791  this->dataGridViewTextBoxColumnStateValue->HeaderText = L"Value";
1792  this->dataGridViewTextBoxColumnStateValue->MinimumWidth = 80;
1793  this->dataGridViewTextBoxColumnStateValue->Name = L"dataGridViewTextBoxColumnStateValue";
1794  this->dataGridViewTextBoxColumnStateValue->ReadOnly = true;
1795  this->dataGridViewTextBoxColumnStateValue->Width = 80;
1796  //
1797  // dataGridViewTextBoxColumnStateDetails
1798  //
1799  this->dataGridViewTextBoxColumnStateDetails->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
1800  this->dataGridViewTextBoxColumnStateDetails->HeaderText = L"Details";
1801  this->dataGridViewTextBoxColumnStateDetails->Name = L"dataGridViewTextBoxColumnStateDetails";
1802  this->dataGridViewTextBoxColumnStateDetails->ReadOnly = true;
1803  this->dataGridViewTextBoxColumnStateDetails->Width = 62;
1804  //
1805  // label5
1806  //
1807  this->label5->AutoSize = true;
1808  this->label5->Dock = System::Windows::Forms::DockStyle::Top;
1809  this->label5->Location = System::Drawing::Point(0, 0);
1810  this->label5->Name = L"label5";
1811  this->label5->Padding = System::Windows::Forms::Padding(0, 0, 0, 3);
1812  this->label5->Size = System::Drawing::Size(248, 16);
1813  this->label5->TabIndex = 0;
1814  this->label5->Tag = L"http://www.emotive.de/DeveloperReference/OtxRuntime/html/94D3A64.htm";
1815  this->label5->Text = L"Display Status Variables of the selected Document:";
1816  //
1817  // panel3
1818  //
1819  this->panel3->Controls->Add(this->gridViewSettings);
1820  this->panel3->Controls->Add(this->panel4);
1821  this->panel3->Dock = System::Windows::Forms::DockStyle::Fill;
1822  this->panel3->Location = System::Drawing::Point(0, 46);
1823  this->panel3->Name = L"panel3";
1824  this->panel3->Size = System::Drawing::Size(702, 272);
1825  this->panel3->TabIndex = 1;
1826  //
1827  // gridViewSettings
1828  //
1829  this->gridViewSettings->AllowUserToAddRows = false;
1830  this->gridViewSettings->AllowUserToDeleteRows = false;
1831  this->gridViewSettings->AllowUserToResizeRows = false;
1832  this->gridViewSettings->BackgroundColor = System::Drawing::SystemColors::Window;
1833  this->gridViewSettings->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
1834  this->gridViewSettings->CellBorderStyle = System::Windows::Forms::DataGridViewCellBorderStyle::None;
1835  this->gridViewSettings->ColumnHeadersBorderStyle = System::Windows::Forms::DataGridViewHeaderBorderStyle::None;
1836  this->gridViewSettings->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
1837  this->gridViewSettings->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(2) {
1838  this->dataGridViewTextBoxColumnSettingName,
1839  this->dataGridViewTextBoxColumnSettingValue
1840  });
1841  this->gridViewSettings->Dock = System::Windows::Forms::DockStyle::Fill;
1842  this->gridViewSettings->Location = System::Drawing::Point(0, 28);
1843  this->gridViewSettings->MultiSelect = false;
1844  this->gridViewSettings->Name = L"gridViewSettings";
1845  this->gridViewSettings->RowHeadersVisible = false;
1846  this->gridViewSettings->RowHeadersWidth = 51;
1847  this->gridViewSettings->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
1848  this->gridViewSettings->Size = System::Drawing::Size(702, 244);
1849  this->gridViewSettings->StandardTab = true;
1850  this->gridViewSettings->TabIndex = 1;
1851  //
1852  // dataGridViewTextBoxColumnSettingName
1853  //
1854  this->dataGridViewTextBoxColumnSettingName->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::Fill;
1855  this->dataGridViewTextBoxColumnSettingName->HeaderText = L"Name";
1856  this->dataGridViewTextBoxColumnSettingName->MinimumWidth = 100;
1857  this->dataGridViewTextBoxColumnSettingName->Name = L"dataGridViewTextBoxColumnSettingName";
1858  this->dataGridViewTextBoxColumnSettingName->ReadOnly = true;
1859  //
1860  // dataGridViewTextBoxColumnSettingValue
1861  //
1862  this->dataGridViewTextBoxColumnSettingValue->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::Fill;
1863  this->dataGridViewTextBoxColumnSettingValue->HeaderText = L"Value";
1864  this->dataGridViewTextBoxColumnSettingValue->MinimumWidth = 160;
1865  this->dataGridViewTextBoxColumnSettingValue->Name = L"dataGridViewTextBoxColumnSettingValue";
1866  //
1867  // panel4
1868  //
1869  this->panel4->Controls->Add(this->label12);
1870  this->panel4->Controls->Add(this->buttonWriteSettings);
1871  this->panel4->Controls->Add(this->buttonReadSettings);
1872  this->panel4->Dock = System::Windows::Forms::DockStyle::Top;
1873  this->panel4->Location = System::Drawing::Point(0, 0);
1874  this->panel4->Name = L"panel4";
1875  this->panel4->Padding = System::Windows::Forms::Padding(20, 0, 20, 0);
1876  this->panel4->Size = System::Drawing::Size(702, 28);
1877  this->panel4->TabIndex = 0;
1878  //
1879  // label12
1880  //
1881  this->label12->AutoSize = true;
1882  this->label12->Location = System::Drawing::Point(2, 8);
1883  this->label12->Name = L"label12";
1884  this->label12->Padding = System::Windows::Forms::Padding(0, 3, 0, 3);
1885  this->label12->Size = System::Drawing::Size(81, 19);
1886  this->label12->TabIndex = 0;
1887  this->label12->Text = L"Project Settings";
1888  //
1889  // buttonWriteSettings
1890  //
1891  this->buttonWriteSettings->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1892  this->buttonWriteSettings->Location = System::Drawing::Point(652, 3);
1893  this->buttonWriteSettings->Name = L"buttonWriteSettings";
1894  this->buttonWriteSettings->Size = System::Drawing::Size(50, 23);
1895  this->buttonWriteSettings->TabIndex = 2;
1896  this->buttonWriteSettings->Text = L"Write";
1897  this->buttonWriteSettings->UseVisualStyleBackColor = true;
1898  this->buttonWriteSettings->Click += gcnew System::EventHandler(this, &SampleForm::buttonWriteSettings_Click);
1899  //
1900  // buttonReadSettings
1901  //
1902  this->buttonReadSettings->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
1903  this->buttonReadSettings->Location = System::Drawing::Point(598, 3);
1904  this->buttonReadSettings->Name = L"buttonReadSettings";
1905  this->buttonReadSettings->Size = System::Drawing::Size(50, 23);
1906  this->buttonReadSettings->TabIndex = 1;
1907  this->buttonReadSettings->Text = L"Read";
1908  this->buttonReadSettings->UseVisualStyleBackColor = true;
1909  this->buttonReadSettings->Click += gcnew System::EventHandler(this, &SampleForm::buttonReadSettings_Click);
1910  //
1911  // groupBox1
1912  //
1913  this->groupBox1->Controls->Add(this->radioButtonNoCustomImplementation);
1914  this->groupBox1->Controls->Add(this->radioButtonDefaultImplementation);
1915  this->groupBox1->Controls->Add(this->radioButtonOuputWindow);
1916  this->groupBox1->Dock = System::Windows::Forms::DockStyle::Top;
1917  this->groupBox1->Location = System::Drawing::Point(0, 0);
1918  this->groupBox1->MinimumSize = System::Drawing::Size(166, 0);
1919  this->groupBox1->Name = L"groupBox1";
1920  this->groupBox1->Size = System::Drawing::Size(702, 46);
1921  this->groupBox1->TabIndex = 0;
1922  this->groupBox1->TabStop = false;
1923  this->groupBox1->Text = L"Select Custom Implementation";
1924  //
1925  // radioButtonNoCustomImplementation
1926  //
1927  this->radioButtonNoCustomImplementation->AutoSize = true;
1928  this->radioButtonNoCustomImplementation->Location = System::Drawing::Point(250, 19);
1929  this->radioButtonNoCustomImplementation->Name = L"radioButtonNoCustomImplementation";
1930  this->radioButtonNoCustomImplementation->Size = System::Drawing::Size(51, 17);
1931  this->radioButtonNoCustomImplementation->TabIndex = 2;
1932  this->radioButtonNoCustomImplementation->TabStop = true;
1933  this->radioButtonNoCustomImplementation->Text = L"None";
1934  this->radioButtonNoCustomImplementation->UseVisualStyleBackColor = true;
1935  this->radioButtonNoCustomImplementation->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::radioButtonCustomImpl_CheckedChanged);
1936  //
1937  // radioButtonDefaultImplementation
1938  //
1939  this->radioButtonDefaultImplementation->AutoSize = true;
1940  this->radioButtonDefaultImplementation->Location = System::Drawing::Point(6, 19);
1941  this->radioButtonDefaultImplementation->Name = L"radioButtonDefaultImplementation";
1942  this->radioButtonDefaultImplementation->Size = System::Drawing::Size(133, 17);
1943  this->radioButtonDefaultImplementation->TabIndex = 0;
1944  this->radioButtonDefaultImplementation->TabStop = true;
1945  this->radioButtonDefaultImplementation->Text = L"Default Implementation";
1946  this->radioButtonDefaultImplementation->UseVisualStyleBackColor = true;
1947  this->radioButtonDefaultImplementation->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::radioButtonCustomImpl_CheckedChanged);
1948  //
1949  // radioButtonOuputWindow
1950  //
1951  this->radioButtonOuputWindow->AutoSize = true;
1952  this->radioButtonOuputWindow->Location = System::Drawing::Point(145, 19);
1953  this->radioButtonOuputWindow->Name = L"radioButtonOuputWindow";
1954  this->radioButtonOuputWindow->Size = System::Drawing::Size(99, 17);
1955  this->radioButtonOuputWindow->TabIndex = 1;
1956  this->radioButtonOuputWindow->TabStop = true;
1957  this->radioButtonOuputWindow->Text = L"Output Window";
1958  this->radioButtonOuputWindow->UseVisualStyleBackColor = true;
1959  this->radioButtonOuputWindow->CheckedChanged += gcnew System::EventHandler(this, &SampleForm::radioButtonCustomImpl_CheckedChanged);
1960  //
1961  // splitContainer4
1962  //
1963  this->splitContainer4->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
1964  | System::Windows::Forms::AnchorStyles::Left)
1965  | System::Windows::Forms::AnchorStyles::Right));
1966  this->splitContainer4->FixedPanel = System::Windows::Forms::FixedPanel::Panel1;
1967  this->splitContainer4->Location = System::Drawing::Point(12, 12);
1968  this->splitContainer4->Name = L"splitContainer4";
1969  this->splitContainer4->Orientation = System::Windows::Forms::Orientation::Horizontal;
1970  //
1971  // splitContainer4.Panel1
1972  //
1973  this->splitContainer4->Panel1->Controls->Add(this->splitContainer1);
1974  this->splitContainer4->Panel1->Controls->Add(this->panel1);
1975  //
1976  // splitContainer4.Panel2
1977  //
1978  this->splitContainer4->Panel2->Controls->Add(this->panel2);
1979  this->splitContainer4->Size = System::Drawing::Size(1328, 714);
1980  this->splitContainer4->SplitterDistance = 405;
1981  this->splitContainer4->TabIndex = 9;
1982  //
1983  // folderBrowserDialog1
1984  //
1985  this->folderBrowserDialog1->Description = L"Browse for folder...";
1986  //
1987  // imageList1
1988  //
1989  this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^>(resources->GetObject(L"imageList1.ImageStream")));
1990  this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
1991  this->imageList1->Images->SetKeyName(0, L"ODFProject.bmp");
1992  this->imageList1->Images->SetKeyName(1, L"Package.bmp");
1993  this->imageList1->Images->SetKeyName(2, L"DocumentOTX16.bmp");
1994  this->imageList1->Images->SetKeyName(3, L"Procedure.bmp");
1995  //
1996  // labelSeparator2
1997  //
1998  this->labelSeparator2->BackColor = System::Drawing::SystemColors::ControlDark;
1999  this->labelSeparator2->Location = System::Drawing::Point(693, 5);
2000  this->labelSeparator2->Margin = System::Windows::Forms::Padding(3, 5, 3, 0);
2001  this->labelSeparator2->Name = L"labelSeparator2";
2002  this->labelSeparator2->Size = System::Drawing::Size(1, 16);
2003  this->labelSeparator2->TabIndex = 5;
2004  //
2005  // labelProcedureExecutionState
2006  //
2007  this->labelProcedureExecutionState->AutoEllipsis = true;
2008  this->labelProcedureExecutionState->Dock = System::Windows::Forms::DockStyle::Fill;
2009  this->labelProcedureExecutionState->Location = System::Drawing::Point(22, 0);
2010  this->labelProcedureExecutionState->Margin = System::Windows::Forms::Padding(0, 0, 3, 0);
2011  this->labelProcedureExecutionState->Name = L"labelProcedureExecutionState";
2012  this->labelProcedureExecutionState->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
2013  this->labelProcedureExecutionState->Size = System::Drawing::Size(385, 31);
2014  this->labelProcedureExecutionState->TabIndex = 1;
2015  this->labelProcedureExecutionState->Text = L"Select a procedure and click \"Start\"...";
2016  //
2017  // tableLayoutPanelExecutionState
2018  //
2019  this->tableLayoutPanelExecutionState->ColumnCount = 23;
2020  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2021  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
2022  100)));
2023  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2024  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2025  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2026  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2027  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2028  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2029  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2030  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2031  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2032  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2033  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2034  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2035  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2036  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2037  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2038  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2039  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2040  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2041  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2042  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2043  this->tableLayoutPanelExecutionState->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle()));
2044  this->tableLayoutPanelExecutionState->Controls->Add(this->labelIconProcedureExecutionState, 0, 0);
2045  this->tableLayoutPanelExecutionState->Controls->Add(this->labelProcedureExecutionState, 1, 0);
2046  this->tableLayoutPanelExecutionState->Controls->Add(this->labelSeparator2, 7, 0);
2047  this->tableLayoutPanelExecutionState->Controls->Add(this->checkBoxUseConnectionState, 8, 0);
2048  this->tableLayoutPanelExecutionState->Controls->Add(this->labelBatteryState, 11, 0);
2049  this->tableLayoutPanelExecutionState->Controls->Add(this->checkBoxIgnition, 12, 0);
2050  this->tableLayoutPanelExecutionState->Controls->Add(this->labelExpectedState, 10, 0);
2051  this->tableLayoutPanelExecutionState->Controls->Add(this->labelSeparator3, 9, 0);
2052  this->tableLayoutPanelExecutionState->Controls->Add(this->textBoxVoltageThreshold, 19, 0);
2053  this->tableLayoutPanelExecutionState->Controls->Add(this->labelVoltageThreshold, 18, 0);
2054  this->tableLayoutPanelExecutionState->Controls->Add(this->textBoxPollingTime, 17, 0);
2055  this->tableLayoutPanelExecutionState->Controls->Add(this->labelPollingTime, 16, 0);
2056  this->tableLayoutPanelExecutionState->Controls->Add(this->labelSeparator4, 15, 0);
2057  this->tableLayoutPanelExecutionState->Controls->Add(this->labelSeparator1, 2, 0);
2058  this->tableLayoutPanelExecutionState->Controls->Add(this->labelTimeout, 5, 0);
2059  this->tableLayoutPanelExecutionState->Controls->Add(this->textBoxTimeout, 6, 0);
2060  this->tableLayoutPanelExecutionState->Controls->Add(this->buttonCheckBatteryIgnition, 14, 0);
2061  this->tableLayoutPanelExecutionState->Controls->Add(this->labelIgnitionState, 13, 0);
2062  this->tableLayoutPanelExecutionState->Controls->Add(this->labelSeparator5, 4, 0);
2063  this->tableLayoutPanelExecutionState->Controls->Add(this->labelProcedureExecutionTimes, 3, 0);
2064  this->tableLayoutPanelExecutionState->Dock = System::Windows::Forms::DockStyle::Bottom;
2065  this->tableLayoutPanelExecutionState->Location = System::Drawing::Point(0, 593);
2066  this->tableLayoutPanelExecutionState->Name = L"tableLayoutPanelExecutionState";
2067  this->tableLayoutPanelExecutionState->Padding = System::Windows::Forms::Padding(0, 0, 3, 0);
2068  this->tableLayoutPanelExecutionState->RowCount = 1;
2069  this->tableLayoutPanelExecutionState->RowStyles->Add((gcnew System::Windows::Forms::RowStyle()));
2070  this->tableLayoutPanelExecutionState->Size = System::Drawing::Size(1352, 28);
2071  this->tableLayoutPanelExecutionState->TabIndex = 10;
2072  //
2073  // labelIconProcedureExecutionState
2074  //
2075  this->labelIconProcedureExecutionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"labelIconProcedureExecutionState.Image")));
2076  this->labelIconProcedureExecutionState->Location = System::Drawing::Point(4, 0);
2077  this->labelIconProcedureExecutionState->Margin = System::Windows::Forms::Padding(4, 0, 0, 0);
2078  this->labelIconProcedureExecutionState->Name = L"labelIconProcedureExecutionState";
2079  this->labelIconProcedureExecutionState->Padding = System::Windows::Forms::Padding(0, 6, 0, 0);
2080  this->labelIconProcedureExecutionState->Size = System::Drawing::Size(18, 22);
2081  this->labelIconProcedureExecutionState->TabIndex = 0;
2082  this->labelIconProcedureExecutionState->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
2083  //
2084  // labelBatteryState
2085  //
2086  this->labelBatteryState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"labelBatteryState.Image")));
2087  this->labelBatteryState->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
2088  this->labelBatteryState->Location = System::Drawing::Point(952, 0);
2089  this->labelBatteryState->Name = L"labelBatteryState";
2090  this->labelBatteryState->Padding = System::Windows::Forms::Padding(0, 4, 0, 0);
2091  this->labelBatteryState->Size = System::Drawing::Size(20, 23);
2092  this->labelBatteryState->TabIndex = 9;
2093  //
2094  // labelExpectedState
2095  //
2096  this->labelExpectedState->AutoSize = true;
2097  this->labelExpectedState->Location = System::Drawing::Point(852, 0);
2098  this->labelExpectedState->Name = L"labelExpectedState";
2099  this->labelExpectedState->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
2100  this->labelExpectedState->Size = System::Drawing::Size(94, 20);
2101  this->labelExpectedState->TabIndex = 8;
2102  this->labelExpectedState->Text = L"Expected: BAT on";
2103  //
2104  // labelSeparator3
2105  //
2106  this->labelSeparator3->BackColor = System::Drawing::SystemColors::ControlDark;
2107  this->labelSeparator3->Location = System::Drawing::Point(845, 5);
2108  this->labelSeparator3->Margin = System::Windows::Forms::Padding(3, 5, 3, 0);
2109  this->labelSeparator3->Name = L"labelSeparator3";
2110  this->labelSeparator3->Size = System::Drawing::Size(1, 16);
2111  this->labelSeparator3->TabIndex = 7;
2112  //
2113  // labelSeparator4
2114  //
2115  this->labelSeparator4->BackColor = System::Drawing::SystemColors::ControlDark;
2116  this->labelSeparator4->Location = System::Drawing::Point(1085, 5);
2117  this->labelSeparator4->Margin = System::Windows::Forms::Padding(3, 5, 3, 0);
2118  this->labelSeparator4->Name = L"labelSeparator4";
2119  this->labelSeparator4->Size = System::Drawing::Size(1, 16);
2120  this->labelSeparator4->TabIndex = 12;
2121  //
2122  // labelSeparator1
2123  //
2124  this->labelSeparator1->BackColor = System::Drawing::SystemColors::ControlDark;
2125  this->labelSeparator1->Location = System::Drawing::Point(413, 5);
2126  this->labelSeparator1->Margin = System::Windows::Forms::Padding(3, 5, 3, 0);
2127  this->labelSeparator1->Name = L"labelSeparator1";
2128  this->labelSeparator1->Size = System::Drawing::Size(1, 16);
2129  this->labelSeparator1->TabIndex = 2;
2130  this->labelSeparator1->Visible = false;
2131  //
2132  // buttonCheckBatteryIgnition
2133  //
2134  this->buttonCheckBatteryIgnition->Location = System::Drawing::Point(1055, 3);
2135  this->buttonCheckBatteryIgnition->Name = L"buttonCheckBatteryIgnition";
2136  this->buttonCheckBatteryIgnition->Size = System::Drawing::Size(24, 20);
2137  this->buttonCheckBatteryIgnition->TabIndex = 11;
2138  this->buttonCheckBatteryIgnition->Text = L"...";
2139  this->buttonCheckBatteryIgnition->UseVisualStyleBackColor = true;
2140  this->buttonCheckBatteryIgnition->Click += gcnew System::EventHandler(this, &SampleForm::buttonCheckBatteryIgnition_Click);
2141  //
2142  // labelIgnitionState
2143  //
2144  this->labelIgnitionState->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"labelIgnitionState.Image")));
2145  this->labelIgnitionState->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
2146  this->labelIgnitionState->Location = System::Drawing::Point(1029, 0);
2147  this->labelIgnitionState->Name = L"labelIgnitionState";
2148  this->labelIgnitionState->Padding = System::Windows::Forms::Padding(0, 4, 0, 0);
2149  this->labelIgnitionState->Size = System::Drawing::Size(20, 23);
2150  this->labelIgnitionState->TabIndex = 9;
2151  //
2152  // labelSeparator5
2153  //
2154  this->labelSeparator5->BackColor = System::Drawing::SystemColors::ControlDark;
2155  this->labelSeparator5->Location = System::Drawing::Point(584, 5);
2156  this->labelSeparator5->Margin = System::Windows::Forms::Padding(3, 5, 3, 0);
2157  this->labelSeparator5->Name = L"labelSeparator5";
2158  this->labelSeparator5->Size = System::Drawing::Size(1, 16);
2159  this->labelSeparator5->TabIndex = 5;
2160  //
2161  // labelProcedureExecutionTimes
2162  //
2163  this->labelProcedureExecutionTimes->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
2164  this->labelProcedureExecutionTimes->AutoSize = true;
2165  this->labelProcedureExecutionTimes->Location = System::Drawing::Point(420, 0);
2166  this->labelProcedureExecutionTimes->Name = L"labelProcedureExecutionTimes";
2167  this->labelProcedureExecutionTimes->Padding = System::Windows::Forms::Padding(0, 7, 0, 0);
2168  this->labelProcedureExecutionTimes->Size = System::Drawing::Size(158, 20);
2169  this->labelProcedureExecutionTimes->TabIndex = 3;
2170  this->labelProcedureExecutionTimes->Text = L"main: 00:12 | Procedure1: 01:24";
2171  this->labelProcedureExecutionTimes->Visible = false;
2172  //
2173  // label18
2174  //
2175  this->label18->BackColor = System::Drawing::SystemColors::ControlDark;
2176  this->label18->Dock = System::Windows::Forms::DockStyle::Bottom;
2177  this->label18->Location = System::Drawing::Point(0, 592);
2178  this->label18->Name = L"label18";
2179  this->label18->Size = System::Drawing::Size(1352, 1);
2180  this->label18->TabIndex = 0;
2181  //
2182  // updateGuiTimer
2183  //
2184  this->updateGuiTimer->Interval = 500;
2185  this->updateGuiTimer->Tick += gcnew System::EventHandler(this, &SampleForm::updateGuiTimer_Tick);
2186  //
2187  // SampleForm
2188  //
2189  this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
2190  this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
2191  this->BackColor = System::Drawing::SystemColors::Window;
2192  this->ClientSize = System::Drawing::Size(1352, 621);
2193  this->Controls->Add(this->label18);
2194  this->Controls->Add(this->tableLayoutPanelExecutionState);
2195  this->Controls->Add(this->splitContainer4);
2196  this->DoubleBuffered = true;
2197  this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
2198  this->MinimumSize = System::Drawing::Size(1260, 660);
2199  this->Name = L"SampleForm";
2200  this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &SampleForm::SampleForm_FormClosing);
2201  this->Load += gcnew System::EventHandler(this, &SampleForm::SampleForm_Load);
2202  this->Shown += gcnew System::EventHandler(this, &SampleForm::SampleForm_Shown);
2203  this->panel1->ResumeLayout(false);
2204  this->panel1->PerformLayout();
2205  this->panel2->ResumeLayout(false);
2206  this->panel2->PerformLayout();
2207  this->splitContainer1->Panel1->ResumeLayout(false);
2208  this->splitContainer1->Panel1->PerformLayout();
2209  this->splitContainer1->Panel2->ResumeLayout(false);
2210  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer1))->EndInit();
2211  this->splitContainer1->ResumeLayout(false);
2212  this->splitContainer5->Panel1->ResumeLayout(false);
2213  this->splitContainer5->Panel2->ResumeLayout(false);
2214  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer5))->EndInit();
2215  this->splitContainer5->ResumeLayout(false);
2216  this->splitContainer2->Panel1->ResumeLayout(false);
2217  this->splitContainer2->Panel1->PerformLayout();
2218  this->splitContainer2->Panel2->ResumeLayout(false);
2219  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer2))->EndInit();
2220  this->splitContainer2->ResumeLayout(false);
2221  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewParameter))->EndInit();
2222  this->splitContainer3->Panel1->ResumeLayout(false);
2223  this->splitContainer3->Panel1->PerformLayout();
2224  this->splitContainer3->Panel2->ResumeLayout(false);
2225  this->splitContainer3->Panel2->PerformLayout();
2226  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer3))->EndInit();
2227  this->splitContainer3->ResumeLayout(false);
2228  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewContext))->EndInit();
2229  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewState))->EndInit();
2230  this->panel3->ResumeLayout(false);
2231  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->gridViewSettings))->EndInit();
2232  this->panel4->ResumeLayout(false);
2233  this->panel4->PerformLayout();
2234  this->groupBox1->ResumeLayout(false);
2235  this->groupBox1->PerformLayout();
2236  this->splitContainer4->Panel1->ResumeLayout(false);
2237  this->splitContainer4->Panel2->ResumeLayout(false);
2238  (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->splitContainer4))->EndInit();
2239  this->splitContainer4->ResumeLayout(false);
2240  this->tableLayoutPanelExecutionState->ResumeLayout(false);
2241  this->tableLayoutPanelExecutionState->PerformLayout();
2242  this->ResumeLayout(false);
2243 
2244  }
2245 #pragma endregion
2246  private: System::Void textBoxTraceFileMaxSize_TextChanged(System::Object^ sender, System::EventArgs^ e);
2247  private: System::Void textBoxTraceFileMaxCount_TextChanged(System::Object^ sender, System::EventArgs^ e);
2248  private: System::Void buttonOpenTraceFolder_Click(System::Object^ sender, System::EventArgs^ e);
2249  private: System::Void textBoxRuntimeContextName_TextChanged(System::Object^ sender, System::EventArgs^ e);
2250  private: System::Void textBoxPortPipe_TextChanged(System::Object^ sender, System::EventArgs^ e);
2251  private: System::Void comboBoxIpcType_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2252  private: System::Void buttonBrowseTraceFolder_Click(System::Object^ sender, System::EventArgs^ e);
2253  private: System::Void textBoxTraceFolder_TextChanged(System::Object^ sender, System::EventArgs^ e);
2254  private: System::Void comboBoxTraceLevel_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e);
2255  private: System::Void comboBoxTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2256  private: System::Void buttonReload_Click(System::Object^ sender, System::EventArgs^ e);
2257  private: System::Void txtPassword_TextChanged(System::Object^ sender, System::EventArgs^ e);
2258  private: System::Void buttonBrowseFile_Click(System::Object^ sender, System::EventArgs^ e);
2259  private: System::Void cbFilePath_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2260  private: System::Void cbFilePath_TextChanged(System::Object^ sender, System::EventArgs^ e);
2261  private: System::Void textBoxTimeout_TextChanged(System::Object^ sender, System::EventArgs^ e);
2262  private: System::Void textBoxBatteryVoltageThreshold_TextChanged(System::Object^ sender, System::EventArgs^ e);
2263  private: System::Void textBoxPollingTime_TextChanged(System::Object^ sender, System::EventArgs^ e);
2264  private: System::Void CheckBoxKL15_CheckStateChanged(System::Object^ sender, System::EventArgs^ e);
2265  private: System::Void checkBoxUseConnectionState_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2266  private: System::Void buttonLicense_Click(System::Object^ sender, System::EventArgs^ e);
2267  private: System::Void buttonStartStopWebServer_Click(System::Object^ sender, System::EventArgs^ e);
2268  private: System::Void buttonHmi_Click(System::Object^ sender, System::EventArgs^ e);
2269  private: System::Void checkBoxNewRuntimeManager_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2270  private: System::Void checkBoxCyclicReload_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2271  private: System::Void listBoxOuput_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e);
2272  private: System::Void buttonCopyRow_Click(System::Object^ sender, System::EventArgs^ e);
2273  private: System::Void buttonClearOutput_Click(System::Object^ sender, System::EventArgs^ e);
2274  private: System::Void buttonNewInstanceNewThread_Click(System::Object^ sender, System::EventArgs^ e);
2275  private: System::Void buttonNewInstance_Click(System::Object^ sender, System::EventArgs^ e);
2276  private: System::Void checkBoxAdd2Output_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2277  private: System::Void checkBoxCyclicExecution_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2278  private: System::Void checkBoxAsyncExecution_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2279  private: System::Void buttonPause_Click(System::Object^ sender, System::EventArgs^ e);
2280  private: System::Void buttonStop_Click(System::Object^ sender, System::EventArgs^ e);
2281  private: System::Void buttonExecuteMain_Click(System::Object^ sender, System::EventArgs^ e);
2282  private: System::Void buttonExecuteSelectedProcedure_Click(System::Object^ sender, System::EventArgs^ e);
2283  private: System::Void buttonWriteSettings_Click(System::Object^ sender, System::EventArgs^ e);
2284  private: System::Void buttonReadSettings_Click(System::Object^ sender, System::EventArgs^ e);
2285  private: System::Void radioButtonCustomImpl_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2286  private: System::Void buttonCheckBatteryIgnition_Click(System::Object^ sender, System::EventArgs^ e);
2287  private: System::Void treeViewOtxProject_DrawNode(System::Object^ sender, System::Windows::Forms::DrawTreeNodeEventArgs^ e);
2288  private: System::Void treeViewOtxProject_AfterSelect(System::Object^ sender, System::Windows::Forms::TreeViewEventArgs^ e);
2289  private: System::Void gridView_CellValueChanged(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e);
2290  private: System::Void gridView_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e);
2291  private: System::Void gridViewParameter_CellValidated(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e);
2292  private: System::Void gridViewParameter_CellValidating(System::Object^ sender, System::Windows::Forms::DataGridViewCellValidatingEventArgs^ e);
2293  private: System::Void gridViewContextVariable_CellValidated(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e);
2294  private: System::Void gridViewContextVariable_CellValidating(System::Object^ sender, System::Windows::Forms::DataGridViewCellValidatingEventArgs^ e);
2295  private: System::Void updateGuiTimer_Tick(System::Object^ sender, System::EventArgs^ e);
2296  private: System::Void SampleForm_Load(System::Object^ sender, System::EventArgs^ e);
2297  private: System::Void SampleForm_Shown(System::Object^ sender, System::EventArgs^ e);
2298  private: System::Void SampleForm_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e);
2299  private: void WebServerTimer_Tick(System::Object^ sender, System::EventArgs^ e);
2300  void HmiWindow_SizeChanged(System::Object^ sender, System::EventArgs^ e);
2301  void HmiWindow_Activated(System::Object^ sender, System::EventArgs^ e);
2302  private: System::Void comboBoxODXProject_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2303  private: System::Void comboBoxODXVehicle_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2304  private: System::Void comboBoxDiagIpcType_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2305  private: System::Void checkBoxIncludedDiagLogging_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2306  private: System::Void buttonOpenDiagLoggingTraceFolder_Click(System::Object^ sender, System::EventArgs^ e);
2307  private: System::Void buttonBrowseDiagLoggingTraceFolder_Click(System::Object^ sender, System::EventArgs^ e);
2308  private: System::Void textBoxDiagManagerLicenseKey_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e);
2309  private: System::Void textBoxDiagManagerLicenseKey_TextChanged(System::Object^ sender, System::EventArgs^ e);
2310  private: System::Void comboBoxDiagManagerTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2311  private: System::Void comboBoxDiagLoggingTraceLevel_SelectedValueChanged(System::Object^ sender, System::EventArgs^ e);
2312  private: System::Void textBoxDiagManagerTraceFolder_TextChanged(System::Object^ sender, System::EventArgs^ e);
2313  private: void SystemEvents_DisplaySettingsChanged(System::Object^ sender, System::EventArgs^ e);
2314  private: System::Void checkBoxProfiling_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
2315  private: System::Void textBoxProfilingSize_TextChanged(System::Object^ sender, System::EventArgs^ e);
2316 };
2317 }}}}}
Contains information of a Runner instance.
Definition: IRuntimeContext.h:30
Namespace containing the programming interface for browsing and execution of OTX procedures in own ap...
Definition: ClampState.h:7
Namespace containing all objects related to testing inside automotive industry