AnsweredAssumed Answered

iedmfile5.refresh and iedmfolder5.refresh not working

Question asked by Pichaiyan Prabaharan on Dec 2, 2020

Hi All,

 

I tried to refresh the file or folder after I change state. But its not working. Anybody have idea to do this?

 

Imports EdmLib
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

'Create GUI &Main Class
<Guid("A849A492-C192-4DBF-9B17-7007BE7C6782")>
<ComVisible(True)>
Public Class Rev_Up_Main
    Implements IEdmAddIn5

    Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, poVault As IEdmVault5, poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

        'Basic Names of an Addin
        poInfo.mbsAddInName = "Revision Update"
        poInfo.mbsCompany = "Test"
        poInfo.mbsDescription = "PDM Rev Integration Addin"
        poInfo.mlAddInVersion = 1
        poInfo.mlRequiredVersionMajor = 6
        poInfo.mlRequiredVersionMinor = 4

        'Get Card Button's Click  (Adding Hook)
        poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardButton)  ' Card button click
        poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreState)    ' Change State

        'Addin Settings

        poCmdMgr.AddCmd(1, "Test Addin")

    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As Array) Implements IEdmAddIn5.OnCmd

        Dim strVaultName As String = poCmd.mpoVault.Name

        Select Case poCmd.meCmdType

            Case EdmCmdType.EdmCmd_CardButton
                If poCmd.mbsComment = "Rev_Up" Then


                    For Each AffectedFile As EdmCmdData In ppoData

                        Dim btnVault As IEdmVault16 = TryCast(poCmd.mpoVault, IEdmVault16)
                        Dim btnFile As IEdmFile5
Dim folder As IEdmFolder10 = btnVault.GetObject(EdmObjectType.EdmObject_Folder, AffectedFile.mlObjectID2)
                        Dim btnCurrentStateName As String = "INWORK"
                        Dim btnDestStateName As String = "Revision Up"

                        btnFile = btnVault.GetFileFromPath(AffectedFile.mbsStrData2)
                        Dim filePath As String = AffectedFile.mbsStrData2.ToString
                        Dim directoryPath As String = System.IO.Path.GetDirectoryName(filePath)

                        If Not btnFile.IsLocked Then

                            Try
                                btnFile.ChangeState(btnDestStateName, AffectedFile.mlObjectID2, "RevUp", 0, 0)
                                btnVault.RefreshFolder(directoryPath)
btnFile.refresh()
folder.Refresh()
                            Catch ex As Exception
                                MessageBox.Show(ex.Message)
                           End Try

                        End If
                    Next
                End If
        End Select
    End Sub

End Class


 

Thanks

Outcomes