WeibullDataSet.UpdateCalculationProgress: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 38: Line 38:
== Usage Example ==
== Usage Example ==


{{APIComment|Declare a New class that Inherits from WeibullEvents.}}<br>
{{APIComment|'Overrides requested. Create a new class, inherit WeibullEvents, and set the dataset's events.}}
{{APIComment|Override the method.}}<br>
  Private Class myEvents
        Private Class myEvents
      Inherits WeibullEvents
            Inherits WeibullEvents
      Public Overrides Sub UpdateCalculationProgress(sender As WeibullDataSet, msgx_0 As String,  
            Public Overrides Sub UpdateCalculationProgress(sender As WeibullDataSet, msgx_0 As String, msgx_1 As String, pdone As Double, append_to As Boolean, Prev_increment As Long, ByRef Cancel As Boolean)
      msgx_1 As String, pdone As Double, append_to As Boolean, Prev_increment As Long, ByRef Cancel As Boolean)
                MyBase.UpdateCalculationProgress(sender, msgx_0, msgx_1, pdone, append_to, Prev_increment, Cancel)
          MyBase.UpdateCalculationProgress(sender, msgx_0, msgx_1, pdone, append_to, Prev_increment, Cancel)
                MessageBox.Show("Additional overridden code here.")
          ("Additional overridden code here.")
            End Sub
      End Sub
        End Class
  End Class
 
 
{{APIComment|Declare the WeibullDataSet.}}<br>
{{APIComment|'Set the new Events class.}}
        Dim WDS as New WeibullDataSet
  WDS.Events = New myEvents
 
 
{{APIComment|Use the created myEvents class in place of the one created by the dataset.}}<br>
{{APIComment|'Update calculation progress.}}
        WDS.Events = New myEvents
  WDS.Events.UpdateCalculationProgress(WDS, "1","2", 0.5, True, 0.2, wasCanceled)
 
{{APIComment|'The "Cancel" checkbox reflects the value of wasCanceled}}
{{APIComment|Update the calculation progress display.}}
        WDS.Events.UpdateCalculationProgress(WDS, "NewMessage1", "NewMessage2", 100, False, 0, True)

Revision as of 22:58, 5 May 2014


Called when the calculation progress should be updated. Provides ability to customize the calculation progress display.

Syntax

  • UpdateCalculationProgress( sender As WeibullDataSet , msgx_0 As String, msgx_1 As String, pdone As Double, append_to As Boolean, Prev_increment As Long, Cancel As Boolean )

Parameters

sender: A WeibullDataSet object.
msgx_0: The main display label.
msgx_1: The remaining label.
pdone : The percentage to display, in decimal form (0.00 to 0.99).
append_to: If True, append pdone to the current percentage value in the progress display at the rate of Prev_increment, otherwise pdone will replace the value.
Prev_increment: This is the value of the incremental value per progress update if append_to is True. If append_to is False, this value is ignored.
Cancel: This determines if the calculation can be cancelled.

Usage Example

 'Overrides requested. Create a new class, inherit WeibullEvents, and set the dataset's events. 
 Private Class myEvents
     Inherits WeibullEvents
     Public Overrides Sub UpdateCalculationProgress(sender As WeibullDataSet, msgx_0 As String, 
     msgx_1 As String, pdone As Double, append_to As Boolean, Prev_increment As Long, ByRef Cancel As Boolean)
         MyBase.UpdateCalculationProgress(sender, msgx_0, msgx_1, pdone, append_to, Prev_increment, Cancel)
         ("Additional overridden code here.")
     End Sub
 End Class
 
 'Set the new Events class. 
 WDS.Events = New myEvents
 
 'Update calculation progress. 
 WDS.Events.UpdateCalculationProgress(WDS, "1","2", 0.5, True, 0.2, wasCanceled)
 'The "Cancel" checkbox reflects the value of wasCanceled