IMsProblemCalculationCallback.OnWarning

Fore Syntax

OnWarning(Message: String);

Fore.NET Syntax

OnWarning(Message: string);

Description

The OnWarning method implements the event for displaying a warning on modeling problem calculation.

Comments

For correct use, the method must be redetermined in the user class that is the event handler. Also, this handler must be set in the parameters that are used for modeling problem calculation.

Example

The example displays the description of the user class that is the event handler.

Add links to the Cubes, Matrix, Metabase, Ms system assemblies.

Public Class MCallback: ProblemCalculationCallback
    
Public Sub OnError(Message: String);
    
Begin
        Debug.WriteLine(
"Error: " + Message);
    
End Sub OnError;
    
    
Public Sub OnFinish;
    
Begin
        Debug.WriteLine(
"Problem calculation is complete");
    
End Sub OnFinish;
    
    
Public Sub OnMessage(Message: String);
    
Begin
        Debug.WriteLine(
"Message: " + Message);
    
End Sub OnMessage;
    
    
Public Sub OnModelCalculation(Model: IMsModel);
    
Begin
        Debug.WriteLine(
"Model calculation: " + (Model As IMetabaseObject).Id);
    
End Sub OnModelCalculation;
    
    
Public Sub OnStep;
    
Begin
        Debug.WriteLine(
"Calculation step is executed");
    
End Sub OnStep;
    
    
Public Sub OnBreak(Breakpoint: IMsBreakpoint);
    
Begin
        Debug.WriteLine(Breakpoint.Name);
    
End Sub OnBreak;
    
    
Public Sub OnWarning(Message: string);
    
Begin
        Debug.WriteLine(
"Warning: " + Message);
    
End Sub OnWarning;
    
    
Public Sub OnStageStart(Stage: MsProblemCalculationStage; Data: Variant);
    
Begin
        Debug.Write(
"Stage start ");
        
Select Case Stage
            
Case MsProblemCalculationStage.Init: Debug.WriteLine("'Initialization'");
            
Case MsProblemCalculationStage.DetermIdent: Debug.WriteLine("'Identification of determinate equations'");
            
Case MsProblemCalculationStage.Vector: Debug.WriteLine("'Identification of vector equations'");
            
Case MsProblemCalculationStage.Ident: Debug.WriteLine("'Identification of stochastic methods'");
            
Case MsProblemCalculationStage.Calc: Debug.WriteLine("'Calculate models'");
            
Case MsProblemCalculationStage.Save: Debug.WriteLine("'Save data'");
            
Case MsProblemCalculationStage.Finish: Debug.WriteLine("'Calculation end'");
            
Case MsProblemCalculationStage.Load: Debug.WriteLine("'Load data'");
        
End Select;
    
End Sub OnStageStart;

    
Public Sub OnStageFinish(Stage: MsProblemCalculationStage; Duration: Integer; Data: Variant);
    
Begin
        Debug.WriteLine(
"Stage is complete. Time spent in milliseconds: " + Duration.ToString);
        Debug.WriteLine(
"");
    
End Sub OnStageFinish;

    
Public Sub OnBeforeSaveData(Stub: IVariableStub; Matrix: IMatrix; var ValueFlag: Integer; Var Cancel: Boolean);
    
Begin
    
End Sub OnBeforeSaveData;

    
Public Sub OnSaveData(Stub: IVariableStub; Matrix: IMatrix; ValueFlag: Integer; AuditRecordKey: Variant);
    
Begin
    
End Sub OnSaveData;

    
Public Function OnGetActiveEvents: MsProblemCalculationCallbackEvents;
    
Begin
        
Return MsProblemCalculationCallbackEvents.All
    
End Function OnGetActiveEvents;
End Class MCallback;

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;

Public Class MCallback: IMsProblemCalculationCallback
    
Public Sub OnError(Message: String);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Error: " + Message);
    
End Sub OnError;
    
    
Public Sub OnFinish();
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Problem calculation is complete");
    
End Sub OnFinish;
    
    
Public Sub OnMessage(Message: String);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Message: " + Message);
    
End Sub OnMessage;
    
    
Public Sub OnModelCalculation(Model: IMsModel);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Model calculation: " + (Model As IMetabaseObject).Id);
    
End Sub OnModelCalculation;
    
    
Public Sub OnStep();
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Calculation step is executed");
    
End Sub OnStep;
    
    
Public Sub OnBreak(Breakpoint: IMsBreakpoint);
    
Begin
        System.Diagnostics.Debug.WriteLine(Breakpoint.Name);
    
End Sub OnBreak;
    
    
Public Sub OnWarning(Message: string);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Warning: " + Message);
    
End Sub OnWarning;
    
    
Public Sub OnStageStart(Stage: MsProblemCalculationStage; Data: object);
    
Begin
        System.Diagnostics.Debug.Write(
"Stage start ");
        
Select Case Stage
            
Case MsProblemCalculationStage.mpcsInit: System.Diagnostics.Debug.WriteLine("'Initialization'");
            
Case MsProblemCalculationStage.mpcsDetermIdent: System.Diagnostics.Debug.WriteLine("'Identification of determinate equations'");
            
Case MsProblemCalculationStage.mpcsVector: System.Diagnostics.Debug.WriteLine("'Identification of vector equations'");
            
Case MsProblemCalculationStage.mpcsIdent: System.Diagnostics.Debug.WriteLine("'Identification of stochastic methods'");
            
Case MsProblemCalculationStage.mpcsCalc: System.Diagnostics.Debug.WriteLine("'Calculate models'");
            
Case MsProblemCalculationStage.mpcsSave: System.Diagnostics.Debug.WriteLine("'Save data'");
            
Case MsProblemCalculationStage.mpcsFinish: System.Diagnostics.Debug.WriteLine("'Calculation end'");
            
Case MsProblemCalculationStage.mpcsLoad: System.Diagnostics.Debug.WriteLine("'Load data'");
        
End Select;
    
End Sub OnStageStart;

    
Public Sub OnStageFinish(Stage: MsProblemCalculationStage; Duration: Integer; Data: object);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Stage is complete. Time spent in milliseconds: " + Duration.ToString());
        System.Diagnostics.Debug.WriteLine(
"");
    
End Sub OnStageFinish;
        
    
Public Sub OnBeforeSaveData(Stub: IVariableStub; Matrix: IMatrix; var ValueFlag: integer; Var Cancel: boolean);
    
Begin
    
End Sub OnBeforeSaveData;

    
Public Sub OnSaveData(Stub: IVariableStub; Matrix: IMatrix; ValueFlag: integer; AuditRecordKey: object);
    
Begin
    
End Sub OnSaveData;
    
    
Public Function OnGetActiveEvents(): MsProblemCalculationCallbackEvents;
    
Begin
        
Return MsProblemCalculationCallbackEvents.mspceAll
    
End Function;
End Class MCallback;

The use of this class for event handling is given in the example for IMsProblemCalculationSettings.BreakOnError.

See also:

IMsProblemCalculationCallback