WeibullDataSet.GetDistrParameters: Difference between revisions

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


{{APIComment|Declare a New class that Inherits from WeibullEvents.}}<br>
{{APIComment|'Declare a New class that Inherits from WeibullEvents.}}<br>
{{APIComment|Override the method.}}<br>
{{APIComment|'Override the method.}}<br>
        Private Class myEvents
  Private Class myEvents
            Inherits WeibullEvents
      Inherits WeibullEvents
            Public Overrides Sub GetDistrParameters(sender As WeibullDataSet, sMsg As String, GetOnlyOneParamater As Boolean, Params As List(Of ParamInputInfo), ByRef Cancel As Boolean)
      Public Overrides Sub GetDistrParameters(sender As WeibullDataSet, sMsg As String, GetOnlyOneParamater As Boolean, Params As List(Of ParamInputInfo), ByRef Cancel As Boolean)
                MyBase.GetDistrParameters(sender, sMsg, GetOnlyOneParamater, Params, Cancel)
          MyBase.GetDistrParameters(sender, sMsg, GetOnlyOneParamater, Params, Cancel)
                MessageBox.Show("Additional overridden code here.")
          MessageBox.Show("Additional overridden code here.")
            End Sub
      End Sub
        End Class
  End Class
 
 
{{APIComment|Declare the WeibullDataSet.}}<br>
{{APIComment|'Declare the WeibullDataSet.}}<br>
        Dim WDS as New WeibullDataSet
  Dim WDS as New WeibullDataSet
 
 
{{APIComment|Use the created myEvents class in place of the one created by the dataset.}}<br>
{{APIComment|'Use the created myEvents class in place of the one created by the dataset.}}<br>
        WDS.Events = New myEvents
  WDS.Events = New myEvents
 
 
{{APIComment|Creates a new list of ParamInputInfo.  Populate the list.}}
{{APIComment|'Creates a new list of ParamInputInfo.  Populate the list.}}
        Dim Params As New List(Of ParamInputInfo)
  Dim Params As New List(Of ParamInputInfo)
        Params.Add(New ParamInputInfo("Param1", 0, 10, False, True))
  Params.Add(New ParamInputInfo("Param1", 0, 10, False, True))
        Params.Add(New ParamInputInfo("Param2", 0, Double.MaxValue, False, True))
  Params.Add(New ParamInputInfo("Param2", 0, Double.MaxValue, False, True))
 
 
{{APIComment|Create a Boolean for return of "Cancel" parameter.}}
{{APIComment|'Create a Boolean for return of "Cancel" parameter.}}
        Dim wasCanceled As Boolean
  Dim wasCanceled As Boolean
 
 
{{APIComment|Prompt user to input the parameters.}}
{{APIComment|'Prompt user to input the parameters.}}
        WDS.Events.GetDistrParameters(WDS, "Message1", True, Params, wasCanceled)
  WDS.Events.GetDistrParameters(WDS, "Message1", True, Params, wasCanceled)
 
 
{{APIComment|The new Parameter values are in their respective ParamInputInfo.Value variables.}}
{{APIComment|'The new Parameter values are in their respective ParamInputInfo.Value variables.}}
        Dim NewParameter1value As Double
  Dim NewParameter1value As Double
        Dim NewParameter2value As Double  
  Dim NewParameter2value As Double  
 
  If Not wasCanceled Then
        If Not wasCanceled Then
      NewParameter1value = Params(0).Value
            NewParameter1value = Params(0).Value
      NewParameter2value = Params(1).Value
            NewParameter2value = Params(1).Value
  End If
        End If

Revision as of 23:09, 5 May 2014


Displays a prompt for entering customized parameters. This is called when the Calculate method is called and there is insufficient data to fit a model.

Syntax

  • GetDistrParameters( sender As WeibullDataSet, sMsg As String , GetOnlyOneParameter As Boolean , Params As List( Of ParamInputInfo ) , Cancel As Boolean)

Parameters

sender: A WeibullDataSet object.
sMsg: The main display label.
GetOnlyOneParameter: The prompt for only one parameter.
Params: A list of ParamInputInfo objects that would be updated by this prompt. After processing with this event handler, the Value of each ParamInputInfo object will be updated.
Cancel: If the prompt was closed by any means other than clicking "Okay," this value will be set to True.

Usage Example

 'Declare a New class that Inherits from WeibullEvents. 
'Override the method.
Private Class myEvents Inherits WeibullEvents Public Overrides Sub GetDistrParameters(sender As WeibullDataSet, sMsg As String, GetOnlyOneParamater As Boolean, Params As List(Of ParamInputInfo), ByRef Cancel As Boolean) MyBase.GetDistrParameters(sender, sMsg, GetOnlyOneParamater, Params, Cancel) MessageBox.Show("Additional overridden code here.") End Sub End Class 'Declare the WeibullDataSet.
Dim WDS as New WeibullDataSet 'Use the created myEvents class in place of the one created by the dataset.
WDS.Events = New myEvents 'Creates a new list of ParamInputInfo. Populate the list. Dim Params As New List(Of ParamInputInfo) Params.Add(New ParamInputInfo("Param1", 0, 10, False, True)) Params.Add(New ParamInputInfo("Param2", 0, Double.MaxValue, False, True)) 'Create a Boolean for return of "Cancel" parameter. Dim wasCanceled As Boolean 'Prompt user to input the parameters. WDS.Events.GetDistrParameters(WDS, "Message1", True, Params, wasCanceled) 'The new Parameter values are in their respective ParamInputInfo.Value variables. Dim NewParameter1value As Double Dim NewParameter2value As Double If Not wasCanceled Then NewParameter1value = Params(0).Value NewParameter2value = Params(1).Value End If