Beispiel #1
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which validates all calculations in a calculation group.
 /// </summary>
 /// <typeparam name="TCalculationContext">The type of the calculation group context.</typeparam>
 /// <param name="calculationGroupContext">The calculation group context belonging to the calculation group.</param>
 /// <param name="validateAllAction">The action that validates all calculations.</param>
 /// <param name="enableMenuItemFunction">An optional function which determines whether the item should be enabled. If the
 /// item should not be enabled, then the reason for that should be returned by the function and will be shown as a tooltip.
 /// If the item should be enabled then the function should return a <c>null</c> or empty string.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddValidateAllCalculationsInGroupItem <TCalculationContext>(TCalculationContext calculationGroupContext,
                                                                                              Action <TCalculationContext> validateAllAction,
                                                                                              Func <TCalculationContext, string> enableMenuItemFunction = null)
     where TCalculationContext : ICalculationContext <CalculationGroup, ICalculatableFailureMechanism>
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateValidateAllCalculationsInGroupItem(calculationGroupContext, validateAllAction, enableMenuItemFunction));
     return(this);
 }
Beispiel #2
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which sets if the failure mechanism is part of the assembly.
 /// </summary>
 /// <typeparam name="TFailureMechanismContext">The type of the failure mechanism context.</typeparam>
 /// <param name="failureMechanismContext">The failure mechanism context belonging to the failure mechanism.</param>
 /// <param name="onChangeAction">The action to perform when relevance changes.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddToggleInAssemblyOfFailureMechanismItem <TFailureMechanismContext>(
     TFailureMechanismContext failureMechanismContext,
     Action <TFailureMechanismContext> onChangeAction)
     where TFailureMechanismContext : IFailureMechanismContext <IFailureMechanism>
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateToggleInAssemblyOfFailureMechanismItem(failureMechanismContext, onChangeAction));
     return(this);
 }
Beispiel #3
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which adds a new calculation to a calculation group.
 /// </summary>
 /// <typeparam name="TCalculationContext">The type of the calculation group context.</typeparam>
 /// <param name="calculationGroupContext">The calculation group context belonging to the calculation group.</param>
 /// <param name="addCalculationAction">The action for adding a calculation to the calculation group.</param>
 /// <param name="calculationType">The type of the calculation to add.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddCreateCalculationItem <TCalculationContext>(
     TCalculationContext calculationGroupContext,
     Action <TCalculationContext> addCalculationAction,
     CalculationType calculationType)
     where TCalculationContext : ICalculationContext <CalculationGroup, ICalculatableFailureMechanism>
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateAddCalculationItem(calculationGroupContext, addCalculationAction, calculationType));
     return(this);
 }
Beispiel #4
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which validates all calculations in a failure mechanism.
 /// </summary>
 /// <typeparam name="TFailureMechanismContext">The type of the failure mechanism context.</typeparam>
 /// <param name="failureMechanism">The failure mechanism context belonging to the failure mechanism.</param>
 /// <param name="validateAllAction">The action that validates all calculations.</param>
 /// <param name="enableMenuItemFunction">An optional function which determines whether the item should be enabled. If the
 /// item should not be enabled, then the reason for that should be returned by the function and will be shown as a tooltip.
 /// If the item should be enabled then the function should return a <c>null</c> or empty string.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 /// <remarks>When <paramref name="enableMenuItemFunction"/> returns a <c>string</c>, the item will be disabled and the <c>string</c> will be shown in the tooltip.</remarks>
 public RiskeerContextMenuBuilder AddValidateAllCalculationsInFailureMechanismItem <TFailureMechanismContext>(
     TFailureMechanismContext failureMechanism,
     Action <TFailureMechanismContext> validateAllAction,
     Func <TFailureMechanismContext, string> enableMenuItemFunction = null)
     where TFailureMechanismContext : IFailureMechanismContext <ICalculatableFailureMechanism>
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateValidateAllCalculationsInFailureMechanismItem(failureMechanism, validateAllAction, enableMenuItemFunction));
     return(this);
 }
