예제 #1
0
파일: Toastr.cs 프로젝트: ViniciusVeiga/TCC
 public ToastrMessage AddToastMessage(string title, string message, ToastrType toastType, string toastPositionClass = "toast-bottom-right")
 {
     var toast = new ToastrMessage()
     {
         Title = title,
         Message = message,
         ToastType = toastType
     };
     ToastMessages.Add(toast);
     return toast;
 }
예제 #2
0
        public static void ShowToastr(ToastrType toastrType, string message, string title = null, ToastrOptions options = null)
        {
            switch (toastrType)
            {
            case ToastrType.Success:
                JsRuntime.InvokeAsync <string>("toastrInterop.success", message, title, JsonConvert.SerializeObject(toastrOptions ?? options.ToInternal()));
                break;

            case ToastrType.Info:
                JsRuntime.InvokeAsync <string>("toastrInterop.info", message, title, JsonConvert.SerializeObject(toastrOptions ?? options.ToInternal()));
                break;

            case ToastrType.Warning:
                JsRuntime.InvokeAsync <string>("toastrInterop.warning", message, title, JsonConvert.SerializeObject(toastrOptions ?? options.ToInternal()));
                break;

            case ToastrType.Error:
                JsRuntime.InvokeAsync <string>("toastrInterop.error", message, title, JsonConvert.SerializeObject(toastrOptions ?? options.ToInternal()));
                break;

            default:
                break;
            }
        }
예제 #3
0
        public static void ShowToastr(ToastrType toastrType, string message, string title = null)
        {
            switch (toastrType)
            {
            case ToastrType.Success:
                JSRuntime.Current.InvokeAsync <string>("toastrInterop.success", message, title, Json.Serialize(toastrOptions));
                break;

            case ToastrType.Info:
                JSRuntime.Current.InvokeAsync <string>("toastrInterop.info", message, title, Json.Serialize(toastrOptions));
                break;

            case ToastrType.Warning:
                JSRuntime.Current.InvokeAsync <string>("toastrInterop.warning", message, title, Json.Serialize(toastrOptions));
                break;

            case ToastrType.Error:
                JSRuntime.Current.InvokeAsync <string>("toastrInterop.error", message, title, Json.Serialize(toastrOptions));
                break;

            default:
                break;
            }
        }
예제 #4
0
 public Toastr Type(ToastrType type)
 {
     this.type = string.Format("'{0}'", type.ToString().ToLower());
     SetScript();
     return(this);
 }
예제 #5
0
 public static void AddToUserQueue(string message, string title, ToastrType type)
 {
     AddToUserQueue(new Toastr(message, title, type));
 }
 public static Toastr Toastr(this HtmlHelper helper, string text, string title = "پیغام", ToastrType type = ToastrType.Info)
 {
     return(new Toastr(helper).Text(text).Title(title).Type(type));
 }
 public static Toastr Toastr(string text, string title = "پیغام", ToastrType type = ToastrType.Info)
 {
     return(new Toastr().Text(text).Title(title).Type(type));
 }
예제 #8
0
 public void ShowMessage(ToastrType toastrType, string messageTitle, string message)
 {
     ToastrType   = toastrType;
     MessageTitle = messageTitle;
     Message      = message;
 }
예제 #9
0
 public BaseViewModel(ToastrType toastrType, string messageTitle, string message)
 {
     ShowMessage(toastrType, messageTitle, message);
 }
예제 #10
0
 public Toastr(string message, string title = "Information", ToastrType type = ToastrType.Info, ToastrType success = default) : this(message, title, type)
 {
     this.success = success;
 }
예제 #11
0
 public Toastr(string message, string title = "Information", ToastrType type = ToastrType.Info)
 {
     this.Message = message;
     this.Title   = title;
     this.Type    = type;
 }
예제 #12
0
        public static ToastrMessage AddToastMessage(this Controller controller, string title, string message, ToastrType toastType = ToastrType.Info)
        {
            var toastr = controller.TempData["Toastr"] as Toastr;

            toastr = toastr ?? new Toastr();

            var toastMessage = toastr.AddToastMessage(title, message, toastType);

            controller.TempData["Toastr"] = toastr;
            return(toastMessage);
        }
예제 #13
0
 public Toastr(string message, string title = "Asist Patent", ToastrType type = ToastrType.Info)
 {
     this.Message = message;
     this.Title   = title;
     this.Type    = type;
 }
