How to Get Sample ManualStation Custom Code to Work?
Issue
After installing eFlow (default paths), we can find the sample custom codes for ManualStation at "C:\Program Files (x86)\TIS\eFlow 6\Customization Samples\Manual Station".
Note: If it is eFlow 5 then it is similar path, instead of eFlow 6, it is eFlow 5.
However it could not work.
Cause
The sample is using an old XtraBars package, outdated app.config so it requires some settings to be done. It also depends on the version especially if there has been some STS related changes.
Solution
1) Set x86 CPU for the solution at Configuration Manager
2) Update your app.config
- Get your current eFlow version for the DataEntry.exe.config.
- Copy the content to replace the app.config but retain the last 4 entries related to the xBar.
- Set the .Net Framework version accordingly from your Visual Studio and where it is compatible with your eFlow version.
If you are using eFlow 6.0.2.1 (dll version 6.0.2.93) or 6.0.3 (dll version 6.0.3.73) or higher version, there were changes to STS approach so custom codes need to be sync up to align. Therefore other than the above 2 steps, you will need to do a few more changes at the Custom Codes. Please see below summary.
3a) Add the followings to your MainForm.cs (at the "using section" at the top of the codes):
//For new STS Approach: Needed for the new methods, etc. using TiS.Core.TisCommon.Security; using TiS.Core.Application.Security;
3b) Set the AppName and as class variable so that they will be available in all methods within the class - aka "public" to all the methods.
3c) Add the new Method as shown in the screen shot below.
Here is the snippet codes for your convenience:
//For new STS Approach: New ValidateStationWritePermission Method needed: This is to get the application role to check whether you have the permission to use it. private void ValidateStationWritePermission(string sApp, string sStation) { if (!string.IsNullOrEmpty(sStation)) { var stationPermissionValidator = ((TisApplicationServices)m_oCSM.ApplicationServices[sApp]).GetStationPermissionValidator(sStation); if (stationPermissionValidator.Validate(PermissionsConst.TIS_PERMISSION_WRITE)) { StationPermission.HasWritePermission = true; } } }
3d) At the m_oGetCollectionsBarItem_ItemClick method, add the highlighted line of code to validate the station Write Permission. Your credential used to launch the station should be given the role that has the write permission.
3e) Get the AppName, StationName, check the station name is not empty. Add your MessageBox prompt if you want to debug your codes so that you could in time to have the pause and you could attach the launched process to debug at Visual Studio. Please refer to screen shot below.
Here is the snippet codes for the call to check that the station name
//For new STS Approach: Validate that station name was specified so as to use it later in the new method. if (!StringUtil.IsStringInitialized(sStationName)) { DisplayErrorNoOwner("Station name must be provided"); return; }
Final Result:
You should be able to launch the station successfully - refer to below screen shot for virtualization of the station launch.
Level of Complexity
Moderate
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
eFlow |
6.0.2.72 or earlier New STS Approach: |
References
N.A.