Update_A_Dynamo_By_Name Method Example

The following code provides an example of the Update_A_Dynamo_By_Name method. This example is similar to the one that appears in the Update_A_Dynamo_By_Ref Method Example.

Public Function UpdateADynamo(DynamoInstanceFullyQualifiedName As String, MasterDynamoFullyQualifiedName As String, ByRef strReturnMsg) As UpdateDynamoResult

    Dim iDataSourceOption As DynamoDataSourceOption

    Dim iResult As Long 'UpdateDynamoResult

    Dim iPrompt As Long

    

    iDataSourceOption = g_WizardConfig.iDataSourceOption

    If g_WizardConfig.iDataSourceOption = DYNAMO_PROMPT_FOR_CHOICE Then

        If g_ReturnFromPromptForChoice = PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_ALL Then

            iDataSourceOption = DYNAMO_UPDATE_BUT_NOT_APPLY

        ElseIf g_ReturnFromPromptForChoice = PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APPLY_TO_ALL Then

            iDataSourceOption = DYNAMO_UPDATE_AND_APPLY

        ElseIf g_ReturnFromPromptForChoice = PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_ALL Then

            iDataSourceOption = DYNAMO_NOT_UPDATE

        End If

    End If

        

'////// actual update call

    ' call Update A Dynamo

    PlugandSolve.GeometryHelperObj.Update_A_Dynamo_By_Name MasterDynamoFullyQualifiedName, DynamoInstanceFullyQualifiedName, iDataSourceOption, mobjStrMgr.GetNLSStr(4069), iResult

    ' get a result string

    strReturnMsg = PlugandSolve.GeometryHelperObj.Get_Last_Result_String

    ' get the last user choice from the prompt

    If (g_WizardConfig.iDataSourceOption = DYNAMO_PROMPT_FOR_CHOICE) And _

        (g_ReturnFromPromptForChoice = PROMPT_DLG_SEL_NONE) Then

        iPrompt = PlugandSolve.GeometryHelperObj.Get_Last_Prompt_Value

        If (iPrompt = PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_ALL) Or _

            (iPrompt = PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APPLY_TO_ALL) Or _

            (iPrompt = PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_ALL) Then

            g_ReturnFromPromptForChoice = iPrompt

        End If

    End If

'////// end of actual update call

'////// dummy for test

'    g_testcount = g_testcount + 1

'    If g_testcount = 3 Then

'        strReturnMsg = ">>>" & DynamoInstanceFullyQualifiedName & " was not updated  with " & MasterDynamoFullyQualifiedName

'        iResult = DYNAMO_NOTUPDATED

'    ElseIf g_testcount = 150 Then

'        strReturnMsg = ">>> User canceled"

'        iResult = DYNAMO_UPDATE_ABORTED

'    Else

'        strReturnMsg = DynamoInstanceFullyQualifiedName  & " was updated successfully with " & MasterDynamoFullyQualifiedName

'        iResult = DYNAMO_UPDATED

'    End If

'////// end of dummy for test

    

    If iResult <= DYNAMO_UPDATED Then

        UpdateADynamo = DYNAMO_UPDATED

    ElseIf iResult <= DYNAMO_NOTUPDATED Then

        UpdateADynamo = DYNAMO_NOTUPDATED

    Else

        UpdateADynamo = DYNAMO_UPDATE_ABORTED

    End If

End Function