I write a static code module which works as a progressDialog. It works well. But this time, when I am trying to update the cloudkvs with a local keyvaluestore, it just does not update.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The progressDialog code:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			
			
				B4X:
			
		
		
		Sub Class_Globals
 Private fx As JFX
 Public translationMemory As KeyValueStore
 Public externalTranslationMemory As KeyValueStore
 Private sharedTM As ClientKVS
 Private similarityStore As Map
 Public currentSource As String
 Private projectName As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(projectPath As String)
    translationMemory.Initialize(File.Combine(projectPath,"TM"),"TM.db")
    externalTranslationMemory.Initialize(File.Combine(projectPath,"TM"),"externalTM.db")
    similarityStore.Initialize
    initSharedTM(projectPath)
End Sub
Public Sub initSharedTM(projectPath As String)
    If Main.currentProject.settings.GetDefault("sharingTM_enabled",False)=True Then
        projectName=File.GetName(projectPath)
        Log("projectName"&projectName)
        Dim address As String=Main.currentProject.settings.GetDefault("server_address","http://127.0.0.1:51042")
        sharedTM.Initialize(Me, "sharedTM", address,File.Combine(projectPath,"TM"),"sharedTM.db")
        sharedTM.SetAutoRefresh(Array(projectName&"TM"), 0.1) 'auto refresh every 0.1 minute
        Dim job As HttpJob
        job.Initialize("job",Me)
        If address.EndsWith("/")=False Then
            address=address&"/"
        End If
        job.Download(address&"getinfo?type=size&user="&projectName&"TM")
        wait for (job) JobDone(job As HttpJob)
        If job.Success Then
            Try
                Dim size As Int=job.GetString
                If size=0 Then
                    fillSharedTM
                End If
            Catch
                Log(LastException)
            End Try
        End If
        job.Release
    End If
End Sub
Sub fillSharedTM
    Dim tmmap As Map
    tmmap=sharedTM.GetAll(projectName&"TM")
    Dim size As Int=translationMemory.ListKeys.Size
    progressDialog.Show("Filling SharedTM","sharedTM")
    Dim index As Int=0
    For Each key As String In translationMemory.ListKeys
        index=index+1
        Log(index)
        Log(size)
        If tmmap.ContainsKey(key) Then
            If tmmap.Get(key)<>translationMemory.Get(key) Then
                sharedTM.Put(projectName&"TM",key,translationMemory.Get(key))
            End If
        Else
            sharedTM.Put(projectName&"TM",key,translationMemory.Get(key))
        End If
        progressDialog.update(index,size)
        Sleep(0)
    Next
    progressDialog.close
End SubThe progressDialog code:
			
				B4X:
			
		
		
		'Static code module
Sub Process_Globals
    Private fx As JFX
    Private frm As Form
    Private Label1 As Label
    Private ProgressBar1 As ProgressBar
    Private progressTypeValue As String
End Sub
Sub Show(title As String,progressType As String)
    frm.Initialize("frm",600,200)
    frm.RootPane.LoadLayout("progress")
    frm.Title=title
    progressTypeValue=progressType
    frm.Show
End Sub
Sub ShowWithoutProgressBar(title As String,progressType As String)
    frm.Initialize("frm",400,120)
    frm.RootPane.LoadLayout("progress")
    frm.Title=title
    Label1.Top=60-Label1.Height/2
    ProgressBar1.Visible=False
    progressTypeValue=progressType
    frm.Show
End Sub
Sub update(completed As Int,segmentSize As Int)
    ProgressBar1.Visible=True
    Label1.Text=completed&"/"&segmentSize
    ProgressBar1.Progress=completed/segmentSize
End Sub
Sub update2(info As String)
    Label1.Text=info
End Sub
Sub close
    frm.Close  
End Sub
Sub frm_CloseRequest (EventData As Event)
    If progressTypeValue="pretranslate" Then
        Main.currentProject.completed=Main.currentProject.segments.Size
        fx.Msgbox(frm,"The process is canceled.","")
    End If
    Return
End Sub 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		