Beispiel #5
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which duplicates a calculation item.
 /// </summary>
 /// <typeparam name="TCalculationItem">The type of the calculation item.</typeparam>
 /// <typeparam name="TCalculationItemContext">The type of the calculation item context.</typeparam>
 /// <param name="calculationItem">The calculation item to duplicate.</param>
 /// <param name="calculationItemContext">The calculation item context belonging to the calculation item.</param>
 /// <exception cref="ArgumentException">Thrown when the parent calculation group of
 /// <paramref name="calculationItem"/> equals <c>null</c>.</exception>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddDuplicateCalculationItem <TCalculationItem, TCalculationItemContext>(
     TCalculationItem calculationItem,
     TCalculationItemContext calculationItemContext)
     where TCalculationItemContext : ICalculationContext <TCalculationItem, ICalculatableFailureMechanism>
     where TCalculationItem : ICalculationBase
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateDuplicateCalculationItem(calculationItem, calculationItemContext));
     return(this);
 }
Beispiel #6
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which performs a calculation.
 /// </summary>
 /// <typeparam name="TCalculation">The type of the calculation.</typeparam>
 /// <typeparam name="TCalculationContext">The type of the calculation context.</typeparam>
 /// <param name="calculationContext">The calculation context belonging to the calculation.</param>
 /// <param name="calculateAction">The action that performs the calculation.</param>
 /// <param name="enableMenuItemFunction">An optional function which determines whether the item should be enabled. If the
 /// item should not be enabled, then the reason for that should be returned by the function and will be shown as a tooltip.
 /// If the item should be enabled then the function should return a <c>null</c> or empty string.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddPerformCalculationItem <TCalculation, TCalculationContext>(
     TCalculationContext calculationContext,
     Action <TCalculationContext> calculateAction,
     Func <TCalculationContext, string> enableMenuItemFunction = null)
     where TCalculationContext : ICalculationContext <TCalculation, ICalculatableFailureMechanism>
     where TCalculation : ICalculation
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreatePerformCalculationItem <TCalculation, TCalculationContext>(
                                          calculationContext, calculateAction, enableMenuItemFunction));
     return(this);
 }
Beispiel #7
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which is bound to the action
 /// of updating the <see cref="ForeshoreProfile"/> of the <paramref name="calculations"/>.
 /// </summary>
 /// <typeparam name="TCalculationInput">The type of calculation input that can have
 /// a foreshore profile.</typeparam>
 /// <param name="calculations">The calculations to update.</param>
 /// <param name="inquiryHelper">Object responsible for inquiring the required data.</param>
 /// <param name="updateAction">The action to perform when the foreshore profile is updated.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddUpdateForeshoreProfileOfCalculationsItem <TCalculationInput>(
     IEnumerable <ICalculation <TCalculationInput> > calculations,
     IInquiryHelper inquiryHelper,
     Action <ICalculation <TCalculationInput> > updateAction)
     where TCalculationInput : ICalculationInput, IHasForeshoreProfile
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationsItem(
                                          calculations,
                                          inquiryHelper,
                                          updateAction));
     return(this);
 }
Beispiel #8
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which clears the output of all calculations in a calculation group.
 /// </summary>
 /// <param name="calculationGroup">The calculation group to clear the output for.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddClearAllCalculationOutputInGroupItem(CalculationGroup calculationGroup)
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateClearAllCalculationOutputInGroupItem(calculationGroup));
     return(this);
 }
Beispiel #9
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/> which is bound to the action
 /// of clearing illustration points from collections of calculations.
 /// </summary>
 /// <param name="isEnabledFunc">The function to determine whether this item should be enabled.</param>
 /// <param name="changeHandler">Object responsible for clearing the illustration point results.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddClearIllustrationPointsOfCalculationItem(
     Func <bool> isEnabledFunc, IClearIllustrationPointsOfCalculationChangeHandler changeHandler)
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateClearIllustrationPointsOfCalculationItem(isEnabledFunc, changeHandler));
     return(this);
 }
Beispiel #10
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which clears the output of all calculations in the failure mechanism.
 /// </summary>
 /// <param name="failureMechanism">The failure mechanism to clear the output for.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddClearAllCalculationOutputInFailureMechanismItem(ICalculatableFailureMechanism failureMechanism)
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateClearAllCalculationOutputInFailureMechanismItem(failureMechanism));
     return(this);
 }
Beispiel #11
0
 /// <summary>
 /// Adds an item to the <see cref="ContextMenuStrip"/>, which clears the output of a calculation.
 /// </summary>
 /// <param name="calculation">The calculation to clear the output for.</param>
 /// <returns>The <see cref="RiskeerContextMenuBuilder"/> itself.</returns>
 public RiskeerContextMenuBuilder AddClearCalculationOutputItem(ICalculation calculation)
 {
     contextMenuBuilder.AddCustomItem(RiskeerContextMenuItemFactory.CreateClearCalculationOutputItem(calculation));
     return(this);
 }