In old times to indicate something is being loaded one could use
CR3.SetStatus(String, Boolean, Boolean) and
CR3.ClearStatus() to remove indicator.
Those do not work well with asynchronous paradigm. That is why
ClientExtensions.AddStatus(Task, String) and
afForm.SetIsLoading(Object, Boolean) have been introduced.
AddStatus can be used directly on task because it is extension method.
Adding progress indication when refreshing data object:
loading indicator invoked with AddStatus
Similarly one can await result from task, adding progress indication at the same time:
Dim sp = New afProcedureCall("sstp_WinClient_WhatsUp") Dim dataSet = Await sp.ExecuteAsync.AddStatus("What is up ...")
loading indicator invoked for stored procedure execution
Former example does not spin loading indicator in the MDI form tab. How come refreshing data object did spin it?..
That is because refreshing any
afDataObjectwill spin that loading indicator automatically.
To spin it by your self you have to use
Dim t = Task.Delay(3000).AddStatus("аккордеон ...") SetIsLoading(t, True) Try Await t Finally SetIsLoading(t, False) End Try
The result after calling above code 3 times slightly one after another:
loading and spining indicator invoked for delay task
SetIsLoading be sure to call
SetIsLoading(t, False) in Finally block.
That way it is going to be called no matter what happens in Try block.
CR3.SetStatus do not interact with each other, so
will not affect any loading indicators invoked using other means.