在Powershell GUI中创建EventArguments

编程入门 行业动态 更新时间:2024-10-20 07:48:46
本文介绍了在Powershell GUI中创建EventArguments的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近在vb中创建了一个应用程序,我已经开始在powershell中重新创建它。我已经创建了from布局并开始处理按钮操作并且我正在运行到路障中,下面是我在vb中创建的子,我需要弄清楚如何创建e As Qios.DevSuite.Components.QCompositeEventArgs

I recently created an application in vb and I have started recreating it in powershell. I have created the from layout and started working on the button actions and Im running into a road block, below is the sub I created in vb and I need to figure out how to create "e As Qios.DevSuite.Components.QCompositeEventArgs"

Private Sub QCompositeControl2_ItemActivated(sender As Object, e As Qios.DevSuite.Components.QCompositeEventArgs) Handles qcItems.ItemActivated MsgBox(e.Item.ItemName.ToString) End Sub

如何在powershell中创建事件参数?

How do I go about creating Event Arguments in powershell?

推荐答案

在您的示例中,没有任何内容可以创建事件参数。通常它是在声明某个事件的类中完成的,当你调用事件时(.NET允许仅在类中声明事件而不在其他地方声明相应的事件实例),但是如果你只能在PowerShell中创建真正的.NET类插入C#或VB.NET代码,所以我不知道你为什么需要在PowerShell脚本中创建事件参数。好的,我会给你一个想法。 首先,您需要加载此库(Qios或其他)。我不知道是什么,所以我会告诉你样本加载 System.Windows.Forms : In your sample, nothing creates event arguments. Usually it is done in the class declaring some event, when you invoke the event (.NET allows to invoke events only in the classes declaring corresponding event instance nowhere else), but you can only create "real" .NET classes in PowerShell if you insert C# or VB.NET code, so I have no idea why would you need creation of event arguments in your PowerShell scrip. Okay, I'll give you the idea. First of all, you will need to load this library (Qios or whatever). I don't know what is is, so I'll show you the sample loading System.Windows.Forms:

null = [System.Reflection.Assembly] :: LoadWithPartialName( System.Windows.Forms)

要隐藏控制台输出,

To hide console output,

null 。 在GAC注册的程序集的部分名称应该来代替System.Windows.Forms。如果您的库只是一个文件,您可以使用 [System.Reflection.Assembly] :: LoadFrom 加载if: msdn.microsoft/en-us/library/1009fa28%28v=vs .110%29.aspx [ ^ ], msdn.microsoft/en-us/library/system.reflection.assembly%28v=vs.110%29.aspx [ ^ ] (请继续阅读本课程)。 从程序集创建对象,例如 Qios.DevSuite.Components.QCompositeEventArgs ,你做的事情如下: null is used. The partial name of your assembly registered in GAC should come instead of "System.Windows.Forms". If your library is just a file, you can load if with [System.Reflection.Assembly]::LoadFrom: msdn.microsoft/en-us/library/1009fa28%28v=vs.110%29.aspx[^], msdn.microsoft/en-us/library/system.reflection.assembly%28v=vs.110%29.aspx[^] (read on using this class). To create an object from your assembly, such as Qios.DevSuite.Components.QCompositeEventArgs, you do something like:

更多推荐

在Powershell GUI中创建EventArguments

本文发布于:2023-11-24 04:33:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Powershell   GUI   EventArguments

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!