IReplicaProgress Example

来源:互联网 发布:淘宝1元抢拍 编辑:程序博客网 时间:2024/06/11 02:41
[Visual Basic 6.0]

The following demonstrates how to use the IReplicaProgress interface during a check out,

extract or check in operation. Messages are printed to the immediate window in response

to events. This information can be used to monitor the check out, extract or check in

process.

 

To use the sample, add the code below to Visual Basic or VBA and write a routine to

perform a check out, check in or extract. In the routine, set m_pRepProgress equal to

the checkout, checkin or DataExtraction component (QI).

 
Private WithEvents m_pRepProgress As ReplicaProgress
 
' Checks out with eventsPrivate Sub CO_WithProgress(pRepDesc As IReplicaDescription, bolRelated As Boolean, strName As String)  Dim pCheckOut As ICheckOut    Set pCheckOut = New CheckOut  Set m_pRepProgress = pCheckOut ' Wire up the event  pCheckOut.CheckOutData pRepDesc, bolRelated, strNameEnd Sub
 
' Extracts with progress eventsPrivate Sub Extract_WithProgress(pRepDesc As IReplicaDescription, bolRelated As Boolean)  Dim pExtract As IDataExtraction    Set pExtract = New DataExtraction  Set m_pRepProgress = pExtract ' Wire up the event  pExtract.Extract pRepDesc, bolRelatedEnd Sub
 
' Checks in with progress eventsPrivate Sub CI_WithProgress(pWkSpName As IWorkspaceName, strName As String, pCoWkSpName As IWorkspaceName, bolRec As Boolean)  Dim pCheckIn As IcheckIn    Set pCheckIn = New CheckIn  Set m_pRepProgress = pCheckIn ' Wire up the event  pCheckIn.CheckInFromGDB pWkSpName, strName, pCoWkSpName, bolRec, False  End Sub
 
'  Replica Progress routinesPrivate Property Let m_pRepProgress_CurrentReplicaOperation(ByVal RHS As esriGeoDatabaseDistributed.esriReplicaProgress)  ' Print the operation in the immediate window  Dim strStep As String    strStep = GetProgressStep(RHS)  Debug.Print "Current operation is: " & strStep  End Property
 
Private Property Let m_pRepProgress_ReplicaObjectCount(ByVal RHS As Long)    Debug.Print "Number of objects is: " & RHSEnd Property
 
Private Property Let m_pRepProgress_ReplicaOperations(ByVal RHS As Long)  Debug.Print "The following operations will be performed (listed in order):"    If (RHS And esriRPExtractSchema) > 0 Then Debug.Print "Extracting Schema"  If (RHS And esriRPExtractData) > 0 Then Debug.Print "Extracting data"  If (RHS And esriRPExtractSchemaAndData) > 0 Then Debug.Print "Extracting schema and data"  If (RHS And esriRPFetchRelatedObjects) > 0 Then Debug.Print "Fetching related objects"  If (RHS And esriRPFetchRelatedNObjects) > 0 Then Debug.Print "Fetching network related objects"  If (RHS And esriRPBuildGeometricNetworks) > 0 Then Debug.Print "Building geometric networks"  If (RHS And esriRPFetchTopologyObjects) > 0 Then Debug.Print "Fetching topology objects"  If (RHS And esriRPRegisteringCheckOut) > 0 Then Debug.Print "Registering checkout"  If (RHS And esriRPCreateCOVersions) > 0 Then Debug.Print "Creating checkout versions"  If (RHS And esriRPTransferChanges) > 0 Then Debug.Print "Transfering changes"  If (RHS And esriRPUpdateRelatedObjects) > 0 Then Debug.Print "Updating related objects"  If (RHS And esriRPRebuildCIConnectivity) > 0 Then Debug.Print "Rebuilding checkin con"  If (RHS And esriRPReconcileWithParent) > 0 Then Debug.Print "Reconciling with parent"  If (RHS And esriRPUnregisteringCheckOut) > 0 Then Debug.Print "Unregistering the checkout"  If (RHS And esriRPCreatingCheckOut) > 0 Then Debug.Print "Creating checkout"  If (RHS And esriRPSynchronizingCheckOut) > 0 Then Debug.Print "Synchronizing the checkout"End Property
 
Private Sub m_pRepProgress_Startup(ByVal rProgress As esriGeoDatabaseDistributed.esriReplicaProgress)      Dim strStep As String  strStep = GetProgressStep(rProgress)  Debug.Print "Startup operation is: " & strStep    End Sub
 
Private Function GetProgressStep(ByVal rProgress As esriGeoDatabaseDistributed.esriReplicaProgress) As String ' Return the operation  Select Case rProgress    Case esriRPExtractSchema      GetProgressStep = "Extracting Schema"    Case esriRPExtractData      GetProgressStep = "Extracting data"    Case esriRPExtractSchemaAndData      GetProgressStep = "Extracting Schema and data"    Case esriRPFetchRelatedObjects      GetProgressStep = "Fetching related objects"    Case esriRPFetchRelatedNObjects      GetProgressStep = "Fetching network related objects"    Case esriRPBuildGeometricNetworks      GetProgressStep = "Building geometric networks"    Case esriRPFetchTopologyObjects      GetProgressStep = "Fetching topology objects"    Case esriRPRegisteringCheckOut      GetProgressStep = "Registering checkout"    Case esriRPCreateCOVersions      GetProgressStep = "Creating checkout versions"    Case esriRPTransferChanges      GetProgressStep = "Transfering changes"    Case esriRPUpdateRelatedObjects      GetProgressStep = "Updating related objects"    Case esriRPRebuildCIConnectivity      GetProgressStep = "Rebuilding checkin connectivity"    Case esriRPReconcileWithParent      GetProgressStep = "Reconciling with parent"    Case esriRPUnregisteringCheckOut      GetProgressStep = "Unregistering the checkout"    Case esriRPCreatingCheckOut      GetProgressStep = "Creating checkout"    Case esriRPSynchronizingCheckOut      GetProgressStep = "Synchronizing the checkout"    Case Else      GetProgressStep = "Unknown step"  End SelectEnd Function

[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter buttonLanguage Filter in the upper-left corner of the page.


原创粉丝点击