This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("ChatFunction")] | |
public static async Task<HttpResponseMessage> ChatFunction([HttpTrigger(AuthorizationLevel.Anonymous, Route = "v1/messages")] HttpRequestMessage req, | |
TraceWriter log) | |
{ | |
using (BotService.Initialize()) | |
{ | |
// authenticate incoming request and add activity.ServiceUrl to MicrosoftAppCredentials.TrustedHostNames | |
// if request is authenticated | |
if (!await BotService.Authenticator.TryAuthenticateAsync(req, new[] | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deserialize the incoming activity | |
string jsonContent = await req.Content.ReadAsStringAsync(); | |
var activity = JsonConvert.DeserializeObject<Activity>(jsonContent); | |
if (activity != null) | |
{ | |
if (activity.Type == ActivityTypes.Message) | |
await Conversation.SendAsync(activity,() => | |
new NewPostcardDialog(Conversation.Container.Resolve<IAppSettingsService>(), | |
Conversation.Container.Resolve<IPaypalService>(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void RegisterDependencies(IAppSettingsService settingsService) | |
{ | |
var store = new TableBotDataStore(settingsService.StorageConnectionString); | |
Conversation.UpdateContainer(builder => | |
{ | |
builder.RegisterModule(new DefaultExceptionMessageOverrideModule()); | |
builder.Register(c => store) | |
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore) | |
.AsSelf() | |
.SingleInstance(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("ChatFunction")] | |
public static async Task<HttpResponseMessage> ChatFunction([HttpTrigger(AuthorizationLevel.Anonymous, Route = "v1/messages")] HttpRequestMessage req, | |
TraceWriter log) | |
{ | |
return new HttpResponseMessage(HttpStatusCode.OK); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"] | |
.ConnectionString); | |
Conversation.UpdateContainer(builder => { | |
builder.RegisterModule(new DefaultExceptionMessageOverrideModule()); | |
builder.Register(c => store) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[BotAuthentication] | |
public class MessagesController : ApiController | |
{ | |
private readonly ITableService _tableService; | |
public MessagesController(ITableService tableService) | |
{ | |
_tableService = tableService; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestSample | |
{ | |
public int HighestProductOfThree(int[] arrayOfInts) | |
{ | |
if (arrayOfInts.Length < 3) | |
throw new ArgumentException("Less than 3 items!"); | |
// We're going to start at the 3rd item (at index 2) | |
// so pre-populate highests and lowests based on the first 2 items. | |
// we could also start these as null and check below if they're set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MapKit; | |
using CoreLocation; | |
using CoreGraphics; | |
using System.Drawing; | |
using Foundation; | |
namespace BinaryQuest | |
{ | |
[Register("MKMapViewZoomLevel")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ScrollViewer x:Name="ScrollViewer" AutomationProperties.AccessibilityView="Raw" BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" Padding="{TemplateBinding Padding}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}" VerticalScrollMode="Disabled"> | |
<ItemsPresenter/> | |
</ScrollViewer> |