2017-03-27 49 views
3

我正在使用BotFramework FormFlow。其中一個問題給出了用戶可以選擇的靜態選項列表。當用戶選擇Central Us時,它仍然要求澄清,是否有辦法避免這種情況,因爲用戶選擇的內容很明確。 enter image description hereBot即使在靜態按鈕上也要求澄清

下面的代碼:

 [Prompt("Please choose the region in which the cluster should be created {||}")] 
    public RegionOptions? DesiredGeoRegion; 


    public enum RegionOptions 
    { 
    AustraliaEast, 
    AustraliaSoutheast, 
    BrazilSouth, 
    CanadaCentral, 
    CanadaEast, 
    CentralIndia, 
    CentralUS, 
    EastAsia, 
    EastUS, 
    EastUS2, 
    JapanEast, 
    JapanWest, 
    NorthCentralUS, 
    NorthEurope, 
    SouthCentralUS, 
    SouthIndia, 
    SoutheastAsia, 
    UKNorth, 
    UKSouth2, 
    WestCentralUS, 
    WestEurope, 
    WestIndia, 
    WestUS, 
    WestUS2 
    } 
+0

你能發佈Enum代碼嗎? –

+0

當然,我剛剛添加了Enum代碼 –

回答

2

每文檔,這是預期的行爲,因爲FormFlow將試圖消除歧義時輸入的術語任何其他選項也被發現。在這種情況下,美國中部是第二條消息中顯示的其他選項的一部分。

enter image description here

克服這一點的方法是使用Terms attribute來覆蓋用於匹配的枚舉值,以用戶輸入的默認條款。我試過了,它按預期工作:

public enum RegionOptions 
{ 
    AustraliaEast, 
    AustraliaSoutheast, 
    BrazilSouth, 
    CanadaCentral, 
    CanadaEast, 
    CentralIndia, 
    CentralUS, 
    EastAsia, 
    EastUS, 
    EastUS2, 
    JapanEast, 
    JapanWest, 
    [Terms("North Central US")] 
    NorthCentralUS, 
    NorthEurope, 
    [Terms("South Central US")] 
    SouthCentralUS, 
    SouthIndia, 
    SoutheastAsia, 
    UKNorth, 
    UKSouth2, 
    [Terms("West Central US")] 
    WestCentralUS, 
    WestEurope, 
    WestIndia, 
    WestUS, 
    WestUS2 
} 

請注意,您將看到與EastUS和WestUS選項相同的問題。