OnBreak(Breakpoint: IMsBreakpoint);
OnBreak(Breakpoint: Prognoz.Platform.Interop.Ms.IMsBreakpoint);
Breakpoint. The breakpoint that generated the event.
The OnBreak method implements the event that occurs on triggering the breakpoint during 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. To execute the example, add a link to the Ms system assembly.
Class MCallback: ProblemCalculationCallback
Public Sub OnError(Message: String);
Begin
End Sub OnError;
Public Sub OnFinish;
Begin
End Sub OnFinish;
Public Sub OnMessage(Message: String);
Begin
Debug.WriteLine(DateTime.Now.ToString + " > " + Message);
End Sub OnMessage;
Public Sub OnModelCalculation(Model: IMsModel);
Begin
End Sub OnModelCalculation;
Public Sub OnStep;
Begin
End Sub OnStep;
Public Sub OnBreak(Breakp: IMsBreakpoint);
Var
CalendBreak: IMsModelCalendarBreakpoint;
DataBreak: IMsDataBreakpoint;
Begin
Debug.WriteLine("Breakpoint triggered!");
Debug.WriteLine(" Point key: '" + Breakp.Key.ToString + "'");
Debug.WriteLine(" Point name: '" + Breakp.Name + "'");
Select Case Breakp.Kind
Case MsBreakpointKind.ModelCalendar:
Debug.WriteLine(" Calendar point");
CalendBreak := Breakp As IMsModelCalendarBreakpoint;
If CalendBreak.IsCalendarPointFixed Then
Debug.WriteLine(" Trigger date: " + CalendBreak.CalendarPoint.ToString);
Else
Debug.WriteLine(" The point triggered for every calculation date");
End If;
Case MsBreakpointKind.Data:
Debug.WriteLine(" The point for the data value");
DataBreak := Breakp As IMsDataBreakpoint;
Debug.WriteLine(" Triggering condition: " + DataBreak.Condition.AsString);
End Select;
End Sub OnBreak;
End Class MCallback;
The given class use for the event handling is given in description of IMsModelCalendarBreakpoint.CalendarPoint.
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 OnBreak(Breakp: IMsBreakpoint);
Var
CalendBreak: IMsModelCalendarBreakpoint;
DataBreak: IMsDataBreakpoint;
Begin
System.Diagnostics.Debug.WriteLine("Breakpoint triggered!");
System.Diagnostics.Debug.WriteLine(" Point key: '" + Breakp.Key.ToString() + "'");
System.Diagnostics.Debug.WriteLine(" Point name: '" + Breakp.Name + "'");
Select Case Breakp.Kind
Case MsBreakpointKind.mbkModelCalendar:
System.Diagnostics.Debug.WriteLine(" Calendar point");
CalendBreak := Breakp As IMsModelCalendarBreakpoint;
If CalendBreak.IsCalendarPointFixed Then
System.Diagnostics.Debug.WriteLine(" Triggering date: " +
CalendBreak.CalendarPoint.ToString());
Else
System.Diagnostics.Debug.WriteLine(" The point triggered for every calculation date");
End If;
Case MsBreakpointKind.mbkData:
System.Diagnostics.Debug.WriteLine(" The point for the data values");
DataBreak := Breakp As IMsDataBreakpoint;
System.Diagnostics.Debug.WriteLine(" Triggering condition: " +
DataBreak.Condition.AsString);
End Select;
End Sub OnBreak;
Public Sub OnMessage(Message: String);
Begin
System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString() + " > " + Message);
End Sub OnMessage;
Public Sub OnError(Message: String);
Begin
End Sub OnError;
Public Sub OnFinish();
Begin
End Sub OnFinish;
Public Sub OnModelCalculation(Model: IMsModel);
Begin
End Sub OnModelCalculation;
Public Sub OnStep();
Begin
End Sub OnStep;
Public Sub OnWarning(Message: string);
Begin
End Sub OnWarning;
Public Sub OnStageStart(Stage: MsProblemCalculationStage; Data: object);
Begin
End Sub OnStageStart;
Public Sub OnStageFinish(Stage: MsProblemCalculationStage; Duration: Integer; Data: object);
Begin
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: