Announcement

Collapse
No announcement yet.

Retyped - How to ? (a few examples) ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retyped - How to ? (a few examples) ?

    Are there any example on how to use sweetalert and ej.web.all ?

    Steps so far.

    1) Bridge.Net installed
    2) Bridge Class library project created
    3) install-package retyped
    4) install-package sweetalert
    5) Add using statements

    using Retyped;
    using static Retyped.sweetalert;

    Now ??

    In VS2017 I get dropdown's with swal, sweetAlert, sweetalert, sweetalert2

    swal -> SweetAlert.SweetAlertStatic.Interface sweetalert.swal { get; set }
    sweetAlert -> SweetAlert.SweetAlertStatic.Interface sweetalert.sweetAlert { get; set }
    SweetAlert -> class Retyped.sweetalert.SweetAlert
    sweetalert -> class Retyped.sweetalert
    sweetalert2 -> class Retyped.sweetalert.sweetalert2

    What hints should one look for when using retyped wrappers ?

    Thanks
    Andrew



  • #2
    I was able to get swal working with the following configuration.

    using static Retyped.sweetalert;
    
    namespace Demo
    {
        public class Program
        {
            public static void Main()
            {
                swal.Self("Oops", "Something went wrong");
            }
        }
    }
    Hope this helps.

    Comment


    • #3
      Thanks.. Yes works well.

      There are 7 methods for swal, some of which have Union/Intersections etc (see below):

      swal.Self("Oops","Something went wrong", ????)
      The 3rd param is: Union<SweetAlert.AlertType, SweetAlert.PromtType> type

      or when you have:

      swal.Self(Intersection<SweetAlert.Settings, SweetAlert.PromtModalSettings> settings, SweetAlert.SweetAlertStatic.SelfFn2 callback);
      or

      swal.Self(Intersection<SweetAlert.Settings, SwetAlert.PromtModalSettings> settings);
      Hand converts previously used ENUMs for success/error/warning etc.

      The Retyped uses Unions/Intersections of Classes?

      Thanks for the help, just unsure which way to proceed when callbacks/unions/intersections are params.
      Last edited by geoffrey.mcgill; 2017-10-11 @ 03:38 AM.

      Comment


      • #4
        The type overload can be accomplished with the following, but it's certainly not a clean as I would have hoped.

        swal.Self("Oops", "Something went wrong", Literals.error.As<SweetAlert.PromtType>());
        I think we should be able to improve Retyped to enable some cleaner syntax options.

        Usage sample for the Settings and Callback overloads are a bit of a mystery to me at the moment. We'll figure this out and come up with some solutions.

        The following Edge Cases string literal vs Enum description might be helpful for explaining why enums cannot be used in C# to define string literals from TypeScript.
        https://github.com/Retyped/Retyped/w...iteral-vs-enum

        Comment


        • #5
          Thanks.. That works well.

          As for string vs Enum, ahhh yes.. See that now.

          Callbacks/Settings is the next area I'm playing in..

          Then onto trying ej.web.all for Syncfusion support.

          Comment


          • #6
            Hi CastleSoft ,

            Please take a look at a simple demo project we composed for SweetAlert JS.
            Make sure you're referencing the correct version of SweetAlert library (the one specified in the .d.ts - 1.1.3).
            https://github.com/Retyped/Demos/tre...SweetAlertDemo

            Hope this helps.

            Comment


            • #7
              Thanks.. Works perfectly..!

              Greatly appreciated..

              Comment

              Working...
              X