Product, version and build: PowerShell Studio 2015 4.2.89
32 or 64 bit version of product: 64 bit
Operating system: Windows 10
32 or 64 bit OS: 64 bit
PowerShell Version: 5
I've created a class which contains the properties and methods that I want to use in form.
Can you please advise how I import my class so that I call the methods and get/set the properties from the form?
Thanks
Importing Custom Classes
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Importing Custom Classes
Before I help I have a follow-up question to clarify what exactly you're asking.
Are you wanting to know how to import the class object just for the form or were you wanting to see it in PrimalSense?
Are you wanting to know how to import the class object just for the form or were you wanting to see it in PrimalSense?
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Importing Custom Classes
I'm using PowerShell Studio.
I want to be able to access it from code file behind the form so I can write some front end specific logic into the form code file.
With Visual Studio I'd add the class to the project and put in a using statement in form's code file.
Not sure how to do here.
I want to be able to access it from code file behind the form so I can write some front end specific logic into the form code file.
With Visual Studio I'd add the class to the project and put in a using statement in form's code file.
Not sure how to do here.
Re: Importing Custom Classes
[TOPIC MOVED TO WINDOWS POWERSHELL FORUM BY MODERATOR]
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Importing Custom Classes
In that case, this is a general PowerShell question as opposed to a product specific question and so I've moved the topic to the Windows PowerShell forum.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Importing Custom Classes
We do not add classes to projects. You can place your class in a PS1 file and dot source it. It will be available. JUst use it as you would in PowerShell.
PowerShell Forms do not use "Code Behind" that requires a compiler. The code in a PS form i just a bunch of snippets assigned to events or stored within the form function.
You can also just paste your class into the editor as if it was a function.
If a project paste the class in the globals file.
PowerShell Forms do not use "Code Behind" that requires a compiler. The code in a PS form i just a bunch of snippets assigned to events or stored within the form function.
You can also just paste your class into the editor as if it was a function.
If a project paste the class in the globals file.
Re: Importing Custom Classes
Her is an example of using a class in a form:
- Attachments
-
- Test-Class.psf
- (22.77 KiB) Downloaded 149 times