diff --git a/template-bot-master-csharp/DialogMatches.cs b/template-bot-master-csharp/DialogMatches.cs index a9462d1..1eab410 100644 --- a/template-bot-master-csharp/DialogMatches.cs +++ b/template-bot-master-csharp/DialogMatches.cs @@ -56,5 +56,17 @@ public static class DialogMatches public const string MessageBack = "msgback"; public const string LocalTime = "localtime"; + + public const string HeroCard = "hero card"; + public const string ThumbnailCard = "thumbnail card"; + + public const string ConnectorCardV1 = "connectorcardv1"; + public const string ConnectorCardV2 = "connectorcardv2"; + public const string ConnectorCardV3 = "connectorcardv3"; + + public const string ActionableCard = "actionablecard"; + public const string ActionableCardV2 = "actionablecardv2"; + + public const string PopUpSignIn = "signin"; } } \ No newline at end of file diff --git a/template-bot-master-csharp/Properties/Strings.Designer.cs b/template-bot-master-csharp/Properties/Strings.Designer.cs index 4d582dd..6d4494a 100644 --- a/template-bot-master-csharp/Properties/Strings.Designer.cs +++ b/template-bot-master-csharp/Properties/Strings.Designer.cs @@ -186,6 +186,15 @@ internal static string cmdLocalTime { } } + /// + /// Looks up a localized string similar to msgback. + /// + internal static string cmdMessageBack { + get { + return ResourceManager.GetString("cmdMessageBack", resourceCulture); + } + } + /// /// Looks up a localized string similar to multi dialog 1. /// @@ -222,6 +231,15 @@ internal static string cmdO365ConnectorCardActionableMessages { } } + /// + /// Looks up a localized string similar to signin. + /// + internal static string cmdPopUpSignIn { + get { + return ResourceManager.GetString("cmdPopUpSignIn", resourceCulture); + } + } + /// /// Looks up a localized string similar to prompt. /// @@ -448,7 +466,7 @@ internal static string DisplayCardErrorMsg { } /// - /// Looks up a localized string similar to Hero. + /// Looks up a localized string similar to Hero Card. /// internal static string DisplayCardHeroCard { get { @@ -457,7 +475,7 @@ internal static string DisplayCardHeroCard { } /// - /// Looks up a localized string similar to Actionable Card. + /// Looks up a localized string similar to ActionableCard. /// internal static string DisplayCardO365ConnectorActionableCard { get { @@ -466,7 +484,16 @@ internal static string DisplayCardO365ConnectorActionableCard { } /// - /// Looks up a localized string similar to O365ConnectorCard V1. + /// Looks up a localized string similar to ActionableCardV2. + /// + internal static string DisplayCardO365ConnectorActionableCardV2 { + get { + return ResourceManager.GetString("DisplayCardO365ConnectorActionableCardV2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ConnectorCardV1. /// internal static string DisplayCardO365ConnectorCardV1 { get { @@ -475,7 +502,7 @@ internal static string DisplayCardO365ConnectorCardV1 { } /// - /// Looks up a localized string similar to O365ConnectorCard V2. + /// Looks up a localized string similar to ConnectorCardV2. /// internal static string DisplayCardO365ConnectorCardV2 { get { @@ -484,7 +511,7 @@ internal static string DisplayCardO365ConnectorCardV2 { } /// - /// Looks up a localized string similar to O365ConnectorCard V3. + /// Looks up a localized string similar to ConnectorCardV3. /// internal static string DisplayCardO365ConnectorCardV3 { get { @@ -520,7 +547,7 @@ internal static string DisplayCardsThanksMsg { } /// - /// Looks up a localized string similar to Thumbnail. + /// Looks up a localized string similar to Thumbnail Card. /// internal static string DisplayCardThumbnailCard { get { @@ -735,6 +762,15 @@ internal static string HelpCaptionHelloDialog { } } + /// + /// Looks up a localized string similar to Message Back. + /// + internal static string HelpCaptionMessageBack { + get { + return ResourceManager.GetString("HelpCaptionMessageBack", resourceCulture); + } + } + /// /// Looks up a localized string similar to Begin Multi Dailog 1. /// @@ -762,6 +798,15 @@ internal static string HelpCaptionPlayGame { } } + /// + /// Looks up a localized string similar to Popup Signin. + /// + internal static string HelpCaptionPopUpSignIn { + get { + return ResourceManager.GetString("HelpCaptionPopUpSignIn", resourceCulture); + } + } + /// /// Looks up a localized string similar to Fetch Roster Payload. /// @@ -879,6 +924,15 @@ internal static string HeroCardTitle { } } + /// + /// Looks up a localized string similar to ActionableMessageCardDialog. + /// + internal static string LastDialogActionableMessageDialog { + get { + return ResourceManager.GetString("LastDialogActionableMessageDialog", resourceCulture); + } + } + /// /// Looks up a localized string similar to AtMentionDialog. /// @@ -906,6 +960,33 @@ internal static string LastDialogConnectorCard { } } + /// + /// Looks up a localized string similar to ConnectorCardV1Dialog. + /// + internal static string LastDialogConnectorCardV1Dialog { + get { + return ResourceManager.GetString("LastDialogConnectorCardV1Dialog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ConnectorCardV2Dialog. + /// + internal static string LastDialogConnectorCardV2Dialog { + get { + return ResourceManager.GetString("LastDialogConnectorCardV2Dialog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ConnectorCardV3Dialog. + /// + internal static string LastDialogConnectorCardV3Dialog { + get { + return ResourceManager.GetString("LastDialogConnectorCardV3Dialog", resourceCulture); + } + } + /// /// Looks up a localized string similar to DeepLinkStaticTabDialog. /// @@ -1041,6 +1122,15 @@ internal static string LastDialogMultiDialog2 { } } + /// + /// Looks up a localized string similar to PopUpSignInDialog. + /// + internal static string LastDialogPopUpSignIn { + get { + return ResourceManager.GetString("LastDialogPopUpSignIn", resourceCulture); + } + } + /// /// Looks up a localized string similar to Last response was from dialog: . /// @@ -1194,6 +1284,15 @@ internal static string MessageBackPayloadText { } } + /// + /// Looks up a localized string similar to This is Message Back example. + /// + internal static string MessageBackTitleMsg { + get { + return ResourceManager.GetString("MessageBackTitleMsg", resourceCulture); + } + } + /// /// Looks up a localized string similar to Multi Dialog Card Sub Title.. /// @@ -1581,6 +1680,24 @@ internal static string PlayGameWrongChoice { } } + /// + /// Looks up a localized string similar to SignIn. + /// + internal static string PopUpSignInCardButtonTitle { + get { + return ResourceManager.GetString("PopUpSignInCardButtonTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please click below for Popup SignIn experience. + /// + internal static string PopUpSignInCardTitle { + get { + return ResourceManager.GetString("PopUpSignInCardTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ooops, what you choose is not a valid option, please try again!!. /// @@ -1707,6 +1824,15 @@ internal static string SetUpMsgKey { } } + /// + /// Looks up a localized string similar to MS Teams: Attempted access from a different Office 365 tenant: message rejected. + /// + internal static string TenantLevelDeniedAccess { + get { + return ResourceManager.GetString("TenantLevelDeniedAccess", resourceCulture); + } + } + /// /// Looks up a localized string similar to Thanks for searching the Roster Api.. /// diff --git a/template-bot-master-csharp/Properties/Strings.resx b/template-bot-master-csharp/Properties/Strings.resx index f7618d8..685adec 100644 --- a/template-bot-master-csharp/Properties/Strings.resx +++ b/template-bot-master-csharp/Properties/Strings.resx @@ -397,16 +397,16 @@ no - Hero + Hero Card - O365ConnectorCard V1 + ConnectorCardV1 - O365ConnectorCard V2 + ConnectorCardV2 - O365ConnectorCard V3 + ConnectorCardV3 What card you would like to test? @@ -418,7 +418,7 @@ Hope you liked the Cards!! - Thumbnail + Thumbnail Card Choose Cards @@ -742,9 +742,51 @@ composeextension/querysettingurl - Actionable Card + ActionableCard Actionable Card + + ActionableMessageCardDialog + + + ConnectorCardV1Dialog + + + ConnectorCardV2Dialog + + + ConnectorCardV3Dialog + + + MS Teams: Attempted access from a different Office 365 tenant: message rejected + + + ActionableCardV2 + + + PopUpSignInDialog + + + signin + + + Popup Signin + + + SignIn + + + Please click below for Popup SignIn experience + + + msgback + + + Message Back + + + This is Message Back example + \ No newline at end of file diff --git a/template-bot-master-csharp/Web.config b/template-bot-master-csharp/Web.config index 06f7c58..fb160c1 100644 --- a/template-bot-master-csharp/Web.config +++ b/template-bot-master-csharp/Web.config @@ -12,7 +12,8 @@ - + + @@ -36,6 +37,8 @@ + + @@ -95,11 +98,11 @@ - + - + diff --git a/template-bot-master-csharp/middleware/Middleware.cs b/template-bot-master-csharp/middleware/Middleware.cs new file mode 100644 index 0000000..278a85e --- /dev/null +++ b/template-bot-master-csharp/middleware/Middleware.cs @@ -0,0 +1,25 @@ +using System; +using Microsoft.Bot.Connector; +using System.Configuration; +using Microsoft.Bot.Connector.Teams.Models; + +namespace Microsoft.Teams.TemplateBotCSharp.Utility +{ + public static class Middleware + { + public static bool RestrictBotForTenant(IMessageActivity activity) + { + string targetTenant = ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"] != null ? ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"].ToString() : null; + string currentTanent = (activity != null && activity.ChannelData != null && activity.ChannelData["tenant"] != null) ? Convert.ToString(activity.ChannelData["tenant"]["id"]) : null; + + if (string.Equals(targetTenant, currentTanent)) + { + return true; + } + else + { + return false; + } + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/packages.config b/template-bot-master-csharp/packages.config index c8ddb7e..b42d491 100644 --- a/template-bot-master-csharp/packages.config +++ b/template-bot-master-csharp/packages.config @@ -1,12 +1,13 @@  - + - + + diff --git a/template-bot-master-csharp/popUpSignin.html b/template-bot-master-csharp/popUpSignin.html new file mode 100644 index 0000000..08e1449 --- /dev/null +++ b/template-bot-master-csharp/popUpSignin.html @@ -0,0 +1,27 @@ + + + + + + + + + +
+ User Name : +
+ +
+
+ Password : +
+ + + + \ No newline at end of file diff --git a/template-bot-master-csharp/public/assets/ActionableCardIconImage.png b/template-bot-master-csharp/public/assets/ActionableCardIconImage.png new file mode 100644 index 0000000..4ca7743 Binary files /dev/null and b/template-bot-master-csharp/public/assets/ActionableCardIconImage.png differ diff --git a/template-bot-master-csharp/src/controllers/MessagesController.cs b/template-bot-master-csharp/src/controllers/MessagesController.cs index 0b6b586..b6ed88e 100644 --- a/template-bot-master-csharp/src/controllers/MessagesController.cs +++ b/template-bot-master-csharp/src/controllers/MessagesController.cs @@ -28,6 +28,22 @@ public async Task Post([FromBody]Activity activity) activity.Locale = TemplateUtility.GetLocale(activity); var messageActivity = StripBotAtMentions.StripAtMentionText(activity); + + //UnComment the below code to restrict the Bot for Specific Tenant + //Set the OFFICE_365_TENANT_FILTER key in web.config file with Tenant Information + + //Restrict the bot for specific teams tenant + //if(!Middleware.RestrictBotForTenant(activity)) + //{ + // var connectorClient = new ConnectorClient(new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/")); + + // Activity replyActivity = activity.CreateReply(); + // replyActivity.Text = Strings.TenantLevelDeniedAccess; + + // await connectorClient.Conversations.ReplyToActivityAsync(replyActivity); + // return null; + //} + try { await Conversation.SendAsync(messageActivity, () => new Dialogs.RootDialog()); @@ -57,6 +73,10 @@ public async Task Post([FromBody]Activity activity) { messageActivity = ParseInvokeActivityRequest.ParseO365ConnectorCardInvokeRequest(activity); } + else if (activity.Name == "signin/verifyState") + { + return await PopUpSignInSuccessResponse(activity); + } else { messageActivity = ParseInvokeActivityRequest.ParseInvokeRequest(activity); @@ -296,5 +316,18 @@ private static async Task HandleO365ConnectorCardActionQuer return new HttpResponseMessage(HttpStatusCode.OK); } + + private static async Task PopUpSignInSuccessResponse(Activity activity) + { + var connectorClient = new ConnectorClient(new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/")); + + Activity replyActivity = activity.CreateReply(); + + replyActivity.Text = $@"Authentication Successful"; + + await connectorClient.Conversations.ReplyToActivityWithRetriesAsync(replyActivity); + + return new HttpResponseMessage(HttpStatusCode.OK); + } } } \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/RootDialog.cs b/template-bot-master-csharp/src/dialogs/RootDialog.cs index 87a8699..59ab4f2 100644 --- a/template-bot-master-csharp/src/dialogs/RootDialog.cs +++ b/template-bot-master-csharp/src/dialogs/RootDialog.cs @@ -374,5 +374,93 @@ public async Task VSTSAuthGetWorkItemDialog(IDialogContext context, IActivity ac } #endregion + + #region Load Hero Card Type + + [RegexPattern(DialogMatches.HeroCard)] + [ScorableGroup(1)] + public async Task HeroCard(IDialogContext context, IActivity activity) + { + context.Call(new HeroCardDialog(), this.EndDialog); + } + + #endregion + + #region Load Thumbnail Card Type + + [RegexPattern(DialogMatches.ThumbnailCard)] + [ScorableGroup(1)] + public async Task ThumbnailCard(IDialogContext context, IActivity activity) + { + context.Call(new ThumbnailcardDialog(), this.EndDialog); + } + + #endregion + + #region Load Connector Card V1 + + [RegexPattern(DialogMatches.ConnectorCardV1)] + [ScorableGroup(1)] + public async Task O365ConnectorCardV1(IDialogContext context, IActivity activity) + { + context.Call(new ConnectorCardV1Dialog(), this.EndDialog); + } + + #endregion + + #region Load Connector Card V2 + + [RegexPattern(DialogMatches.ConnectorCardV2)] + [ScorableGroup(1)] + public async Task O365ConnectorCardV2(IDialogContext context, IActivity activity) + { + context.Call(new ConnectorCardV2Dialog(), this.EndDialog); + } + + #endregion + + #region Load Connector Card V3 + + [RegexPattern(DialogMatches.ConnectorCardV3)] + [ScorableGroup(1)] + public async Task O365ConnectorCardV3(IDialogContext context, IActivity activity) + { + context.Call(new ConnectorCardV3Dialog(), this.EndDialog); + } + + #endregion + + #region Load Actionable Message Card + + [RegexPattern(DialogMatches.ActionableCard)] + [ScorableGroup(1)] + public async Task O365ConnectorCardActionableMessage(IDialogContext context, IActivity activity) + { + context.Call(new ActionableMessageCardDialog(), this.EndDialog); + } + + #endregion + + #region Load Actionable Message Card V2 + + [RegexPattern(DialogMatches.ActionableCardV2)] + [ScorableGroup(1)] + public async Task O365ConnectorCardActionableMessageV2(IDialogContext context, IActivity activity) + { + context.Call(new ActionableMessageCardDialogV2(), this.EndDialog); + } + + #endregion + + #region PopUp SignIn + + [RegexPattern(DialogMatches.PopUpSignIn)] + [ScorableGroup(1)] + public async Task PopUpSignIn(IDialogContext context, IActivity activity) + { + context.Call(new PopupSigninCardDialog(), this.EndDialog); + } + + #endregion } } \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs similarity index 73% rename from template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs rename to template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs index 7a058de..6f7b5c8 100644 --- a/template-bot-master-csharp/src/dialogs/examples/basic/O365ConnectorCardDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialog.cs @@ -1,24 +1,22 @@ using Microsoft.Bot.Builder.Dialogs; -using Microsoft.Bot.Connector; -using Microsoft.Bot.Connector.Teams.Models; -using Microsoft.Teams.TemplateBotCSharp.Properties; -using Microsoft.Teams.TemplateBotCSharp.Utility; using System; -using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using Microsoft.Bot.Connector.Teams.Models; namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is Actionable Card Dialog Class. Main purpose of this class is to show example of Actionable feature sample like + /// MultiChoice, Date, Dropdown and Text /// [Serializable] - public class O365ConnectorCardDialog : IDialog + public class ActionableMessageCardDialog : IDialog { - public string O365ConnectorCardChoice = string.Empty; - public async Task StartAsync(IDialogContext context) { if (context == null) @@ -27,118 +25,23 @@ public async Task StartAsync(IDialogContext context) } //Set the Last Dialog in Conversation Data - context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogConnectorCard); + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogActionableMessageDialog); var message = context.MakeMessage(); - var attachment = GetO365ConnectorCardAttachment(context); + var attachment = CreateSampleO365ConnectorCard(); message.Attachments.Add(attachment); - if (!O365ConnectorCardChoice.Equals(Strings.cmdO365ConnectorCardActionableMessages)) - { - message.Attachments.Add(TemplateUtility.GetChoiceOptionCard()); - } - - await context.PostAsync((message)); + await context.PostAsync((message)); context.Done(null); } - private static Attachment GetO365ConnectorCardV1() - { - var o365connector = new O365ConnectorCard - { - Title = Strings.O365V1Title, - Sections = new List - { - new O365ConnectorCardSection{ Text= Strings.O365V1Section1 }, - new O365ConnectorCardSection{ Text= Strings.O365V1Section2 } - }, - }; - - return o365connector.ToAttachment(); - } - - private static Attachment GetO365ConnectorCardV2() - { - var section = new O365ConnectorCardSection - { - Title = Strings.O365V2Title, - ActivityTitle = Strings.O365V2ActivityTitle, - Facts = new List - { - new O365ConnectorCardFact(Strings.O365V2Fact1Key,Strings.O365V2Fact1Value), - new O365ConnectorCardFact(Strings.O365V2Fact2Key,Strings.O365V2Fact2Value), - new O365ConnectorCardFact(Strings.O365V2Fact3Key,Strings.O365V2Fact3Value), - new O365ConnectorCardFact(Strings.O365V2Fact4Key,Strings.O365V2Fact4Value) - } - }; - - var o365connector = new O365ConnectorCard - { - ThemeColor = Strings.O365V2themecolor, - Sections = new List { section }, - }; - - return o365connector.ToAttachment(); - } - - private static Attachment GetO365ConnectorCardV3() - { - var section = new O365ConnectorCardSection - { - ActivityTitle = Strings.O365V3ActivityTitle, - ActivitySubtitle = Strings.O365V3ActivitySubtitle, - ActivityImage = Strings.O365V3ImageUrl, - Facts = new List - { - new O365ConnectorCardFact(Strings.O365V3Fact1Key,Strings.O365V3Fact1Value), - new O365ConnectorCardFact(Strings.O365V3Fact2Key,Strings.O365V3Fact2Value), - } - }; - - var o365connector = new O365ConnectorCard - { - ThemeColor = Strings.O365V3ThemeColor, - Summary = Strings.O365V3Summary, - Title = Strings.O365V3Title, - Sections = new List { section }, - Text = Strings.O365V3Text - }; - - return o365connector.ToAttachment(); - } - - private Attachment GetO365ConnectorCardAttachment(IDialogContext context) - { - if (context.UserData.TryGetValue("O365ConnectorCardChoice", out O365ConnectorCardChoice)) - { - if (O365ConnectorCardChoice.Equals(Strings.DisplayCardO365ConnectorCardV1)) - { - return GetO365ConnectorCardV1(); - } - else if (O365ConnectorCardChoice.Equals(Strings.DisplayCardO365ConnectorCardV2)) - { - return GetO365ConnectorCardV2(); - } - else if (O365ConnectorCardChoice.Equals(Strings.DisplayCardO365ConnectorCardV3)) - { - return GetO365ConnectorCardV3(); - } - else if (O365ConnectorCardChoice.Equals(Strings.cmdO365ConnectorCardActionableMessages)) - { - return CreateSampleO365ConnectorCard(); - } - } - - return GetO365ConnectorCardV1(); - } - /// /// Create a sample O365 connector card. /// /// The result card with actions. /// - private static Attachment CreateSampleO365ConnectorCard() + public static Attachment CreateSampleO365ConnectorCard() { #region Multichoice Card var multichoiceCard = new O365ConnectorCardActionCard( diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialogV2.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialogV2.cs new file mode 100644 index 0000000..e0f3007 --- /dev/null +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ActionableMessageCardDialogV2.cs @@ -0,0 +1,181 @@ +using Microsoft.Bot.Builder.Dialogs; +using System; +using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using Microsoft.Bot.Connector.Teams.Models; +using System.Configuration; + +namespace Microsoft.Teams.TemplateBotCSharp.Dialogs +{ + /// + /// This is Actionable Card Dialog Class. Main purpose of this class is to show example of Actionable feature sample like + /// MultiChoice, Date, Dropdown and Text + /// + + [Serializable] + public class ActionableMessageCardDialogV2 : IDialog + { + public async Task StartAsync(IDialogContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + //Set the Last Dialog in Conversation Data + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogActionableMessageDialog); + + //Get the Config Base Uri + + string baseUri = Convert.ToString(ConfigurationManager.AppSettings["BaseUri"]); + + var message = context.MakeMessage(); + var attachment = CreateSampleO365ConnectorCard(baseUri); + message.Attachments.Add(attachment); + + await context.PostAsync((message)); + + context.Done(null); + } + + /// + /// Create a sample O365 connector card. + /// + /// The result card with actions. + /// + public static Attachment CreateSampleO365ConnectorCard(string baseUri) + { + string imageUrl = baseUri + "/public/assets/ActionableCardIconImage.png"; + #region Multichoice Card + var multichoiceCard = new O365ConnectorCardActionCard( + O365ConnectorCardActionCard.Type, + "Multiple Choice", + "Multiple Choice Card", + new List + { + new O365ConnectorCardMultichoiceInput( + O365ConnectorCardMultichoiceInput.Type, + "CardsType", + true, + "Pick multiple options", + null, + new List + { + new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"), + new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"), + new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card") + }, + "expanded", + true), + new O365ConnectorCardMultichoiceInput( + O365ConnectorCardMultichoiceInput.Type, + "Teams", + true, + "Pick multiple options", + null, + new List + { + new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"), + new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"), + new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"), + new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension") + }, + "compact", + true) + }, + + new List + { + new O365ConnectorCardHttpPOST + ( + O365ConnectorCardHttpPOST.Type, + "Send", + "multichoice", + @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}""}") + }); + + #endregion + + #region Input Card + var inputCard = new O365ConnectorCardActionCard( + O365ConnectorCardActionCard.Type, + "Text Input", + "Input Card", + new List + { + new O365ConnectorCardTextInput( + O365ConnectorCardTextInput.Type, + "text-1", + false, + "multiline, no maxLength", + null, + true, + null) + }, + new List + { + new O365ConnectorCardHttpPOST( + O365ConnectorCardHttpPOST.Type, + "Send", + "inputText", + @"{""text1"":""{{text-1.value}}""}") + }); + #endregion + + #region Date Card + var dateCard = new O365ConnectorCardActionCard( + O365ConnectorCardActionCard.Type, + "Date Input", + "Date Card", + new List + { + new O365ConnectorCardDateInput( + O365ConnectorCardDateInput.Type, + "date-2", + false, + "date only", + null, + false) + }, + new List + { + new O365ConnectorCardHttpPOST( + O365ConnectorCardHttpPOST.Type, + "Send", + "dateInput", + @"{""date1"":""{{date-1.value}}""") + }); + #endregion + + var section = new O365ConnectorCardSection( + "", + "", + "Actionable Message", + "", + "This is an actionable message card. You can add operations within the card.", + imageUrl, + true, + null, + null); + + O365ConnectorCard card = new O365ConnectorCard() + { + Summary = "O365 card summary", + ThemeColor = "#E67A9E", + Sections = new List { section }, + + PotentialAction = new List + { + multichoiceCard, + inputCard, + dateCard + } + }; + + return card.ToAttachment(); + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV1Dialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV1Dialog.cs new file mode 100644 index 0000000..b309577 --- /dev/null +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV1Dialog.cs @@ -0,0 +1,53 @@ +using Microsoft.Bot.Builder.Dialogs; +using System; +using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using Microsoft.Bot.Connector.Teams.Models; + +namespace Microsoft.Teams.TemplateBotCSharp.Dialogs +{ + /// + /// This is Connector Card Dialog Class. Main purpose of this class is to display the Connector Card basic example + /// + + [Serializable] + public class ConnectorCardV1Dialog : IDialog + { + public async Task StartAsync(IDialogContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + //Set the Last Dialog in Conversation Data + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogConnectorCardV1Dialog); + + var message = context.MakeMessage(); + var attachment = GetO365ConnectorCardV1Attachment(); + message.Attachments.Add(attachment); + + await context.PostAsync((message)); + + context.Done(null); + } + + public static Attachment GetO365ConnectorCardV1Attachment() + { + var o365connector = new O365ConnectorCard + { + Title = Strings.O365V1Title, + Sections = new List + { + new O365ConnectorCardSection{ Text= Strings.O365V1Section1 }, + new O365ConnectorCardSection{ Text= Strings.O365V1Section2 } + }, + }; + + return o365connector.ToAttachment(); + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV2Dialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV2Dialog.cs new file mode 100644 index 0000000..92e00b0 --- /dev/null +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV2Dialog.cs @@ -0,0 +1,62 @@ +using Microsoft.Bot.Builder.Dialogs; +using System; +using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using Microsoft.Bot.Connector.Teams.Models; + +namespace Microsoft.Teams.TemplateBotCSharp.Dialogs +{ + /// + /// This is Connector Card V2 Dialog Class. Main purpose of this class is to display the Connector Card moderate information example + /// + + [Serializable] + public class ConnectorCardV2Dialog : IDialog + { + public async Task StartAsync(IDialogContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + //Set the Last Dialog in Conversation Data + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogConnectorCardV2Dialog); + + var message = context.MakeMessage(); + var attachment = GetO365ConnectorCardV2(); + message.Attachments.Add(attachment); + + await context.PostAsync((message)); + + context.Done(null); + } + + public static Attachment GetO365ConnectorCardV2() + { + var section = new O365ConnectorCardSection + { + Title = Strings.O365V2Title, + ActivityTitle = Strings.O365V2ActivityTitle, + Facts = new List + { + new O365ConnectorCardFact(Strings.O365V2Fact1Key,Strings.O365V2Fact1Value), + new O365ConnectorCardFact(Strings.O365V2Fact2Key,Strings.O365V2Fact2Value), + new O365ConnectorCardFact(Strings.O365V2Fact3Key,Strings.O365V2Fact3Value), + new O365ConnectorCardFact(Strings.O365V2Fact4Key,Strings.O365V2Fact4Value) + } + }; + + var o365connector = new O365ConnectorCard + { + ThemeColor = Strings.O365V2themecolor, + Sections = new List { section }, + }; + + return o365connector.ToAttachment(); + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV3Dialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV3Dialog.cs new file mode 100644 index 0000000..71f345a --- /dev/null +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ConnectorCardV3Dialog.cs @@ -0,0 +1,64 @@ +using Microsoft.Bot.Builder.Dialogs; +using System; +using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using Microsoft.Bot.Connector.Teams.Models; + +namespace Microsoft.Teams.TemplateBotCSharp.Dialogs +{ + /// + /// This is Connector Card V3 Dialog Class. Main purpose of this class is to display the Connector Card verbose information example + /// + + [Serializable] + public class ConnectorCardV3Dialog : IDialog + { + public async Task StartAsync(IDialogContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + //Set the Last Dialog in Conversation Data + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogConnectorCardV3Dialog); + + var message = context.MakeMessage(); + var attachment = GetO365ConnectorCardV3(); + message.Attachments.Add(attachment); + + await context.PostAsync((message)); + + context.Done(null); + } + + public static Attachment GetO365ConnectorCardV3() + { + var section = new O365ConnectorCardSection + { + ActivityTitle = Strings.O365V3ActivityTitle, + ActivitySubtitle = Strings.O365V3ActivitySubtitle, + ActivityImage = Strings.O365V3ImageUrl, + Facts = new List + { + new O365ConnectorCardFact(Strings.O365V3Fact1Key,Strings.O365V3Fact1Value), + new O365ConnectorCardFact(Strings.O365V3Fact2Key,Strings.O365V3Fact2Value), + } + }; + + var o365connector = new O365ConnectorCard + { + ThemeColor = Strings.O365V3ThemeColor, + Summary = Strings.O365V3Summary, + Title = Strings.O365V3Title, + Sections = new List { section }, + Text = Strings.O365V3Text + }; + + return o365connector.ToAttachment(); + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/GetLastDialogUsedDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/GetLastDialogUsedDialog.cs index c65f472..4512907 100644 --- a/template-bot-master-csharp/src/dialogs/examples/basic/GetLastDialogUsedDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/basic/GetLastDialogUsedDialog.cs @@ -5,8 +5,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is get Last Dialog Class. Main purpose of this class is to set the Last Active dialog information /// [Serializable] diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/HeroCardDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/HeroCardDialog.cs index 2f176ca..aa7a535 100644 --- a/template-bot-master-csharp/src/dialogs/examples/basic/HeroCardDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/basic/HeroCardDialog.cs @@ -5,12 +5,12 @@ using Microsoft.Bot.Connector; using System.Collections.Generic; using Microsoft.Teams.TemplateBotCSharp.Utility; +using System.Globalization; namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is Hero Card Dialog Class. Main purpose of this class is to display the Hero Card example /// [Serializable] @@ -30,7 +30,6 @@ public async Task StartAsync(IDialogContext context) var attachment = GetHeroCard(); message.Attachments.Add(attachment); - message.Attachments.Add(TemplateUtility.GetChoiceOptionCard()); await context.PostAsync((message)); diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/MessagebackDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/MessagebackDialog.cs index fbca91d..df808dd 100644 --- a/template-bot-master-csharp/src/dialogs/examples/basic/MessagebackDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/basic/MessagebackDialog.cs @@ -5,8 +5,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is Message Back Dialog Class. Main purpose of this class is to show example of Message Back event /// [Serializable] @@ -22,7 +21,7 @@ public async Task StartAsync(IDialogContext context) //Set the Last Dialog in Conversation Data context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogMessageBackDialog); - await context.PostAsync("This is Message Back example"); + await context.PostAsync(Strings.MessageBackTitleMsg); context.Done(null); } diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/PopupSigninCardDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/PopupSigninCardDialog.cs new file mode 100644 index 0000000..37600b2 --- /dev/null +++ b/template-bot-master-csharp/src/dialogs/examples/basic/PopupSigninCardDialog.cs @@ -0,0 +1,53 @@ +using Microsoft.Bot.Builder.Dialogs; +using System; +using System.Threading.Tasks; +using Microsoft.Teams.TemplateBotCSharp.Properties; +using Microsoft.Bot.Connector; +using System.Collections.Generic; +using Microsoft.Teams.TemplateBotCSharp.Utility; +using System.Globalization; + +namespace Microsoft.Teams.TemplateBotCSharp.Dialogs +{ + /// + /// This is PopUp SignIn Dialog Class. Main purpose of this class is to Display the PopUp SignIn Card + /// + + [Serializable] + public class PopupSigninCardDialog : IDialog + { + public async Task StartAsync(IDialogContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + //Set the Last Dialog in Conversation Data + context.UserData.SetValue(Strings.LastDialogKey, Strings.LastDialogPopUpSignIn); + + var message = context.MakeMessage(); + var attachment = GetPopUpSignInCard(); + + message.Attachments.Add(attachment); + + await context.PostAsync((message)); + + context.Done(null); + } + + private static Attachment GetPopUpSignInCard() + { + var heroCard = new HeroCard + { + Title = Strings.PopUpSignInCardTitle, + Buttons = new List + { + new CardAction(ActionTypes.Signin, Strings.PopUpSignInCardButtonTitle, value: "https://6ec1bbac.ngrok.io/popUpSignin.html"), + } + }; + + return heroCard.ToAttachment(); + } + } +} \ No newline at end of file diff --git a/template-bot-master-csharp/src/dialogs/examples/basic/ThumbnailcardDialog.cs b/template-bot-master-csharp/src/dialogs/examples/basic/ThumbnailcardDialog.cs index 81fb1d2..df6a3fc 100644 --- a/template-bot-master-csharp/src/dialogs/examples/basic/ThumbnailcardDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/basic/ThumbnailcardDialog.cs @@ -9,8 +9,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is Thumbnail Card Dialog Class. Main purpose of this class is to display the Thumbnail Card example /// [Serializable] @@ -30,7 +29,6 @@ public async Task StartAsync(IDialogContext context) var attachment = GetThumbnailCard(); message.Attachments.Add(attachment); - message.Attachments.Add(TemplateUtility.GetChoiceOptionCard()); await context.PostAsync((message)); diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/DeepLinkStaticTabDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/DeepLinkStaticTabDialog.cs index 6f6477c..96db16c 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/DeepLinkStaticTabDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/DeepLinkStaticTabDialog.cs @@ -10,8 +10,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Begin Dialog Class. Main purpose of this class is to notify users that Child dialog has been called - /// and its a Basic example to call Child dialog from Root Dialog. + /// This is DeepLink Dialog Class. Main purpose of this class is to show Depp link from Bot to Tab example /// [Serializable] diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/DisplayCardsDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/DisplayCardsDialog.cs index e0c3742..59cb8a4 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/DisplayCardsDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/DisplayCardsDialog.cs @@ -15,7 +15,7 @@ public class DisplayCardsDialog : IDialog public DisplayCardsDialog() { - options = new List { Strings.DisplayCardHeroCard, Strings.DisplayCardThumbnailCard, Strings.DisplayCardO365ConnectorCardV1, Strings.DisplayCardO365ConnectorCardV2, Strings.DisplayCardO365ConnectorCardV3, Strings.DisplayCardO365ConnectorActionableCard }; + options = new List { Strings.DisplayCardHeroCard, Strings.DisplayCardThumbnailCard, Strings.DisplayCardO365ConnectorCardV1, Strings.DisplayCardO365ConnectorCardV2, Strings.DisplayCardO365ConnectorCardV3, Strings.DisplayCardO365ConnectorActionableCard, Strings.DisplayCardO365ConnectorActionableCardV2 }; } public async Task StartAsync(IDialogContext context) @@ -51,23 +51,23 @@ public async Task DisplaySelectedCard(IDialogContext context, IAwaitable } else if (selectedCard.Equals(Strings.DisplayCardO365ConnectorCardV1)) { - context.UserData.SetValue("O365ConnectorCardChoice", Strings.DisplayCardO365ConnectorCardV1); - context.Call(new O365ConnectorCardDialog(), ResumeAfterOptionDialog); + context.Call(new ConnectorCardV1Dialog(), ResumeAfterOptionDialog); } else if (selectedCard.Equals(Strings.DisplayCardO365ConnectorCardV2)) { - context.UserData.SetValue("O365ConnectorCardChoice", Strings.DisplayCardO365ConnectorCardV2); - context.Call(new O365ConnectorCardDialog(), ResumeAfterOptionDialog); + context.Call(new ConnectorCardV2Dialog(), ResumeAfterOptionDialog); } else if (selectedCard.Equals(Strings.DisplayCardO365ConnectorCardV3)) { - context.UserData.SetValue("O365ConnectorCardChoice", Strings.DisplayCardO365ConnectorCardV3); - context.Call(new O365ConnectorCardDialog(), ResumeAfterOptionDialog); + context.Call(new ConnectorCardV3Dialog(), ResumeAfterOptionDialog); } else if (selectedCard.Equals(Strings.DisplayCardO365ConnectorActionableCard)) { - context.UserData.SetValue("O365ConnectorCardChoice", Strings.DisplayCardO365ConnectorActionableCard); - context.Call(new O365ConnectorCardDialog(), ResumeAfterOptionDialog); + context.Call(new ActionableMessageCardDialog(), ResumeAfterOptionDialog); + } + else if (selectedCard.Equals(Strings.DisplayCardO365ConnectorActionableCardV2)) + { + context.Call(new ActionableMessageCardDialogV2(), ResumeAfterOptionDialog); } } diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/HelpDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/HelpDialog.cs index 6eb5061..ce5332b 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/HelpDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/HelpDialog.cs @@ -50,7 +50,9 @@ public async Task StartAsync(IDialogContext context) new CardAction(ActionTypes.ImBack, Strings.HelpCaptionDisplayCards, value: Strings.cmdDisplayCards), new CardAction(ActionTypes.ImBack, Strings.HelpCaptionDeepLink, value: Strings.cmdDeepLink), new CardAction(ActionTypes.ImBack, Strings.HelpCaptionAuthSample, value: Strings.cmdAuthSampleDialog), - new CardAction(ActionTypes.ImBack, Strings.HelpLocalTimeZone, value: Strings.cmdLocalTime) + new CardAction(ActionTypes.ImBack, Strings.HelpLocalTimeZone, value: Strings.cmdLocalTime), + new CardAction(ActionTypes.ImBack, Strings.HelpCaptionMessageBack, value: Strings.cmdMessageBack), + new CardAction(ActionTypes.ImBack, Strings.HelpCaptionPopUpSignIn, value: Strings.cmdPopUpSignIn) } }.ToAttachment() }; diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/ProactiveMsgTo1to1Dialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/ProactiveMsgTo1to1Dialog.cs index 2359d86..caf84a8 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/ProactiveMsgTo1to1Dialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/ProactiveMsgTo1to1Dialog.cs @@ -10,8 +10,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Fetch Roster Dialog Class. Main purpose of this dialog class is to Call the Roster Api and Post the - /// members information (Name and Id) in Teams. This Dialog is using Thumbnail Card to show the member information in teams. + /// This is Proactive Message Dialog Class. Main purpose of this class is to show the Send Proactive Message Example /// [Serializable] public class ProactiveMsgTo1to1Dialog : IDialog diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateCardMsgSetupDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateCardMsgSetupDialog.cs index b3858ea..9edcd09 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateCardMsgSetupDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateCardMsgSetupDialog.cs @@ -10,8 +10,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Fetch Roster Dialog Class. Main purpose of this dialog class is to Call the Roster Api and Post the - /// members information (Name and Id) in Teams. This Dialog is using Thumbnail Card to show the member information in teams. + /// This is Update Card Dialog Class. Main purpose of this class is to Setup the Card and Update the Card in Bot example /// [Serializable] public class UpdateCardMsgSetupDialog : IDialog diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgDialog.cs index d67bcdd..c6f4ec2 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgDialog.cs @@ -9,8 +9,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Fetch Roster Dialog Class. Main purpose of this dialog class is to Call the Roster Api and Post the - /// members information (Name and Id) in Teams. This Dialog is using Thumbnail Card to show the member information in teams. + /// This is Update Text Dialog Class. Main purpose of this class is to Update the Text in Bot /// [Serializable] public class UpdateTextMsgDialog : IDialog diff --git a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgSetupDialog.cs b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgSetupDialog.cs index bc6c7ee..fc7c075 100644 --- a/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgSetupDialog.cs +++ b/template-bot-master-csharp/src/dialogs/examples/teams/UpdateTextMsgSetupDialog.cs @@ -9,8 +9,7 @@ namespace Microsoft.Teams.TemplateBotCSharp.Dialogs { /// - /// This is Fetch Roster Dialog Class. Main purpose of this dialog class is to Call the Roster Api and Post the - /// members information (Name and Id) in Teams. This Dialog is using Thumbnail Card to show the member information in teams. + /// This is Update Setup Text Dialog Class. Main purpose of this class is to Setup the Card in Bot example /// [Serializable] public class UpdateTextMsgSetupDialog : IDialog diff --git a/template-bot-master-csharp/template-bot-master-csharp.csproj b/template-bot-master-csharp/template-bot-master-csharp.csproj index dbebb25..b5b61eb 100644 --- a/template-bot-master-csharp/template-bot-master-csharp.csproj +++ b/template-bot-master-csharp/template-bot-master-csharp.csproj @@ -43,23 +43,23 @@ 4 - - ..\packages\Autofac.4.6.1\lib\net45\Autofac.dll + + ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll True $(SolutionDir)\packages\Chronic.Signed.0.3.2\lib\net40\Chronic.dll - - ..\packages\Microsoft.Bot.Builder.3.9.1.0\lib\net46\Microsoft.Bot.Builder.dll + + ..\packages\Microsoft.Bot.Builder.3.11.0\lib\net46\Microsoft.Bot.Builder.dll True - - ..\packages\Microsoft.Bot.Builder.3.9.1.0\lib\net46\Microsoft.Bot.Builder.Autofac.dll + + ..\packages\Microsoft.Bot.Builder.3.11.0\lib\net46\Microsoft.Bot.Builder.Autofac.dll True - - ..\packages\Microsoft.Bot.Builder.3.9.1.0\lib\net46\Microsoft.Bot.Connector.dll + + ..\packages\Microsoft.Bot.Connector.3.11.1\lib\net45\Microsoft.Bot.Connector.dll True @@ -104,12 +104,14 @@ ..\packages\System.IdentityModel.Tokens.Jwt.4.0.4.403061554\lib\net45\System.IdentityModel.Tokens.Jwt.dll True + $(SolutionDir)\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll True @@ -141,11 +143,13 @@ + + Designer @@ -154,6 +158,7 @@ + True True @@ -167,12 +172,17 @@ + + + + + + - diff --git a/template-bot-master-csharp/utility/TemplateUtility.cs b/template-bot-master-csharp/utility/TemplateUtility.cs index cd331f7..81d2cf1 100644 --- a/template-bot-master-csharp/utility/TemplateUtility.cs +++ b/template-bot-master-csharp/utility/TemplateUtility.cs @@ -38,22 +38,9 @@ public static string GetLocale(Activity activity) } } } - return activity.Locale; } - public static Attachment GetChoiceOptionCard() - { - return new HeroCard(Strings.DisplayCardsPromptChoiceTitle) - { - Buttons = new List - { - new CardAction(ActionTypes.ImBack, Strings.OptionYes, value: Strings.cmdDisplayCards), - new CardAction(ActionTypes.ImBack, Strings.OptionNo, value: Strings.cmdNoDisplayCards) - } - }.ToAttachment(); - } - public static ComposeExtensionAttachment CreateComposeExtensionCardsAttachments(string title,string text,string imageUrl, string state) { return GetComposeExtensionMainResultAttachment(title, text, imageUrl, state).ToComposeExtensionAttachment(GetComposeExtensionPreviewAttachment(title, text, imageUrl, state)); @@ -87,7 +74,7 @@ public static Attachment GetComposeExtensionMainResultAttachment(string title,st } } - public static Attachment GetComposeExtensionPreviewAttachment(string title,string text, string imageUrl, string state) + public static Attachment GetComposeExtensionPreviewAttachment(string title, string text, string imageUrl, string state) { if (string.Equals(state.ToLower(), "hero")) { @@ -126,5 +113,6 @@ public static string ParseJson(string inputString) return null; } + } } \ No newline at end of file