在Powershell GUI中创建EventArguments [英] Creating EventArguments in Powershell GUI

查看:82
本文介绍了在Powershell GUI中创建EventArguments的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



I recently created an application in vb.net 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.net 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



要隐藏控制台输出,<$ c使用$ c>


To hide console output,


null



在GAC注册的程序集的部分名称应该来代替System.Windows.Forms。如果您的库只是一个文件,您可以使用 [System.Reflection.Assembly] :: LoadFrom 加载if:

http://msdn.microsoft.com/en-us/library/1009fa28%28v=vs .110%29.aspx [ ^ ],

http://msdn.microsoft.com/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:
http://msdn.microsoft.com/en-us/library/1009fa28%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