IReplicaProgress Example

[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 events
Private 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, strName
End Sub
 
' Extracts with progress events
Private 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, bolRelated
End Sub
 
' Checks in with progress events
Private 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 routines
Private 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: " & RHS
End 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 Select
End 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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值