예제 #14
0
        //public ToastrService(bool closeButton = false, bool debug = false, bool newestOnTop = false, bool progressBar = false,
        //    PositionClassType positionClass = PositionClassType.TopRight, bool preventDuplicates = false, string onClick = null, long showDuration = 300, long hideDuration = 1000,
        //    long timeOut = 5000, long extendedTimeOut = 1000, EasingType showEasing = EasingType.Swing, EasingType hideEasing = EasingType.Linear,
        //    EffectType showMethod = EffectType.FadeIn, EffectType hideMethod = EffectType.FadeOut)
        //{
        //    var options = new ToastrOptionsInternal();
        //    switch (positionClass)
        //    {
        //        case PositionClassType.TopRight:
        //            options.positionClass = "toast-top-right";
        //            break;
        //        case PositionClassType.TopLeft:
        //            options.positionClass = "toast-top-left";
        //            break;
        //        case PositionClassType.TopCenter:
        //            options.positionClass = "toast-top-center";
        //            break;
        //        case PositionClassType.TopFullWidth:
        //            options.positionClass = "toast-top-full-width";
        //            break;
        //        case PositionClassType.BottomRight:
        //            options.positionClass = "toast-bottom-right";
        //            break;
        //        case PositionClassType.BottomLeft:
        //            options.positionClass = "toast-bottom-left";
        //            break;
        //        case PositionClassType.BottomCenter:
        //            options.positionClass = "toast-bottom-center";
        //            break;
        //        case PositionClassType.BottomFullWidth:
        //            options.positionClass = "toast-bottom-full-width";
        //            break;
        //        default:
        //            options.positionClass = "toast-top-right";
        //            break;
        //    }
        //    options.closeButton = closeButton;
        //    options.debug = debug;
        //    options.newestOnTop = newestOnTop;
        //    options.progressBar = progressBar;
        //    options.preventDuplicates = preventDuplicates;
        //    options.onclick = onClick;
        //    options.showDuration = showDuration;
        //    options.hideDuration = hideDuration;
        //    options.timeOut = timeOut;
        //    options.extendedTimeOut = extendedTimeOut;
        //    switch (showEasing)
        //    {
        //        case EasingType.Linear:
        //            options.showEasing = "linear";
        //            break;
        //        case EasingType.Swing:
        //            options.showEasing = "swing";
        //            break;
        //        case EasingType.Default:
        //            options.showEasing = "default";
        //            break;
        //        default:
        //            options.showEasing = "swing";
        //            break;
        //    }
        //    switch (hideEasing)
        //    {
        //        case EasingType.Linear:
        //            options.hideEasing = "linear";
        //            break;
        //        case EasingType.Swing:
        //            options.hideEasing = "swing";
        //            break;
        //        case EasingType.Default:
        //            options.hideEasing = "default";
        //            break;
        //        default:
        //            options.hideEasing = "linear";
        //            break;
        //    }
        //    switch (showMethod)
        //    {
        //        case EffectType.FadeIn:
        //            options.showMethod = "fadeIn";
        //            break;
        //        case EffectType.FadeOut:
        //            options.showMethod = "fadeOut";
        //            break;
        //        case EffectType.SlideIn:
        //            options.showMethod = "slideIn";
        //            break;
        //        case EffectType.SlideOut:
        //            options.showMethod = "slideOut";
        //            break;
        //        default:
        //            options.showMethod = "fadeIn";
        //            break;
        //    }
        //    switch (hideMethod)
        //    {
        //        case EffectType.FadeIn:
        //            options.hideMethod = "fadeIn";
        //            break;
        //        case EffectType.FadeOut:
        //            options.hideMethod = "fadeOut";
        //            break;
        //        case EffectType.SlideIn:
        //            options.hideMethod = "slideIn";
        //            break;
        //        case EffectType.SlideOut:
        //            options.hideMethod = "slideOut";
        //            break;
        //        default:
        //            options.hideMethod = "fadeOut";
        //            break;
        //    }

        //    Interop.ConfigOptions(options);
        //}

        public void Show(ToastrType toastrType, string message, string title = null)
        {
            Interop.ShowToastr(toastrType, message, title);
        }
예제 #15
0
 public Toastr(string message, string title = "Bilgi", ToastrType toastrType = ToastrType.Info)
 {
     Message    = message;
     Title      = title;
     ToastrType = toastrType;
 }