OnWarning(Message: String);
OnWarning(Message: string);
The OnWarning method implements the event for displaying a warning on modeling problem calculation.
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.
The example displays the description of the user class that is the event handler.
Add links to the 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 completed);
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("'Model calculation'");
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 completed. The elapsed time in milliseconds: " + Duration.ToString);
Debug.WriteLine("");
End Sub OnStageFinish;
End Class MCallback;
The given class use for processing the events is given in the Fore example for IMsProblemCalculationSettings.BreakOnError.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
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 completed);
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("'Model calculation'");
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 completed. The elapsed time 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;
End Class MCallback;
See also: