当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript CardAction.showImage方法代码示例

本文整理汇总了TypeScript中botbuilder.CardAction.showImage方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CardAction.showImage方法的具体用法?TypeScript CardAction.showImage怎么用?TypeScript CardAction.showImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botbuilder.CardAction的用法示例。


在下文中一共展示了CardAction.showImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: request

                (session: any, results: any) => {
                    session.send('Ok!');
                    session.send('Here is the nearest store I have found. A seller will be able to answer your questions. :)');
                    var address = "3 bis, rue rottembourg 75012 PARIS" //results.response;
                    var res = request('GET', 'http://dev.virtualearth.net/REST/v1/Locations?countryRegion=FR&key=AsiCMSmOq6O3MzsI4F7HqUXmB2JY7E76gdaCgtlranURBYOHgbariAXQxJURoTE8&addressLine=' + address);
                    var bing = JSON.parse(res.getBody('utf8'));
                    if (bing.resourceSets[0].estimatedTotal) {
                        let lat = bing.resourceSets[0].resources[0].point.coordinates[0];
                        let lng = bing.resourceSets[0].resources[0].point.coordinates[1];
                        this._store = [Number.MAX_SAFE_INTEGER, null];
                        for (let i = 0, len = this._stores.length; i < len; i++) {
                            let distance = this._geolocalisation.getDistanceFromLatLonInKm(lat, lng, this._stores[i].localisation.lat, this._stores[i].localisation.lng)
                            if (distance < this._store[0]) {
                                this._store[0] = distance;
                                this._store[1] = this._stores[i];
                            }
                        }

                        var msg = new builder.Message(session)
                            .textFormat(builder.TextFormat.xml)
                            .attachmentLayout(builder.AttachmentLayout.carousel)
                            .attachments([
                                new builder.HeroCard(session)
                                    .title(this._store[1].name)
                                    .text("12 Rue Halévy, 75009 Paris")
                                    .images([
                                        builder.CardImage.create(session, "http://www.timstanleyphoto.com/HDR/2012/i-GrS2b37/0/L/MicrosoftStore-L.jpg")
                                            .tap(builder.CardAction.showImage(session, "http://www.timstanleyphoto.com/HDR/2012/i-GrS2b37/0/L/MicrosoftStore-L.jpg")),
                                    ])
                                    .buttons([
                                        builder.CardAction.openUrl(session, "http://bing.com/maps/default.aspx?rtp=adr." + "39%20quai%20du%20president%20roosevelt%2092130%20issy%20les%20moulineaux" + "~adr." + "12 Rue Halévy, 75009 Paris" + "&rtop=0~1~0", "Bing Direction"),
                                        builder.CardAction.imBack(session, "Let's go !", "Go")
                                    ])
                            ]);
                        builder.Prompts.choice(session, msg, "Let's go !");

                    } else {
                        session.send('I cannot find a store near you, try with a different address');
                    }
                },
开发者ID:DXFrance,项目名称:botretail,代码行数:40,代码来源:retailbot.dialogsManager.ts

示例2:

  (session: any) => {
     var msg = new builder.Message(session)
     .textFormat(builder.TextFormat.xml)
     .attachmentLayout(builder.AttachmentLayout.carousel)
     .attachments([
         new builder.HeroCard(session)
             .title("Acer Swift 3")
             .text("Ultra-Thin & Light")
             .images([
                 builder.CardImage.create(session, "http://static.acer.com/up/Resource/Acer/Notebooks/Swift%203/Photogallery/20160823/Swift-3_Fingerprint_gold_gallery_04.png")
                     .tap(builder.CardAction.showImage(session, "http://www.acer.com/ac/en/US/content/series/swift3"))
             ])
             .buttons([
                 builder.CardAction.openUrl(session, "https://www.bing.com/", "Buy online"),
                 builder.CardAction.imBack(session, "Acer Swift 3", "Real store")
             ]),
         new builder.HeroCard(session)
             .title("ASUS UX 360")
             .text("360° of Freedom. 100% ZenBook.")
             .images([
                 builder.CardImage.create(session, "http://www.ultrabookreview.com/wp-content/uploads/2016/06/asus-zenbook-ux360-3.jpg")
                     .tap(builder.CardAction.showImage(session, "https://www.asus.com/us/Notebooks/ASUS-ZenBook-Flip-UX360CA/"))
             ])
             .buttons([
                 builder.CardAction.openUrl(session, "https://www.bing.com/", "Buy online"),
                 builder.CardAction.imBack(session, "ASUS UX 360", "Real store")
             ]),
         new builder.HeroCard(session)
             .title("LENOVO YOGA 900")
             .text("The Yoga 900 is unbelievably thin and elegant.")
             .images([
                 builder.CardImage.create(session, "http://winsupersite.com/site-files/winsupersite.com/files/gallery_images/02_Hero_Shot_VIDEO_Gold.jpg?1445276665")
                     .tap(builder.CardAction.showImage(session, "http://winsupersite.com/site-files/winsupersite.com/files/gallery_images/02_Hero_Shot_VIDEO_Gold.jpg?1445276665"))
             ])
             .buttons([
                 builder.CardAction.openUrl(session, "https://www.bing.com/", "Buy online"),
                 builder.CardAction.imBack(session, "LENOVO YOGA 900", "Real store")
             ]),
         new builder.HeroCard(session)
             .title("SAMSUNG TAB PRO S")
             .text("Work and Fun.")
             .images([
                 builder.CardImage.create(session, "http://www.samsung.com/us/explore/tab-pro-s-features-and-specs/assets/images/configurator/desktop/tabpro-s_black.jpg")
                     .tap(builder.CardAction.showImage(session, "http://www.samsung.com/us/explore/tab-pro-s-features-and-specs/"))
             ])
             .buttons([
                 builder.CardAction.openUrl(session, "https://www.bing.com/", "Buy online"),
                 builder.CardAction.imBack(session, "SAMSUNG TAB PRO S", "Real store")
             ]),
          new builder.HeroCard(session)
             .title("HP Spectre X360")
             .text("360 degrees of versatility. Zero compromises.")
             .images([
                 builder.CardImage.create(session, "http://images.techhive.com/images/article/2015/10/hp-spectre_x360_media-mode_right-facing-100620373-large.jpg")
                     .tap(builder.CardAction.showImage(session, "http://store.hp.com/us/en/mdp/Laptops/spectre-x360-211501--1"))
             ])
             .buttons([
                 builder.CardAction.openUrl(session, "https://www.bing.com/", "Buy online"),
                 builder.CardAction.imBack(session, "HP Spectre X360", "Real store")
             ]),
         new builder.HeroCard(session)
             .title("I don't know !")
             .text("Help me to choose.")
             .images([
                 builder.CardImage.create(session, "http://www.silicon.fr/wp-content/uploads/2016/06/Windows-10-684x513.jpg")
                     .tap(builder.CardAction.showImage(session, "http://xpsbydell.com/?dgc=IR&cid=XPSfamily-263489&lid=2-1&ref=bnn"))
             ])
             .buttons([
                 builder.CardAction.imBack(session, "I don't know", "I don't know")
             ])
     ]);
     builder.Prompts.choice(session, msg, "Acer Swift 3|ASUS UX 360|SAMSUNG TAB PRO S|LENOVO YOGA 900|HP Spectre X360|I don't know");
 },
开发者ID:DXFrance,项目名称:botretail,代码行数:73,代码来源:retailbot.dialogsManager.ts


注:本文中的botbuilder.CardAction.showImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。