- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 IEdmEnumeratorVariable5::SetVar
根据用户输入更新一些文件卡变量到 Windows 窗体。我的代码执行,没有错误消息,文件被 checkout 并重新 checkin ,并在历史记录中添加了适当的注释;但是卡上的变量没有更新。
我通过在运行时单步执行代码来验证所有变量都填充了正确的(如预期的)数据。 SetVar
程序都顺利进行,但数据卡上的变量不会改变值 - 即使手动刷新文件夹 View 也没有效果。
下面是我的代码。
这是一个加载项应用程序,使用 VS Community 2015 在 VB 中编写为类库项目,目标框架为 .NET 4.0。
努力使这个问题更简洁;下面我只包含了执行设置变量工作的代码片段,然后我还包含了更多代码,以便您可以在需要时获得整个画面。
只是冰山一角 :
这是设置变量工作的代码:
Dim UserManager As IEdmUserMgr5 = .SourceVault
Dim User As IEdmUser5 = UserManager.GetLoggedInUser
CardComment = UserComment & CardComment
CardDate = Today().ToString("yyMMdd", Globalization.CultureInfo.InvariantCulture)
CardBy = User.Name
CardDisposition = UserDisposition
CardVariables.SetVar(DispositionVariable, "@", CardDisposition)
CardVariables.SetVar(CommentVariable, "@", CardComment)
CardVariables.SetVar(ByVariable, "@", CardBy)
CardVariables.SetVar(DateVariable, "@", CardDate)
CardVariables.Flush()
Private Structure CommandInfo
Dim SourceVault As IEdmVault11
Dim SourceCommand As EdmCmd
Dim SourceSelection As System.Array
Dim TargetTemplate As System.String
Dim VerifiedPaths As List(Of String)
End Structure
Private ReceivedCommand As CommandInfo
Public Sub OnCmd(ByRef poCmd As EdmCmd,
ByRef ppoData As System.Array) Implements IEdmAddIn5.OnCmd
Dim CommandToRun As MenuCommand
Try
With ReceivedCommand
.SourceVault = poCmd.mpoVault
.SourceCommand = poCmd
.SourceSelection = ppoData
'Get the command structure for the command ID
Select Case poCmd.meCmdType
Case EdmCmdType.EdmCmd_Menu
CommandToRun = AvailableCommands(.SourceCommand.mlCmdID)
Case EdmCmdType.EdmCmd_CardButton
Select Case True
Case poCmd.mbsComment.ToString.ToUpper.Contains("DISPOSITION")
DispositionRequest()
Case Else : Exit Sub
End Select
Case Else : Exit Sub
End Select
'...... (End Try, End Sub, Etc.)
Private Sub DispositionRequest()
Dim UserDisposition As String
Using Disposition As New DispositionForm
With Disposition
If Not .ShowDialog() = System.Windows.Forms.DialogResult.OK Then Exit Sub
Select Case True
Case .Approve.Checked
UserDisposition = "Approved"
Case .Reject.Checked
UserDisposition = "Rejected"
Case Else : Exit Sub
End Select
End With
End Using
Dim UserComment As String
Using Explanation As New DispositionExplanation
With Explanation
If Not .ShowDialog() = System.Windows.Forms.DialogResult.OK Then Exit Sub
If .ListView1.Items.Count > 0 Then
'do some stuff not relevant to this question...
End If
UserComment = .Comments.Text
End With
End Using
'This next procedure just gets a list of paths from ReceivedCommand.SourceSelection - which is just the ppoData argument from the OnCmd procedure - see code block above!
Dim RequestPaths As List(Of String) = GetSelectedFilePaths()
For Each Path As String In RequestPaths
With ReceivedCommand
Dim RequestFile As IEdmFile5 = .SourceVault.GetFileFromPath(Path)
Dim ParentFolder As IEdmFolder6 = .SourceVault.GetFolderFromPath(System.IO.Path.GetDirectoryName(Path))
Dim UnlockLater As Boolean = False
If Not RequestFile.IsLocked Then
UnlockLater = True
RequestFile.LockFile(ParentFolder.ID, .SourceCommand.mlParentWnd, CInt(EdmLockFlag.EdmLock_Simple))
End If
Dim CardVariables As IEdmEnumeratorVariable5 = RequestFile.GetEnumeratorVariable
'We allow users to re-disposition a request so we want to keep any previous disposition information so it is not lost
Dim CardComment As String = String.Empty
Dim CardBy As String = String.Empty
Dim CardDate As String = String.Empty
Dim CardDisposition As String = String.Empty
Dim Success As Boolean
Const CommentVariable As String = "DispComm"
Const ByVariable As String = "DisposedBy"
Const DateVariable As String = "DisposedDate"
Const DispositionVariable As String = "Disposition"
Success = CardVariables.GetVar(DispositionVariable, "@", CardDisposition)
If Success Then
Success = CardVariables.GetVar(CommentVariable, "@", CardComment)
If Success Then Success = CardVariables.GetVar(ByVariable, "@", CardBy)
If Success Then Success = CardVariables.GetVar(DateVariable, "@", CardDate)
If Success Then CardComment = "Previously dispositioned as: """ & CardDisposition & """ by: " & CardBy & " on: " & CardDate & vbNewLine &
"---------Previous disposition explanation---------" & vbNewLine & CardComment
End If
Dim UserManager As IEdmUserMgr5 = .SourceVault
Dim User As IEdmUser5 = UserManager.GetLoggedInUser
CardComment = UserComment & CardComment
CardDate = Today().ToString("yyMMdd", Globalization.CultureInfo.InvariantCulture)
CardBy = User.Name
CardDisposition = UserDisposition
CardVariables.SetVar(DispositionVariable, "@", CardDisposition)
CardVariables.SetVar(CommentVariable, "@", CardComment)
CardVariables.SetVar(ByVariable, "@", CardBy)
CardVariables.SetVar(DateVariable, "@", CardDate)
CardVariables.Flush()
If UnlockLater Then RequestFile.UnlockFile(lParentWnd:= .SourceCommand.mlParentWnd,
bsComment:="Dispositioned as " & CardDisposition,
lEdmUnlockFlags:=0)
.SourceVault.RefreshFolder(ParentFolder.LocalPath)
End With
Next
End Sub
最佳答案
来自 the documentation :
bsCfgName : Name of configuration or layout to which to store the variable value; empty string for folders and file types that do not support configurations
"@"
更改为至
String.Empty
对于 mboconfiguration 参数,现在它正在工作!
CardVariables.SetVar(DispositionVariable, String.Empty, CardDisposition)
CardVariables.SetVar(CommentVariable, String.Empty, CardComment)
CardVariables.SetVar(ByVariable, String.Empty, CardBy)
CardVariables.SetVar(DateVariable, String.Empty, CardDate)
CardVariables.Flush()
关于vb.net - Solidworks EPDM API IEdmEnumeratorVariable5::SetVar 未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32271467/
我使用以下方式调用几个sql文件: :r C:\Scripts\Script1.sql :r C:\Scripts\Script2.sql :r C:\Scripts\Script3.sql 我对 :
当运行 SQLCMD.exe 并为脚本变量提供命令行参数时,我希望命令行上提供的值将覆盖 SQL 脚本文件中定义的值。 例如 给定以下 SQL 脚本: :setvar XXX "SQL script"
我正在尝试在 T-SQL 中创建一些脚本变量,如下所示: /* Deployment script for MesProduction_Preloaded_KLM_MesSap
我正在使用 SQLCMD 模式。我想设置 setvar 变量值。我应该如何设置 :setvar 中的值?我的代码如下所示: DECLARE @DatabaseName AS nvarchar(180)
我正在尝试使用 IEdmEnumeratorVariable5::SetVar 根据用户输入更新一些文件卡变量到 Windows 窗体。我的代码执行,没有错误消息,文件被 checkout 并重新 c
首先,我不是 DBA 并且我没有任何 SQL Server 的(管理员)经验,所以请在回答时使用少音节的词... 我正在运行 SQL Server 2008 R2 并尝试编写一个概念验证脚本来设置非分
我是一名优秀的程序员,十分优秀!