Пример #1
0
        public ConfirmMessageForm(
            string messageOrNull = null, string titleOrNull = null, TextType textType = TextType.TreatAsText,
            ConfirmLabels labels = ConfirmLabels.ConfirmCancel)

            : this(new ConfirmMessageFormView(textType, labels), messageOrNull, titleOrNull)
        {
        }
        public static string GetCancelLabel(this ConfirmLabels self)
        {
            switch (self)
            {
            case ConfirmLabels.ConfirmCancel: return(I18n.Translate("Cancel"));

            case ConfirmLabels.YesNo: return(I18n.Translate("No"));

            case ConfirmLabels.OkCancel: return(I18n.Translate("Cancel"));

            default: throw new Exception("unsupported ConfirmLabels");
            }
        }
 public ConfirmMessageFormView(
     TextType inputType = TextType.TreatAsText, ConfirmLabels type = ConfirmLabels.ConfirmCancel,
     Func <LabelDescr, IActionView <HTMLElement> > customActionBuilder = null)
 {
     LabelsType = type;
     Message    = new LabellessReadOnlyView("div", inputType);
     Confirm    = (customActionBuilder ?? Toolkit.DefaultActionBuilder)
                  .Invoke(new LabelDescr {
         Label = LabelsType.GetConfirmLabel()
     })
                  .With(x => x.MarkAsFormsDefaultButton());
     Cancel = (customActionBuilder ?? Toolkit.DefaultActionBuilder)
              .Invoke(new LabelDescr {
         Label = LabelsType.GetCancelLabel()
     });
 }